<?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 Madhusudan K S on Medium]]></title>
        <description><![CDATA[Stories by Madhusudan K S on Medium]]></description>
        <link>https://medium.com/@madhusudan.ks?source=rss-1fb694cc864a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SDjQj_i2SPv3XPeM</url>
            <title>Stories by Madhusudan K S on Medium</title>
            <link>https://medium.com/@madhusudan.ks?source=rss-1fb694cc864a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 04:31:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@madhusudan.ks/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[Plan First, Code Later: System Architecture with AI]]></title>
            <link>https://medium.com/@madhusudan.ks/plan-first-code-later-system-architecture-with-ai-9a608b9ee60d?source=rss-1fb694cc864a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a608b9ee60d</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Madhusudan K S]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 18:19:38 GMT</pubDate>
            <atom:updated>2026-06-02T18:26:31.188Z</atom:updated>
            <content:encoded><![CDATA[<p>Blueprint your logic. Let AI handle the boilerplate.</p><figure><img alt="Sample Blueprint to follow during ai assisted development." src="https://cdn-images-1.medium.com/max/1024/1*BV9bByTDNlP-WoL_C9fU5g.png" /><figcaption>Sample Blueprint</figcaption></figure><p>System architecture design is your foundational blueprint. It defines system structure and behavior. Design this early to avoid getting stuck. Without it, you will fail mid-project.</p><p>Don’t let AI write your whole app without user control. You will get stuck halfway through. Design your system architecture early instead.</p><blockquote><strong>1. Define Core Components Layers: <br>“</strong><em>Divide your complex system into logical layers”</em></blockquote><ul><li>Client Layer: The user interface that sends requests.</li><li>API Gateway: Routes incoming traffic and handles logins.</li><li>Applicazion Layer: Processes your core business logic.</li><li>Data Layer: Stores databases and caching systems.</li></ul><blockquote><strong>2. Choose Architectural Patterns:<br>“</strong>Pick an architectural pattern for your PRD.”</blockquote><ul><li>Monolithic: One shared codebase and single server.</li><li>Microservices: Small, independent services for high scalability.</li><li>Event-Driven: Real-time processing using asynchronous events.</li><li>Serverless: Cloud providers manage your server maintenance.</li></ul><blockquote><strong>3. Key Design Goals</strong><br>“Balance these traits in your early design.”</blockquote><ul><li>Scalability: Handling more load with added resources.</li><li>Fault Tolerance: Staying online despite hardware failures.</li><li>Security: Protecting data with firewalls and encryption.</li><li>Maintainability: Making updates without breaking the entire system.</li></ul><blockquote><strong>4. Phase-Wise Implementation</strong><br>“Break your project into small Micro-PRDs.”</blockquote><p>Use phase-wise implementation strategies to maintain control. Each single phase has two strict steps.</p><ul><li>Step 1: TDD (Test Case). Ask AI to write the test cases first. These tests will fail initially.</li><li>Step 2: Actual Implementation. Ask AI to write code passing those tests.</li></ul><p>Approve each phase from the PRD before moving forward.</p><p><strong>Conclusion:</strong></p><p>Ultimately, AI is a powerful execution engine, but it is not an architect. If you want to build scalable, production-ready systems, you must own the blueprint. By establishing strict components, choosing the right patterns, and rigorously validating every micro-phase through TDD, you transform AI from an unpredictable generator into a highly efficient development partner. Plan the system, enforce the boundaries, and let the AI do the typing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a608b9ee60d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proxy vs Reverse Proxy vs Load Balancer vs API Gateway]]></title>
            <link>https://medium.com/@madhusudan.ks/proxy-vs-reverse-proxy-vs-load-balancer-vs-api-gateway-8075a6ae4a9d?source=rss-1fb694cc864a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8075a6ae4a9d</guid>
            <dc:creator><![CDATA[Madhusudan K S]]></dc:creator>
            <pubDate>Tue, 16 Dec 2025 17:23:50 GMT</pubDate>
            <atom:updated>2025-12-16T17:23:50.245Z</atom:updated>
            <content:encoded><![CDATA[<p>Explained Simply (With Real-World Examples)</p><p>As systems grow from a single server to <strong>microservices and cloud-native architectures</strong>, terms like <em>Proxy</em>, <em>Reverse Proxy</em>, <em>Load Balancer</em>, and <em>API Gateway</em> are used everywhere — often interchangeably.</p><p>They are <strong>not the same</strong>.</p><p>Let’s break them down <strong>step by step</strong>, in the <strong>simplest way possible</strong>, and then connect them to <strong>real system design</strong>.</p><h3>1. What is a Proxy?</h3><p>Simple meaning: A <strong>proxy</strong> sits between a <strong>client</strong> and the <strong>internet</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PGbhjdhv0NiEoJHBKY_tHw.png" /><figcaption>Proxy</figcaption></figure><p>The <strong>server does NOT know</strong> who the real client is.</p><h3>Why use a Proxy?</h3><ul><li>Hide client identity (privacy)</li><li>Bypass restrictions</li><li>Cache responses</li><li>Control internet usage</li></ul><h3>Real-world analogy</h3><p>Think of a <strong>middleman</strong> who goes to the market on your behalf so no one knows <em>you</em> bought the item.</p><h3>Common examples</h3><ul><li>Corporate internet proxy</li><li>VPN</li><li>Browser proxy</li></ul><h3>Key point</h3><blockquote><strong>Proxy protects the client</strong></blockquote><h3>2. What is a Reverse Proxy?</h3><p>Simple meaning: A <strong>reverse proxy</strong> sits in front of <strong>servers</strong> and handles client requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PaewdfU3WBpq49MtQ7RtuA.png" /><figcaption>Reverse Proxy</figcaption></figure><p>Here, the <strong>client does NOT know</strong> which server actually processed the request.</p><h3>Why use a Reverse Proxy?</h3><ul><li>Hide backend servers</li><li>Improve security</li><li>Cache responses</li><li>SSL termination (HTTPS handling)</li></ul><h3>Real-world analogy</h3><p>You order food via <strong>Swiggy/Zomato</strong>.<br> You don’t know which restaurant staff prepared it — the platform handles everything.</p><h3>Popular tools</h3><ul><li>NGINX</li><li>Apache</li><li>Cloudflare</li></ul><h3>Key point</h3><blockquote>Reverse Proxy protects the server</blockquote><h3>3. What is a Load Balancer?</h3><p>Simple meaning: A <strong>load balancer</strong> distributes traffic across <strong>multiple servers</strong> to avoid overload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6eYzDOamOt8FKlbukyhvQ.png" /><figcaption>Load Balancer</figcaption></figure><h3>Why use a Load Balancer?</h3><ul><li>High availability</li><li>Scalability</li><li>Prevent server crashes</li><li>Faster response time</li></ul><h3>Load balancing strategies</h3><ul><li>Round Robin</li><li>Least Connections</li><li>IP Hash</li></ul><h3>Real-world analogy</h3><p>At a bank, customers are sent to the <strong>next available counter</strong> instead of crowding one.</p><h3>Common load balancers</h3><ul><li>AWS ALB / NLB</li><li>NGINX</li><li>HAProxy</li></ul><h3>Key point</h3><blockquote>Load Balancer ensures scalability and availability</blockquote><h3>4. What is an API Gateway?</h3><p>Simple meaning: An <strong>API Gateway</strong> is a <strong>single entry point</strong> for <strong>all backend services</strong>, especially in <strong>microservices architecture</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ki4TatoxJXiTLGSeknj5oA.png" /><figcaption>API Gateway</figcaption></figure><h3>What makes API Gateway special?</h3><p>It does <strong>much more</strong> than a reverse proxy.</p><h3>Key responsibilities</h3><ul><li>Authentication &amp; Authorization</li><li>Rate limiting</li><li>Request validation</li><li>API versioning</li><li>Routing to microservices</li><li>Monitoring &amp; logging</li></ul><h3>Real-world analogy</h3><p>An <strong>airport security gate</strong>:</p><ul><li>Verifies identity</li><li>Controls access</li><li>Routes passengers to correct terminal</li></ul><h3>Popular API Gateways</h3><ul><li>AWS API Gateway</li><li>Spring Cloud Gateway</li><li>Kong</li><li>Apigee</li></ul><h3>Key point</h3><blockquote>API Gateway manages APIs, not just traffic</blockquote><h3>Side-by-Side Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JEhT_jqkjJ9h9REsXwFJuw.png" /><figcaption>Side-by-Side Comparison</figcaption></figure><h3>How They Work Together (Real Architecture)</h3><p>In a modern backend system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zPxeCD8pToF-bsbmv38Ppw.png" /><figcaption>ALL-In-One-Flow</figcaption></figure><h3>Example (E-commerce App)</h3><ul><li><strong>API Gateway</strong> → Auth, rate limit, route APIs</li><li><strong>Load Balancer</strong> → Distribute traffic</li><li><strong>Reverse Proxy</strong> → Secure backend servers</li></ul><p>Each layer has a <strong>clear responsibility</strong>.</p><h3>Final Takeaway</h3><ul><li><strong>Proxy</strong> → Client-focused</li><li><strong>Reverse Proxy</strong> → Server-focused</li><li><strong>Load Balancer</strong> → Scale traffic</li><li><strong>API Gateway</strong> → Control APIs</li></ul><p><em>Understanding where and why each fits is key to good system design.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8075a6ae4a9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Stop Storing JWTs in localStorage: Use HttpOnly Cookies for Secure Authentication (Spring Boot…]]></title>
            <link>https://medium.com/@madhusudan.ks/stop-storing-jwts-in-localstorage-use-httponly-cookies-for-secure-authentication-spring-boot-779a3445228a?source=rss-1fb694cc864a------2</link>
            <guid isPermaLink="false">https://medium.com/p/779a3445228a</guid>
            <dc:creator><![CDATA[Madhusudan K S]]></dc:creator>
            <pubDate>Sat, 23 Aug 2025 17:23:30 GMT</pubDate>
            <atom:updated>2025-08-23T17:23:30.064Z</atom:updated>
            <content:encoded><![CDATA[<h3>🔐 Stop Storing JWTs in localStorage: Use HttpOnly Cookies for Secure Authentication (Spring Boot + React)</h3><p>Most tutorials tell you to store JWT tokens in <strong>localStorage</strong> or <strong>sessionStorage</strong>. But here’s the problem: if your app ever has an <strong>XSS vulnerability</strong>, attackers can easily steal those tokens and hijack accounts.</p><p>👉 The solution?<br> <strong>HttpOnly cookies.</strong> They’re invisible to JavaScript, automatically sent with requests, and secure by default when configured properly.</p><p>In this article, we’ll implement <strong>JWT authentication using HttpOnly cookies</strong> with <strong>Spring Boot</strong> (backend) and <strong>React</strong> (frontend).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rt2tptenuD1di_-QXfKALw.png" /></figure><p><strong>JWT Auth Flow with HttpOnly Cookies</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*B8fTEvgN9LJdqMRnzXgvqw.png" /></figure><p><strong>Backend: Spring Boot Example</strong></p><pre>@PostMapping(&quot;/login&quot;)<br>public ResponseEntity&lt;?&gt; login(@Valid @RequestBody LoginRequest req, HttpServletResponse response) {<br>    // validate user...<br>    String accessToken = jwtService.generateAccessToken(...);<br>    String refreshToken = jwtService.generateRefreshToken(...);<br><br>    Cookie accessCookie = new Cookie(&quot;auth_token&quot;, accessToken);<br>    accessCookie.setHttpOnly(true);<br>    accessCookie.setSecure(true); // HTTPS only<br>    accessCookie.setPath(&quot;/&quot;);<br>    accessCookie.setMaxAge(15 * 60); // 15 min<br>    response.addCookie(accessCookie);<br><br>    Cookie refreshCookie = new Cookie(&quot;refresh_token&quot;, refreshToken);<br>    refreshCookie.setHttpOnly(true);<br>    refreshCookie.setSecure(true);<br>    refreshCookie.setPath(&quot;/&quot;);<br>    refreshCookie.setMaxAge(7 * 24 * 60 * 60); // 7 days<br>    response.addCookie(refreshCookie);<br><br>    return ResponseEntity.ok(new ApiResponse&lt;&gt;(&quot;Login successful&quot;, null, 200));<br>}</pre><p><strong>Frontend: React + Axios Setup</strong></p><pre>import axios from &quot;axios&quot;;<br><br>const API = axios.create({<br>  baseURL: &quot;https://api.example.com&quot;,<br>  withCredentials: true, // crucial for cookies<br>});<br><br>// Example: login<br>export const login = (email: string, password: string, captcha: string) =&gt;<br>  API.post(&quot;/auth/login&quot;, { email, password, captcha });</pre><p>You don’t manually handle JWTs in React. The browser sends them automatically via cookies.</p><p><strong>Important Note:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2t-ziI_X9u_eruUrds6x8A.png" /></figure><p>If your application uses a <strong>separate login service</strong> hosted on a completely different domain, JWT + HttpOnly Cookies will <strong>not work across domains</strong>. This is because browsers restrict cookies to the domain (and its subdomains) where they are issued.<br> To make it work, both the login application and the consuming applications must share the <strong>same parent domain</strong> (e.g., auth.example.com and app.example.com). Subdomains are supported, but entirely different domains (e.g., auth.com and app.net) will not share cookies.</p><p><strong>Refresh Token Flow</strong></p><ul><li><strong>Access token</strong>: short-lived (15 min)</li><li><strong>Refresh token</strong>: long-lived (7 days)</li></ul><p>When the access token expires:</p><ol><li>Client calls /auth/refresh.</li><li>Server validates refresh_token.</li><li>Server issues a new auth_token cookie.</li></ol><p><strong>Security Best Practices</strong></p><p>✔Always use <strong>HTTPS</strong> in production (Secure flag).<br>✔Use <strong>SameSite=Strict</strong> (or Lax if you allow external redirects).<br>✔Rotate refresh tokens on each use.<br>✔Clear cookies on logout:</p><pre>Cookie cookie = new Cookie(&quot;auth_token&quot;, null);<br>cookie.setMaxAge(0);<br>cookie.setPath(&quot;/&quot;);<br>response.addCookie(cookie);</pre><p>❌<strong> Common Pitfalls</strong></p><ul><li>Setting cookie domain incorrectly (.example.com vs api.example.com).</li><li>Forgetting withCredentials: true in Axios.</li><li>Using HttpOnly cookies but not implementing CSRF protection.</li></ul><p><strong>🛡️ Why HttpOnly Cookies?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FaNNWgAJjmV0r5DqEKJkwA.png" /></figure><p>✅ <strong>Conclusion</strong></p><p>JWT authentication is great for stateless apps — but only if stored securely.<br> Stop relying on localStorage and switch to <strong>HttpOnly cookies</strong>.</p><p>👉 Safer from XSS<br>👉 Cleaner client code<br>👉 Production-ready</p><p>If you’re building SPAs with React, Angular, or Vue, <strong>this is the approach you should adopt today.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=779a3445228a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Prompting for Developers]]></title>
            <link>https://medium.com/@madhusudan.ks/ai-prompting-for-developers-848634a5c1b6?source=rss-1fb694cc864a------2</link>
            <guid isPermaLink="false">https://medium.com/p/848634a5c1b6</guid>
            <dc:creator><![CDATA[Madhusudan K S]]></dc:creator>
            <pubDate>Mon, 05 May 2025 16:11:11 GMT</pubDate>
            <atom:updated>2025-05-06T01:09:22.684Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Mastering the Art of Asking Better Questions to Code Smarter</strong></h4><p>Whether you’re debugging Java, designing REST APIs in Spring Boot, or building a front-end with React, AI prompting can become your daily coding sidekick : if you know how to prompt it right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyfQE2xrTnb1C2YChBsbQw.jpeg" /><figcaption><strong>Prompting AI: Say It Right, Get It Right</strong></figcaption></figure><h4><strong>Why Prompting Matters</strong></h4><p>AI tools don’t work like Google. You don’t search; you instruct. Think of them as interns who:<br>- Code exactly what you ask (even your bad habits)<br>- Can brainstorm, refactor, explain, and test code<br>- Need context to do a good job<br>- Prompting well is a developer skill now.</p><h4><strong>Follow CIA model prompting strategy</strong></h4><p>The CIA Model in Prompting is a simple but effective framework for crafting AI prompts that yield clear and useful responses. It stands for:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*pPZYWgPFc8nbWA4OFP0EfQ.png" /><figcaption><strong>CIA Model</strong></figcaption></figure><ol><li><strong>C — Context<br>Prompt : </strong><em>“I’m working on a React app that uses Material UI for components and a separate CSS file for styling. I need a profile card that shows a user’s photo, name, and role.”</em></li><li><strong>I — Instruction</strong><br><strong>Prompt : </strong><em>“Create a functional </em><em>ProfileCard component using Material UI&#39;s </em><em>Card, </em><em>Avatar, and </em><em>Typography components, but apply custom styles from a separate CSS file.&quot;</em></li><li><strong>A — Answer Format<br>Prompt : </strong><em>“Return the React component code, the CSS file content, and provide instructions on how use this component.”</em></li></ol><p><strong>Full Prompt Using CIA</strong>:<br>To get better responses from AI, combine the three CIA sections — Context, Instruction, and Answer Format — into a single, clear prompt.<strong> </strong>This helps the model understand what you’re doing, what you want, and how you want it returned.</p><p>This model helps <strong>reduce ambiguity</strong>, especially in technical or creative tasks. It’s particularly helpful when:</p><ul><li>Prompting for <strong>code generation</strong></li><li>Asking for <strong>structured data</strong></li><li>Requesting <strong>multi-step</strong> outputs</li></ul><h4><strong>Prompting Patterns That Work</strong></h4><ol><li><strong>Code Generation:<br></strong>Goal: Build components, services, or full modules<br><strong>Prompt: </strong><em>“Create a </em><em>LoginForm React component using Material UI with email/password inputs and validation.”<br> </em><strong><em>Tip:</em></strong><em> Add constraints like framework version, syntax (e.g., TypeScript), or best practices.</em></li><li><strong>Debugging</strong><br>Goal: Find and fix issues quickly<br><strong>Prompt: </strong><em>“I’m getting ‘maximum update depth exceeded’ in my React code. Here’s the snippet. What causes it and how can I fix it?”<br> </em><strong><em>Tip:</em></strong><em> Share actual code + error messages. Be direct.</em></li><li><strong>Testing<br></strong>Goal: Generate unit/integration tests<br><strong>Prompt: </strong><em>“Write JUnit 5 tests for </em><em>public int divide(int a, int b) covering edge cases.”<br> </em><strong><em>Tip:</em></strong><em> Specify the framework and whether to mock dependencies.</em></li><li><strong>Refactoring<br></strong>Goal: Improve readability, performance, or idiomatic use<br><strong>Prompt: </strong><em>“Refactor this Java loop to use Java 17 streams.”<br> </em><strong><em>Tip:</em></strong><em> Tell the AI your intent: readability? speed? functional style?</em></li><li><strong>API Design</strong><br>Goal: Auto-generate comments or user-facing docs<br><strong>Prompt: “</strong><em>Generate JSDoc comments for this JavaScript function.”<br> </em><strong><em>Tip:</em></strong><em> Request summaries, parameter descriptions, and examples.</em></li><li><strong>Vibe Coding <br></strong>“Programming by vibes” = exploring ideas via open-ended prompts.<br>Goal: Brainstorm, prototype, and creatively build<br><strong>Prompt: </strong><em>“What are 5 cool React components I can use for a fitness dashboard?”<br> </em><strong><em>Tip:</em></strong><em> Let AI suggest ideas first, then zoom in on details.<br></em>I personally use this when I’m blocked, or just want to build in flow. No pressure — just co-creation with a very patient dev buddy.</li></ol><h4><strong>Real-World Prompting: My Workflow</strong></h4><p>Here’s how I usually approach a task using AI:</p><ol><li><strong>Start Wide</strong>: “How would you build a secure login flow in Spring Boot?”</li><li><strong>Zoom In</strong>: “Show me a JWT token-based authentication filter for Spring WebFlux.”</li><li><strong>Ask for Explanation</strong>: “What does this SecurityWebFilterChain config actually do?”</li><li><strong>Refine</strong>: “Now add MongoDB integration using Reactive Repositories.”<br>This prompt → build → refine → repeat cycle has saved me <strong>hours per week</strong>.</li></ol><h4><strong>Ten Prompting Tips That Actually Work</strong></h4><figure><img alt="Visual representation of the “10 Prompting Tips That Actually Work”" src="https://cdn-images-1.medium.com/max/548/1*OZP5mmRGq4bl5TEuQ5zysA.png" /></figure><h4><strong>Tools That Work Great with Prompting</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*9fJFeXAICjGr3CzHSpvKsw.png" /></figure><h4><strong>Final Thoughts</strong></h4><p>You don’t need to “prompt like a prompt engineer.” You just need to <strong>treat the AI like a helpful teammate</strong> — give context, be clear, and collaborate iteratively.<br>If you want to code faster, learn quicker, or even brainstorm new side projects, prompting is a <strong>superpower worth mastering.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=848634a5c1b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>