<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ck34 on Medium]]></title>
        <description><![CDATA[Stories by ck34 on Medium]]></description>
        <link>https://medium.com/@chattkush34?source=rss-07a2d45949bd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AOjEGMSWCioAzWxJ</url>
            <title>Stories by ck34 on Medium</title>
            <link>https://medium.com/@chattkush34?source=rss-07a2d45949bd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 15:27:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chattkush34/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Learn RAG in 10mins]]></title>
            <link>https://medium.com/@chattkush34/learn-rag-in-10mins-8cb7015fab02?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cb7015fab02</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[rags]]></category>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Tue, 24 Nov 2026 12:18:25 GMT</pubDate>
            <atom:updated>2026-11-24T12:18:25.121Z</atom:updated>
            <content:encoded><![CDATA[<p>A few months ago, I built my own RAG system to understand how AI can answer questions using our own documents. I never got around to writing about it, so here we are.</p><p>The entire system runs locally using Python, Ollama and ChromaDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OB8-1KSgURW3f0L5RL-c9A.png" /></figure><h3>What is RAG?</h3><p>RAG stands for Retrieval-Augmented Generation.</p><p>Imagine giving an AI a 500-page book and asking a question about it. Instead of sending the entire book to the AI every time, we search for the relevant parts and send only those along with the question.</p><p>That’s essentially what RAG does.</p><h3>What are vectors?</h3><p>Vectors are simply arrays of numbers. In RAG, we use them to represent the meaning of text.</p><p>For example:</p><pre>&quot;Dog&quot;    → [0.91, 0.82, 0.12]<br>&quot;Puppy&quot;  → [0.89, 0.85, 0.14]<br>&quot;Laptop&quot; → [0.12, 0.21, 0.92]</pre><p>These are imaginary values, but notice how Dog and Puppy have similar vectors.</p><p>This allows us to search based on meaning rather than just matching words.</p><p>The process of converting text into these vectors is called <strong>embedding</strong>.</p><h3>How does my RAG work?</h3><h3>1. Extract and split the text</h3><p>I use PyMuPDF to extract text from PDFs and split it into smaller pieces called chunks.</p><pre>CHUNK_SIZE = 1000<br>CHUNK_OVERLAP = 200</pre><p>Each chunk contains up to 1,000 characters, with a 200-character overlap to avoid losing context between chunks.</p><h3>2. Generate vector embeddings</h3><p>I use nomic-embed-text through Ollama to convert each chunk into a vector.</p><pre>def create_embedding(text):<br>    response = ollama.embed(<br>        model=&quot;nomic-embed-text&quot;,<br>        input=text,<br>    )</pre><pre>    return response[&quot;embeddings&quot;][0]</pre><p>The embedding model takes text and returns an array of numbers representing its meaning.</p><h3>3. Store vectors in a database</h3><p>I use ChromaDB to store the vectors alongside their original text and source information.</p><pre>collection.add(<br>    ids=[f&quot;chunk_{document_id}&quot;],<br>    embeddings=[embedding],<br>    documents=[chunk],<br>    metadatas=[{<br>        &quot;source&quot;: page[&quot;source&quot;],<br>        &quot;page&quot;: page[&quot;page&quot;],<br>    }],<br>)</pre><p>Storing the source and page number also helps me trace where the information came from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lL2eXZWgturocgt-9wgSWQ.png" /></figure><h3>4. Retrieve relevant information</h3><p>When a user asks a question, I convert that question into a vector using the same embedding model.</p><pre>query_embedding = create_embedding(question)</pre><pre>results = collection.query(<br>    query_embeddings=[query_embedding],<br>    n_results=5,<br>)</pre><p>ChromaDB compares the question’s vector with the stored vectors and returns the five closest matches.</p><h3>5. Generate the answer</h3><p>Finally, I send the retrieved text along with the original question to Llama 3.2.</p><pre>prompt = f&quot;&quot;&quot;<br>Answer using the provided context.</pre><pre>Context: {context_text}<br>Question: {question}<br>&quot;&quot;&quot;</pre><pre>response = ollama.chat(<br>    model=&quot;llama3.2&quot;,<br>    messages=[{<br>        &quot;role&quot;: &quot;user&quot;,<br>        &quot;content&quot;: prompt,<br>    }],<br>)</pre><p>The AI now has relevant information from my documents to help answer the question.</p><h3>Final thoughts</h3><p>Building my own RAG helped me understand that you don’t always need to train or fine-tune an AI model to give it access to new information.</p><p>Sometimes, you just need to find the right information and give it to the model at the right time.</p><p>The entire project runs locally, requires no paid APIs, and is built without LangChain.</p><p>Source code: <a href="https://github.com/kush34/rag">https://github.com/kush34/rag</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cb7015fab02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My React Native Interview Experience | P2]]></title>
            <link>https://medium.com/@chattkush34/my-react-native-interview-experience-p2-8eb94647de4f?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eb94647de4f</guid>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Sat, 05 Sep 2026 11:13:03 GMT</pubDate>
            <atom:updated>2026-09-05T11:13:03.150Z</atom:updated>
            <content:encoded><![CDATA[<h3>My Interview Experience | P2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xDi2csEAWxu95IEkaNdFUQ.png" /></figure><h4>As I shared in my last interview experience, I was accused of cheating during an interview by the company.</h4><p>The next day, I reached out to the HR and gave my feedback about the interview. I also asked if I could have an in-person interview instead, since I felt that would be a better way to properly demonstrate my knowledge and avoid any misunderstanding.</p><p>HR agreed, and the date, time, and venue were shared with me.</p><h3>The In-Person Interview</h3><p>I reached the office at around <strong>2:37 PM</strong>, while my interview was scheduled for around <strong>3:00 PM</strong>.</p><p>I waited for around <strong>40–45 minutes</strong> before the interview finally started.</p><p>Interestingly, the technical interview was again conducted <strong>online</strong>, with the same person who had taken my first round.</p><p>Some of the questions asked were:</p><ol><li><strong>Android version-specific issue: </strong>Suppose an app is working properly on some Android versions but failing specifically on <strong>Android 13 and 14</strong>. How would you approach debugging and resolving the issue?</li><li><strong>Race Conditions: </strong>Do you know what race conditions are? Explain them and where they can occur.</li><li><strong>Two customers booking the same seat: </strong>What would happen if two customers make a payment for the <strong>same single seat</strong>, and both payments are successful? How would you design the system to handle this situation?</li><li><strong>IRCTC Tatkal booking: </strong>The same problem was asked again, but this time in the context of <strong>IRCTC Tatkal booking</strong>, where a huge number of users may try to book the same limited seats simultaneously.</li><li><strong>Code review : </strong>I was given the following code snippet and asked to point out the issues in it:</li></ol><pre>const profile = () =&gt; {   <br>  const [users, setUsers] = useState(null);    <br>  useEffect(() =&gt; {     <br>    const usersFetching = setTimeout(() =&gt; {       <br>    fetch(`/api/users/{userid}`)         <br>    .then(res =&gt; res.json())         <br>    .then()     <br>  }, 5000)   }, [])    <br>  return &lt;Text&gt;{user?.name}&lt;/Text&gt; <br>};</pre><p>I had to identify what was wrong with the code and explain the issues.</p><ol><li><strong>Memory Profiler</strong>:</li></ol><ul><li>What is a memory profiler?</li></ul><p>That’s pretty much what was covered in the technical round.</p><h3>The Offline Session</h3><p>After that, I had another session with a different interviewer, this time as an offline/in-person discussion.</p><p>The conversation was more focused on my background and experience.</p><p>I was asked about my <strong>college course</strong>, the subjects I had studied, and the topics I was familiar with.</p><p>I was specifically asked whether I had built any <strong>AI projects</strong>, followed by questions about my <strong>internship experience</strong> and the work I had done there.</p><p>And that was pretty much the entire interview process.</p><p>I still find the whole experience interesting because the reason I asked for an in-person interview in the first place was to clear up the earlier misunderstanding. Yet, even after reaching the office, waiting there, and attending the interview, the technical round was conducted online again.</p><p>I don’t want to make this post about blaming anyone. I’m simply sharing what happened from my side and what the interview process looked like.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eb94647de4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native Developer Interview Experience]]></title>
            <link>https://medium.com/@chattkush34/react-native-developer-interview-experience-cbc7d143c3ca?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbc7d143c3ca</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Mon, 24 Aug 2026 06:52:06 GMT</pubDate>
            <atom:updated>2026-08-24T06:52:06.585Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kipiXv6EpMLXgjQ7MzsL2w.png" /></figure><p>Today at 11:45 AM, I gave an interview for a <strong>React Native Developer</strong> role at a company. The salary range for the role is <strong>₹3–5 LPA</strong>, which is definite after clearing this round.</p><p>The interview link for Google Meet was shared a day before. I joined the meeting about 5 minutes early and had already checked my audio and video beforehand.</p><p>The HR asked me to wait for around 5 minutes for the interviewer to join. The interview then started on time.</p><h3>Interview</h3><p>The interviewer asked me to introduce myself.</p><p>I gave a simple introduction:</p><blockquote><em>I’m Kush, a developer from Mumbai. I have completed two internships — one with a logistics company based out of Ireland and another with a company based in Mumbai.</em></blockquote><p>I initially forgot to mention my tech stack when introducing myself. Later, when the interviewer asked about it, I explained that:</p><ul><li>For frontend, I work with <strong>Next.js and Tailwind CSS</strong>.</li><li>For backend, I use <strong>Node.js and TypeScript</strong>.</li><li>I also have experience with <strong>Python, Flask, and Django</strong>.</li></ul><p>I don’t remember the exact sequence of the questions, but these were the main questions discussed:</p><h3>Questions Asked</h3><ol><li><strong>If we integrate the Gemini API into our application, can we call it directly from the client/mobile app?</strong></li><li><strong>How does Uber assign rides to drivers?</strong></li><li><strong>How would you build a Blinkit-like quick-commerce application?</strong></li><li><strong>Can we store user authentication credentials on a mobile application?</strong></li><li><strong>Explain in depth how authentication and authorization work.</strong></li><li><strong>What do you use for testing, and what different types of testing do you know?</strong></li><li><strong>Suppose an application crashes on only iOS or only Android. How would you identify and debug the platform-specific issue?</strong></li></ol><h3>Interview Summary</h3><p>The interview started at around <strong>11:40 AM</strong> and ended at around <strong>12:45 PM</strong>, so it lasted approximately <strong>one hour</strong>.</p><p>Overall, the interview was mostly discussion-based rather than a rapid-fire question-and-answer round. The questions were focused more on how I approach real-world application development, security, system design, testing, and debugging rather than only React Native syntax.</p><p>Result Selected for Next Round.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbc7d143c3ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First In person interview | Mumbai]]></title>
            <link>https://medium.com/@chattkush34/first-in-person-interview-mumbai-339dbda69f1d?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/339dbda69f1d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Sun, 03 May 2026 08:57:02 GMT</pubDate>
            <atom:updated>2026-05-03T08:57:02.865Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OOISHvez3NtHqrFbYbt0zA.jpeg" /></figure><p>Today i gave my first in person interview.</p><p>It was at a place from where airport can be seen and its was a great looking GLASS building.I went to #0#2, office at #### ##### near saki naka.</p><p>I reached at i think 1:30 PM. Interview was at 2:00PM but I reached early as i was asked to be 10 min before the time.I called the HR but it was not picked up. Later at 1:50 i pressed the bell again and it was answered.I wait in the reception for about half hour. Then again waited for about half hour but at the office desk along with other employees.</p><p>The atmosphere felt pretty chilled but as i was yet to give interview i was a little 🤏 less chill.Finally the HR came and mailed us two links on our mail.First one was a IQ test and second one was a behaviour type / personality question. I got introvert-intuitive-judgemental personality and IQ of 122.</p><p>Nonetheless, i completed it and waited for about an hour again. It was about 5 PM by now. But here comes the actual interview part.I was asked to build some APIs for a wallet. Some API included credit, debit , show balance and also an order api which deducts balance if sufficient amount is there.</p><p>I completed it in 1hr and waited for sometime. I had chat with another person who also came for interview. Pretty chill guy. Priyank shrivastav</p><p>Now I thought that the process was over but one last round was pending. One on One interview. It went like viva for engineering college but it was good that i read some articles and yt vids about the language (JS).Some of the questions i was asked were about closure, hoisting, what is docker, whats docker image. How does websockets work? Why did i use socket.IO lib for my project.</p><p>After this i had discussion with Rishi ( Tech lead) interviewee abt the company, its products and some technical discussions.Overall pretty nice.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=339dbda69f1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn FastAPI under 10mins | Express to fastAPI Journey]]></title>
            <link>https://medium.com/@chattkush34/learn-fastapi-under-10mins-express-to-fastapi-journey-01d225dfcd6a?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/01d225dfcd6a</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[fastapi]]></category>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 14:28:09 GMT</pubDate>
            <atom:updated>2026-03-18T16:57:16.806Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GyBuIJBAvijQvOjOTw0DQQ.jpeg" /></figure><p>Today i started learning about fastapi and coming from express i find it as a long lost sibling of express.Its very simple to create a fastapi starter.</p><p>To get started we will create a virtual environment.</p><pre>python -m venv venv</pre><p>This command create a virtual environment. and to activate it we will use the below command.</p><pre>source venv/bin/activate</pre><p>Now lets install fastapi on our project.</p><pre>pip install “fastapi[standard]”</pre><pre># main.py<br>from fastapi import FastAPI<br>app = FastAPI()<br>@app.get(&quot;/&quot;)<br>def responsd:<br>return {&quot;Hello&quot;:&quot;World&quot;}</pre><p>This was quite simple but lets do some real world api to have a good knowledge. Let create an account of user on database. We will be using mongodb for simplicity. To use mongodb we will use pymongo to communicate with our database. We also use dotenv package to store our database uri.</p><pre>pip install pymongo python-dotenv</pre><p>Create .env file at root of your project and place database uri there.</p><pre># .env<br>MONGO_URI= place_your_db_uri</pre><p>Now we create file to connect to our database.We first get our database URI from the environment. variable and then connects to the database.</p><pre># config/database.py<br>from pymongo.mongo_client import MongoClient<br>from pymongo.server_api import ServerApi<br>import os<br>uri = os.getenv(&quot;MONGO_URI&quot;)<br>def connect_db():<br>&quot;&quot;&quot;Connectst to the database&quot;&quot;&quot;<br>print(f&quot;{uri} database uri&quot;)<br># Create a new client and connect to the server<br>client = MongoClient(uri, server_api=ServerApi(&#39;1&#39;))<br>db = client[&quot;mydb&quot;]<br># Send a ping to confirm a successful connection<br>try:<br>client.admin.command(&#39;ping&#39;)<br>print(&quot;Pinged your deployment. You successfully connected to MongoDB!&quot;)<br>except Exception as e:<br>print(e)</pre><p>Now we need a structure for of user model. we create model to define fields for that in models folder. We use another package which helps us with that</p><pre>pip install pydantic</pre><pre>from pydantic import BaseModel, EmailStr<br><br>class User(BaseModel):<br>  name: str(min_length=3,max_length=50)<br>  password:str(min_lenght=5,max_length=15)<br>  email: EmailStr()<br>  age: int(gt=0,lt=120)<br>class Credentials(BaseModel):<br>  email:EmailStr<br>  password:str</pre><p>Now to have a clean code and good practices (practices i follow). We will create all the routes related to users in a seperate router file.</p><p>So for creating a router we just import APIRouter from the fastapi lib and give it a instance and use it with HTTP method we want the API to be.</p><pre>from fastapi import APIRouter<br>router = APIRouter()<br>@router.method(&quot;/endpoint&quot;)<br>def function():<br>return {&quot;Data&quot;:&quot;value&quot;}</pre><p>following similar pattern we will create this route. Now you may see some functions here like hash_password and verify_password which are needed so we have another file under utils folder that has those funcs.</p><pre>#router/user.py<br>from fastapi import APIRouter,HTTPException<br>from utils.helpers import hash_password,verify_password<br>from db.mongo import user_collection<br>from models.user import User<br>from models.user import Credentials<br><br>router = APIRouter(prefix=&quot;/users&quot;, tags=[&quot;Users&quot;])<br><br>@router.post(&quot;/register&quot;)<br>def register_user(user:User):<br>  &quot;&quot;&quot;This function creates an account for a user&quot;&quot;&quot;<br>  hashed = hash_password(user.password)<br>  user_dict = user.model_dump()<br>  user_dict[&quot;password&quot;] = hashed<br>  result = user_collection.insert_one(user_dict)<br>  return str(result.inserted_id)<br><br>@router.post(&quot;/login&quot;)<br>def login_user(credentials:Credentials):<br>  &quot;&quot;&quot;This function logs the user with correct credentials&quot;&quot;&quot;<br>  req_user = credentials.model_dump()<br>  db_user = user_collection.find_one({&quot;email&quot;:req_user.email})<br>  if not db_user:<br>  raise HTTPException(status_code=400, detail=&quot;Invalid credentials&quot;)<br>  if not verify_password(credentials.password, db_user[&quot;password&quot;]):<br>  raise HTTPException(status_code=400, detail=&quot;Invalid credentials&quot;)<br>  return {&quot;message&quot;: &quot;Login successful&quot;}</pre><p>we will use this helper functions to hash the password of the users.</p><pre>pip install passlib</pre><pre>from passlib.context import CryptContext<br><br>pwd_context = CryptContext(schemes=[&quot;bcrypt&quot;], deprecated=&quot;auto&quot;)<br><br>def hash_password(password: str) -&gt; str:<br>  return pwd_context.hash(password)<br><br>def verify_password(plain_password: str, hashed_password: str) -&gt; bool:<br>  return pwd_context.verify(plain_password, hashed_password)</pre><p>At-last we will include the user router in our main app file to link it.We have to load the environment. variable in app using the load_dotenv import.</p><p>Also we use include_router method to link our user router to our app.</p><pre># main.py<br>from config.database import connect_db<br>from fastapi import FastAPI<br>from dotenv import load_dotenv<br>from routers.user import router as user_router<br>load_dotenv()<br><br>app = FastAPI()<br>connect_db()<br><br>app.include_router(user_router)<br><br>@app.get(&quot;/&quot;)<br>def read_root():<br>  return {&quot;Hello&quot;: &quot;World&quot;}</pre><p>Happy learning Cheers now you have a working fastapi app with database connection in 10 mins.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01d225dfcd6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making an App out of Spite]]></title>
            <link>https://medium.com/@chattkush34/making-an-app-out-of-spite-abfb05998df7?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/abfb05998df7</guid>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 05:36:06 GMT</pubDate>
            <atom:updated>2026-03-12T05:36:06.191Z</atom:updated>
            <content:encoded><![CDATA[<h3>10 Feb 2026</h3><p>For the past few days I have been unemployed. During this time I generally don’t say no to things that seem interesting to me. I treat these things as <strong>side quests</strong>, using video game terminology.</p><p>Last Friday, my brother who is pursuing CA asked for help. At his firm he was assigned to perform <strong>physical verification of assets</strong> for a company.</p><p>The work was huge. We had to travel around the city verifying assets, taking pictures of them, and recording their <strong>coordinates</strong>, along with a <strong>map snapshot overlaid on the image</strong>.</p><p>See the reference image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*tu0dL4PUdmJYxDXR" /></figure><h3>The Problem</h3><p>I tried several apps from the app store for this task. Most of them simply didn’t work properly. After trying a few, I finally found one that actually worked.</p><p>Unfortunately, it <strong>bombarded me with ads for virtually every click</strong>.</p><p>Generally, I don’t mind ads in free apps. If you’re offering something for free and monetizing through ads, that’s fair. But there’s a limit. Ads should <strong>not hinder the core functionality of the product you’re monetizing</strong>.</p><p>(What Microsoft is doing with their OS lately is a good example of crossing that line.)</p><h3>The Solution</h3><p>Even though I had to use the app for the entire day, the experience annoyed me enough that I decided to build my own version.</p><p>The goal was simple: an app that lets you <strong>take images with additional information attached</strong>, like coordinates and a map overlay.</p><p>I had previously learned <strong>React Native</strong> for a freelance project. Since I also needed the app to run on both <strong>iOS and Android</strong>, it was the obvious choice.</p><p>I managed to get a <strong>working prototype ready within an hour</strong>. After a few fixes and some small improvements, we had a usable prototype.</p><p>The app uses <strong>no external APIs</strong>, and most importantly, it <strong>does not play ads every time you touch the screen</strong>.</p><p>I used <strong>Claude and Gemini</strong> to help build it.</p><h3>Some Pinch of Salt</h3><p>While the app does the job, it currently uses the <strong>expo-camera</strong> library to capture images. The image quality is honestly not great.</p><p>But for a prototype, I’m satisfied.</p><h3>Next Step</h3><p>I’m thinking of <strong>publishing the app</strong> and spending about a week improving it so it can become a proper competitor to similar apps on the <strong>App Store and Play Store</strong>.</p><h3>Conclusion</h3><p>Even though a lot of software development has become commoditized, there are still apps with <strong>terrible user experiences</strong> dominating certain niches.</p><p>That’s honestly a bizarre situation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abfb05998df7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Suchale — A Scalable Chat Application (MERN + TypeScript + Redis)]]></title>
            <link>https://medium.com/@chattkush34/suchale-a-scalable-chat-application-mern-typescript-redis-6fdfd7ba6aaa?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fdfd7ba6aaa</guid>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 15:25:47 GMT</pubDate>
            <atom:updated>2026-01-22T15:25:47.148Z</atom:updated>
            <content:encoded><![CDATA[<h3>Suchale — A Scalable Chat Application (MERN + TypeScript + Redis)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DDwx8SASJxbOj0Hk-yB6bA.png" /></figure><h3>Introduction</h3><p>This article explains <strong>how a real-time chat application is built</strong> using the <strong>MERN stack</strong>, <strong>TypeScript</strong>, <strong>Socket.IO</strong>, and <strong>Redis</strong>.</p><p><strong>What this is:</strong></p><ul><li>A walkthrough of an <em>already built</em> system</li><li>Focused on architecture, event flow, and scaling decisions</li></ul><p><strong>What this is not:</strong></p><ul><li>A step-by-step tutorial</li><li>A beginner introduction to React or Express</li></ul><p>The core idea is simple: <strong>real-time messaging that scales horizontally</strong>.</p><h3>Understanding WebSockets</h3><p>Before WebSockets, there was HTTP.</p><h3>HTTP in one minute</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XbYjObpw8Nanjm7NzBKzIQ.png" /></figure><ol><li>Client sends a request</li><li>Server responds</li><li>Connection closes</li></ol><pre>Client → Server → Client</pre><p>This model breaks down for chats.</p><blockquote><em>You don’t want the client polling every second just to ask: </em>“Any new messages?”</blockquote><h3>Enter WebSockets</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cR3pe0abBkxcQEmDDbmVQ.png" /></figure><p>WebSockets keep a <strong>persistent connection</strong> open between client and server. Communication becomes <strong>event-driven</strong>.</p><p><strong>Example:</strong></p><ul><li>User A sends a message</li><li>Server emits messageSent</li><li>User B’s client updates instantly</li></ul><p>No polling. No delays.</p><h3>Backend Architecture</h3><p>We use:</p><ul><li><strong>Express</strong> → REST APIs</li><li><strong>Socket.IO</strong> → real-time events</li><li><strong>Redis</strong> → shared state across servers</li></ul><h3>Socket.IO Basics</h3><p>Emit an event:</p><pre>socket.emit(&quot;event&quot;, data)</pre><p>Listen for events:</p><pre>io.on(&#39;connection&#39;, (socket) =&gt; {<br>  socket.on(&#39;chat message&#39;, (message) =&gt; {<br>    console.log(message)<br>  })<br>})</pre><h3>Server Setup</h3><p>The HTTP server and WebSocket server share the same port.</p><pre>import express from &quot;express&quot;<br>import { createServer } from &quot;node:http&quot;<br>import { Server } from &quot;socket.io&quot;</pre><pre>const app = express()<br>const server = createServer(app)<br>const io = new Server(server, {<br>  cors: { origin: allowedOrigins, credentials: true }<br>})</pre><pre>export { io }<br>export default server</pre><p>This allows REST APIs and real-time events to coexist cleanly.</p><h3>Making the App Stateless (Scaling 101)</h3><p>Vertical scaling dies eventually.</p><p>When traffic increases, you:</p><ul><li>Run <strong>multiple server instances</strong></li><li>Put them behind a <strong>load balancer</strong></li></ul><h3>The problem</h3><blockquote><em>How does Server A know where a user connected to Server B lives?</em></blockquote><h3>The solution: Redis</h3><p>Redis stores:</p><ul><li>Online users</li><li>Socket IDs</li><li>Shared session state</li></ul><p>If one server crashes, <strong>nothing important is lost</strong>.</p><h3>Socket Event Handling</h3><p>Below is the <strong>complete backend Socket.IO implementation</strong>, kept <strong>verbatim</strong>. No edits, no pruning, no refactors.</p><pre>import { Server, Socket } from &#39;socket.io&#39;;<br>import Group from &quot;./models/groupModel&quot;;<br>import Message from &quot;./models/messageModel&quot;;<br>import User from &quot;./models/userModel&quot;;<br>import redis from &quot;./utils/redis&quot;;<br>import { verifySocketToken } from &quot;./middlewares/verifyToken&quot;;</pre><pre>interface SocketData {<br>    user: {<br>        id: string;<br>        username: string;<br>        email: string;<br>    }<br>}</pre><pre>type AuthenticatedSocket = Socket&lt;any, any, any, SocketData&gt;;</pre><pre>export default function socketHandler(io: Server) {<br>    io.use(verifySocketToken);</pre><pre>    io.on(&#39;connection&#39;, async (socket: AuthenticatedSocket) =&gt; {<br>        const { id: userId, username } = socket.data.user;</pre><pre>        console.log(`⚡ User connected: ${username} (Socket ID: ${socket.id})`);</pre><pre>        try {<br>            await redis.hset(&#39;onlineUsers&#39;, username, socket.id);<br>            await redis.hset(&#39;socketToUsername&#39;, socket.id, username);</pre><pre>            const dbUser = await User.findById(userId).populate(&#39;contacts&#39;);<br>            if (dbUser) {<br>                const groups = await Group.find({ users: userId }).select(&quot;_id name&quot;);<br>                groups.forEach((group) =&gt; {<br>                    socket.join(group._id.toString());<br>                });</pre><pre>                for (const contact of (dbUser.contacts as any)) {<br>                    const contactSocketId = await redis.hget(&#39;onlineUsers&#39;, contact.username);<br>                    if (contactSocketId) {<br>                        io.to(contactSocketId).emit(&#39;friendOnline&#39;, username);<br>                    }<br>                }<br>            }<br>        } catch (error) {<br>            console.error(error);<br>        }</pre><pre>        socket.on(&quot;typing&quot;, async ({ to }) =&gt; {<br>            const recipientSocketId = await redis.hget(&#39;onlineUsers&#39;, to);<br>            if (recipientSocketId) {<br>                io.to(recipientSocketId).emit(&quot;typing&quot;, { from: username });<br>            }<br>        });</pre><pre>        socket.on(&quot;stopTyping&quot;, async ({ to }) =&gt; {<br>            const recipientSocketId = await redis.hget(&#39;onlineUsers&#39;, to);<br>            if (recipientSocketId) {<br>                io.to(recipientSocketId).emit(&quot;stopTyping&quot;, { from: username });<br>            }<br>        });</pre><pre>        socket.on(&quot;sendGroupMessage&quot;, async ({ groupId, content }) =&gt; {<br>            const message = await Message.create({ sender: userId, content, chat: groupId });<br>            await Group.findByIdAndUpdate(groupId, { $push: { messages: message._id } });<br>            io.to(groupId).emit(&quot;newGroupMessage&quot;, { groupId, message });<br>        });</pre><pre>        socket.on(&quot;readMessages&quot;, async ({ fromUser }) =&gt; {<br>            await Message.updateMany(<br>                { from: fromUser, to: userId, read: false },<br>                { $set: { read: true } }<br>            );</pre><pre>            const fromSocketId = await redis.hget(&#39;onlineUsers&#39;, fromUser);<br>            if (fromSocketId) {<br>                io.to(fromSocketId).emit(&quot;messagesReadBy&quot;, { byUser: username });<br>            }<br>        });</pre><pre>        socket.on(&#39;disconnect&#39;, async () =&gt; {<br>            await redis.hdel(&#39;onlineUsers&#39;, username);<br>            await redis.hdel(&#39;socketToUsername&#39;, socket.id);</pre><pre>            const dbUser = await User.findById(userId).populate(&#39;contacts&#39;);<br>            if (dbUser) {<br>                for (const contact of (dbUser.contacts as any)) {<br>                    const contactSocketId = await redis.hget(&#39;onlineUsers&#39;, contact.username);<br>                    if (contactSocketId) {<br>                        io.to(contactSocketId).emit(&#39;friendOffline&#39;, username);<br>                    }<br>                }<br>            }<br>        });<br>    });<br>}</pre><h3>REST API Structure</h3><p>Each module has:</p><pre>Router → Controller → Service</pre><p>Why?</p><ul><li>Easier debugging</li><li>Predictable flow</li><li>Testable services</li></ul><h3>Example: User Router</h3><pre>router.post(&#39;/create&#39;, register)<br>router.post(&#39;/login&#39;, login)<br>router.get(&#39;/userInfo&#39;, verifyToken, userInfo)</pre><p>Controllers stay thin. Services do the work.</p><h3>Authentication</h3><p>JWT-based authentication is used for:</p><ul><li>REST APIs</li><li>Socket connections</li></ul><p>The same token authorizes:</p><ul><li>HTTP requests</li><li>WebSocket events</li></ul><p>This prevents identity mismatch between API and socket layers.</p><h3>Frontend (React + TypeScript)</h3><p>The frontend keeps <strong>state management and socket handling explicit</strong>. Below is the <strong>full Chat Context</strong>, preserved exactly.</p><pre>import { createContext, useEffect, useRef, useState } from &quot;react&quot;;<br>import api from &#39;../utils/axiosConfig&#39;;<br>import { UserContextType, useUser } from &#39;./UserContext&#39;;<br>import { Chat, Group, Message, User } from &quot;@/types/index&quot;;<br>export const ChatContext = createContext&lt;any&gt;(null);</pre><pre>export const ChatContextProvider = ({ children }: { children: React.ReactNode }) =&gt; {<br>    const userCtx = useUser() as UserContextType | null;<br>    const user = userCtx?.user;</pre><pre>    const [chat, setChat] = useState&lt;Chat | null&gt;(null);<br>    const [groupFlag, setGroupFlag] = useState&lt;boolean&gt;(false);<br>    const [loading, setLoading] = useState&lt;boolean&gt;(false);<br>    const [chatArr, setChatArr] = useState&lt;Message[]&gt;([]);<br>    const [infoWindow, setInfoWindow] = useState&lt;any[]&gt;([]);<br>    const [page, setPage] = useState&lt;number&gt;(1);<br>    const [hasMore, setHasMore] = useState&lt;boolean&gt;(false);</pre><pre>    const chatDivRef = useRef&lt;HTMLDivElement | null&gt;(null);</pre><pre>    const sendmessage = async (content: string) =&gt; {<br>        if (!content.trim() || !user || !chat) return;</pre><pre>        const payload = groupFlag<br>            ? { content, isGroup: true, groupId: chat._id }<br>            : { content, isGroup: false, toUser: (chat as any).username };</pre><pre>        const res = await api.post(&#39;/message/send&#39;, payload);</pre><pre>        if (res.status === 200) {<br>            setChatArr(prev =&gt; [...prev, res.data]);<br>        }<br>    };</pre><pre>    const getMessages = async (loadMore = false) =&gt; {<br>        if (!chat) return;<br>        if (loadMore &amp;&amp; !hasMore) return;</pre><pre>        const nextPage = loadMore ? page + 1 : 1;<br>        const res = await api.post(`/message/getMessages?page=${nextPage}&amp;limit=10`, {<br>            toUser: !groupFlag ? (chat as any).username : undefined,<br>            groupId: groupFlag ? chat._id : undefined,<br>            isGroup: groupFlag,<br>        });</pre><pre>        setChatArr(loadMore<br>            ? [...res.data.messages, ...chatArr]<br>            : res.data.messages<br>        );</pre><pre>        setPage(nextPage);<br>        setHasMore(res.data.hasMore);<br>    };</pre><pre>    useEffect(() =&gt; {<br>        if (chat) getMessages();<br>    }, [chat]);</pre><pre>    return (<br>        &lt;ChatContext.Provider value={{<br>            chat,<br>            setChat,<br>            chatArr,<br>            sendmessage,<br>            chatDivRef,<br>            groupFlag,<br>            setGroupFlag,<br>            getMessages,<br>            loading,<br>            hasMore,<br>            infoWindow,<br>            setInfoWindow<br>        }}&gt;<br>            {children}<br>        &lt;/ChatContext.Provider&gt;<br>    );<br>};</pre><h3>Source Code</h3><p>GitHub Repository:<br>👉 <a href="http://github.com/kush34/Suchale">http://github.com/kush34/Suchale</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fdfd7ba6aaa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to be sane when developing complex application | Testing with Jest]]></title>
            <link>https://medium.com/@chattkush34/how-to-be-sane-when-developing-complex-application-testing-with-jest-8743ccdd2520?source=rss-07a2d45949bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8743ccdd2520</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[ck34]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 15:29:25 GMT</pubDate>
            <atom:updated>2025-10-31T15:29:25.061Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bVZcRhPQ7eWmUKQ0NZeIKA.png" /><figcaption>demo image</figcaption></figure><p>I was doing development on my project and after some time i did some code refactoring and it was simple so i pushed the code to production. The things about pushing code and not testing them is when you make such changes and push it you think you have done is right but some things break and are easy to notice manually.</p><p>So i started adding test to my project to make sure the changes doesnt break any functionality which was working fine but my peanut brain missed.</p><p>Its a NodeJS backend so i used supertest and jest to write test cases. Its too easy or may be i am not doing through testing but its really simple to write tests in jest.</p><p>supppose we have a function which simply adds two number.</p><pre>function sum(a, b) { return a + b;} <br>module.exports = sum;</pre><p>we test it by importing the function and then</p><pre>const sum = require(&#39;./sum&#39;); test(&#39;adds 1 + 2 to equal 3&#39;, () =&gt; { <br>  expect(sum(1, 2)).toBe(3); <br>});</pre><p>This is how we do testing mostly. But lets see real world example. Suppose you made some changes to the login endpoint on the nodeJS backend application but how to you make sure your its working correctly. we write test case for it.</p><pre>import request from &#39;supertest&#39;;<br>import server from &#39;../index.js&#39;;<br>import mongoose from &#39;mongoose&#39;;<br><br>// connect to the database here mongoDB<br>beforeAll(async () =&gt; {<br>    await mongoose.connect(process.env.MONGO_URI_TEST);<br>});<br><br><br><br>// Describes the test group which are running. <br>describe(&#39;User Routes&#39;, () =&gt; {<br><br>    // single test which creates a new user.<br>    it(&#39;should register a new user&#39;, async () =&gt; {<br>        const res = await request(server)<br>            .post(&#39;/user/create&#39;)<br>            .send({<br>                username: &#39;TestUser&#39;,<br>                email: &#39;test@example.com&#39;,<br>                password: &#39;password123&#39;<br>            });<br>        // checks weather request is successfull<br>        expect(res.statusCode).toBe(200);<br>        console.log(res.body)<br>    });<br><br>});<br><br>// DONT DELETE YOUR MAIN<br>//....<br>//....<br>//....<br>// deleted the data base after all the tests [TEST DB] <br>afterAll(async () =&gt; {<br>    await mongoose.connection.db.dropDatabase();<br>    await mongoose.connection.close();<br>});</pre><p>This is how to run the test file.</p><pre>npm test testfile.txt</pre><p>This should be your output if your API is written correctly. hows the tutorial</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m16sJ8HFFXKIJUpVORMHkQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8743ccdd2520" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>