<?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 Gaurav Kesh Roushan on Medium]]></title>
        <description><![CDATA[Stories by Gaurav Kesh Roushan on Medium]]></description>
        <link>https://medium.com/@gkrcoder?source=rss-754f57240258------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CY8kEOPCbI10hRc55Wi1Eg.png</url>
            <title>Stories by Gaurav Kesh Roushan on Medium</title>
            <link>https://medium.com/@gkrcoder?source=rss-754f57240258------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:27:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gkrcoder/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[How I Learned Systems Programming by Building a TCP Server in C++]]></title>
            <link>https://medium.com/@gkrcoder/how-i-learned-systems-programming-by-building-a-tcp-server-in-c-4e558fc980a0?source=rss-754f57240258------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e558fc980a0</guid>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Gaurav Kesh Roushan]]></dc:creator>
            <pubDate>Tue, 25 Nov 2025 10:06:18 GMT</pubDate>
            <atom:updated>2025-11-25T13:51:51.982Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of us use high-level networking tools like <strong>Node.js, Express.js, Django, FastAPI, or gRPC</strong> without really understanding how servers work under the hood.<br> I’ve built many backend applications using these frameworks, but I always wondered:</p><blockquote><strong><em>How does a server actually work internally? What really happens behind </em></strong><strong><em>app.listen() or </em></strong><strong><em>router.get()?</em></strong></blockquote><p>So this year, I decided to challenge myself and <strong>build a TCP server completely from scratch in C++</strong> with <strong>no networking libraries, no frameworks, and no abstractions hiding the real system behavior</strong>.</p><p>Along the way, I’ve been learning deeply about <strong>operating systems, networking internals, concurrency, threading models, message queues, and distributed system fundamentals</strong>, and this project has already taught me more than many tutorials or courses ever did.</p><p><strong>I’m still very much on a learning journey ,so if you notice anything incorrect, or if there’s a better approach, please feel free to suggest improvements.</strong><br> This article is simply my attempt to document what I’ve understood so far and to share my journey of learning and building a <strong>server architecture from the ground up</strong>.</p><h3>🚀 Why Build a Server From Scratch?</h3><p>Not to replace frameworks, but to master:</p><ul><li>How the internet actually works at the socket level</li><li>How threads coordinate under heavy loads</li><li>How OS multiplexes multiple clients</li><li>How messages are ordered and processed efficiently</li><li>How real-time systems avoid blocking &amp; race conditions</li></ul><p>After understanding this, using Express / Django / Node / Go networking becomes trivial ,because you <strong>know what’s going on under the hood</strong>.</p><h3>🌍 Networking Basics — Mental Model</h3><p>Think of networking like a phone call center:</p><p><strong>ConceptReal-life analogy</strong></p><ul><li><strong>Server</strong> → Call center</li><li><strong>Client</strong> → Caller</li><li><strong>Socket</strong> → Telephone line</li><li><strong>IP Address</strong> → Phone number</li><li><strong>Port</strong> → Extension number</li><li><strong>bind()</strong> → Assign extension to a specific desk</li><li><strong>listen()</strong> → Waiting for incoming calls</li><li><strong>accept()</strong> → Answering / picking up the call</li><li><strong>recv() / send()</strong> → Speaking &amp; listening during the call</li><li><strong>close()</strong> → Ending the call</li></ul><p>👉 <strong>Every client that connects creates a new socket</strong><br> so communication stays isolated and safe.</p><h3>🧵 Threading Model</h3><p>A single thread server blocks everything.<br> So we use multithreading:</p><pre>Main thread -- accept() --&gt; worker thread per client<br>Worker threads receive messages --&gt; push to queue<br>Consumer thread pops queue --&gt; processes message --&gt; sends ACK</pre><h3>Architecture Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZPbHU_oBZNl-HwAW8D6jQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8_qCPjGxc3xa27DsglU2A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*VlXuTG6RBO1cUKiMtBt2yg.png" /></figure><h3>🧠 Thread-Safe Priority Queue</h3><p>We process urgent messages first + keep fairness using timestamps.</p><ul><li><strong>priority_queue</strong> — enables sorted and fast retrieval of highest-priority messages</li><li><strong>smart pointers (</strong><strong>unique_ptr)</strong> — zero-copy object passing and automatic memory management</li><li><strong>mutex + condition_variable</strong> — prevents race conditions and enables efficient blocking waits instead of busy loops</li><li><strong>separate consumer thread</strong> — ensures that message processing never blocks I/O operations in worker threads</li><li>pop() blocks gently instead of busy waiting:</li></ul><pre>queueConditionalVariable.wait(lock, [this](){ return !queue.empty(); });</pre><h3>🔐 Concurrency Safety Concepts Learned</h3><ul><li><strong>Mutex</strong> — ensures only one thread modifies a shared resource at a time</li><li><strong>Race condition</strong> — occurs when multiple threads access or modify the same variable concurrently without synchronization</li><li><strong>lock_guard</strong> — provides automatic RAII-based locking and unlocking of mutexes</li><li><strong>unique_ptr</strong> — guarantees single ownership of objects and prevents memory leaks</li><li><strong>atomic</strong> — allows safe increments/updates of shared values without requiring a mutex</li></ul><h3>🧾 Full Message Flow</h3><pre>nc client → connect to server<br>accept() → create worker thread<br>recv() → read data<br>push() → send message to queue<br>consumer pop() → process message<br>send ACK → client receives response</pre><h3>🎯 Key Takeaways</h3><p><strong>• TCP/IP &amp; socket lifecycle<br>• Blocking recv() vs non-blocking I/O<br>• Concurrency &amp; thread safety<br>• Scheduling &amp; priority queues<br>• Ownership &amp; memory management (RAII)<br>• Real backend service design architecture</strong></p><p>This project alone massively improved my understanding of backend systems and OS internals.</p><h3>🤝 Acknowledgement</h3><p>I built this project step-by-step while learning deeply about systems programming.<br> <strong>ChatGPT supported me by explaining complex concepts</strong>, but all design decisions, implementation work, and debugging were done manually.</p><h3>📦 Source Code</h3><p>GitHub Repository: <em>[</em><a href="https://github.com/GauravKesh/cpp-multithreaded-tcp-server"><em>Source_code</em></a><em>]</em></p><h3>🧠 Final Thoughts</h3><p>Learning backend engineering from scratch rather than relying on frameworks completely shifted how I think about systems design, performance, and distributed architectures.</p><p>If you want to improve as a backend engineer, I highly recommend trying this challenge.</p><blockquote><strong>Don’t just use tools. Build the tools first.<em><br> It changes everything.</em></strong></blockquote><p><strong><em>I’m currently in my 3rd year of engineering and exploring systems programming deeply. If you find anything incorrect, please feel free to correct me cause I’m still learning 😁.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e558fc980a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ How I Stopped Manually Testing APIs and Let Keploy Do the Work]]></title>
            <link>https://medium.com/@gkrcoder/how-i-stopped-manually-testing-apis-and-let-keploy-do-the-work-ed2f5799b389?source=rss-754f57240258------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed2f5799b389</guid>
            <category><![CDATA[keploy]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[workflow-automation]]></category>
            <category><![CDATA[api-automation]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Gaurav Kesh Roushan]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 22:39:31 GMT</pubDate>
            <atom:updated>2025-06-27T22:43:36.179Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>By Gaurav Kesh Roushan</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ij8SrGpSnG7ML5MOKV6EYQ.png" /></figure><p><strong>👋 Before Keploy: Just Me and Postman</strong></p><blockquote>Like most full-stack developers, I’ve always relied on <strong>Postman</strong> for testing my APIs. It was simple:<br>- Write the route <br>- Hit it with Postman <br>- Manually verify the response</blockquote><p>But over time, this approach started feeling slow, repetitive, and error-prone. Every new change meant re-checking everything manually. It wasn’t scalable and I knew I needed something better.</p><p>— -</p><p><strong>Discovering Keploy — AI-Powered API Testing</strong></p><p>That’s when I came across <a href="https://keploy.io/"><strong>Keploy</strong></a> a tool that records your API traffic and automatically generates test cases using AI. <br>No need to write tests from scratch. Just:</p><p>keploy record -c “npm run dev”<br>Then, use your API like normal (via curl, frontend, or Postman). Keploy watches your traffic, captures requests and responses, and converts them into test cases. Later, you can replay them with:</p><p>keploy test -c “npm run dev”<br>This made me rethink my entire testing process. It felt like adding a QA layer to my dev flow — without writing a single test manually.</p><p><strong>Learning to Track APIs with Keploy Chrome Extension</strong><br>Keploy also provides a Chrome Extension that tracks API calls directly from your browser. I tested it on sites like Swiggy and Reqres — and it auto-captured GET and POST calls as I interacted with the UI.</p><p>Instead of checking the Network tab in DevTools manually, the extension helped me:</p><p>Track all outbound requests</p><p>Inspect headers, payloads, and responses</p><p>Export them as tests or curl commands</p><p>Again, this felt like magic.</p><p><strong>🔧 First Time with CI/CD and GitHub Workflows</strong><br>While setting up Keploy, I also dived into CI/CD pipelines for the first time using GitHub Actions. I learned how to:</p><p>Define jobs using .yml files</p><p>Set up environment variables and secrets</p><p>Chain multiple steps like checkout, setup, install, and test</p><p>Trigger workflows on every push or PR</p><p>Here’s the actual workflow I created to run my Keploy Cloud Test Suite:</p><p>yaml<br>name: Keploy CIs</p><p>on: [push, pull_request]</p><p>jobs:<br> keploy-test:<br> runs-on: ubuntu-latest</p><p>steps:<br> — name: Checkout Code<br> uses: actions/checkout@v2</p><p>- name: Setup Node.js<br> uses: actions/setup-node@v3<br> with:<br> node-version: ‘18’</p><p>- name: Install Dependencies<br> run: npm install</p><p>- name: Install Keploy CLI<br> run: |<br> curl — silent -L <a href="https://keploy.io/ent/install.sh">https://keploy.io/ent/install.sh</a> | bash</p><p>- name: Run Keploy Cloud Test Suite<br> env:<br> KEPLOY_API_KEY: ${{ secrets.KEPLOY_API_KEY }}<br> run: |<br> keploy test-suite \<br> — app=f8c25530-e030–4b58–9577-e3a1f692d152 \<br> — base-path=<a href="https://keploy-backend.onrender.com/api/posts">https://keploy-backend.onrender.com/api/posts</a> \<br> — cloud</p><p><strong>CI Run Log</strong>: <a href="https://github.com/GauravKesh/keploy-backend/actions/runs/15936992752/job/44958827482">Click here to view</a><br><strong> Repo</strong>: <a href="https://github.com/GauravKesh/keploy-backend">Here</a></p><p><strong>📘 Bonus: Learning Swagger to Auto-Generate API Docs</strong><br>One more thing I learned in this journey: how to use Swagger to auto-generate API schema and documentation. Instead of manually describing endpoints, I now use swagger-jsdoc in my Express project.</p><p>Now I have:</p><p>A live /api-docs page with all routes and request bodies</p><p>An OpenAPI schema for tools like Keploy and testing frameworks</p><p>This saved me hours — and made the API more usable for others.</p><p><strong>🧠 What I Walked Away With</strong><br>✅ First real experience with automated API testing</p><p>✅ Set up my first CI/CD pipeline on GitHub</p><p>✅ Learned about DevOps workflows, .yml jobs, secrets, and runners</p><p>✅ Used Keploy CLI and Chrome Extension for smarter API tracking</p><p>✅ Understood the power of Swagger/OpenAPI for documentation and testing</p><p><strong>🔚 Final Thoughts</strong><br>Keploy didn’t just help me test APIs it made me a better developer.<br>From Chrome to CLI, from Postman to pipelines this was one of the most productive and educational dev weeks I’ve had.</p><p>If you’re still testing APIs manually like I was, I highly recommend giving Keploy a try.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed2f5799b389" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>