<?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 Vaidikthakkar on Medium]]></title>
        <description><![CDATA[Stories by Vaidikthakkar on Medium]]></description>
        <link>https://medium.com/@vaidikthakkar5?source=rss-3df29d5fdcb9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ynOXo9apLNGHdHmI</url>
            <title>Stories by Vaidikthakkar on Medium</title>
            <link>https://medium.com/@vaidikthakkar5?source=rss-3df29d5fdcb9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 09:05:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vaidikthakkar5/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 to Deploy a React App on IIS Server in 2026 — Complete Step-by-Step Guide]]></title>
            <link>https://medium.com/@vaidikthakkar5/how-to-deploy-a-react-app-on-iis-server-in-2026-complete-step-by-step-guide-51a953eb172a?source=rss-3df29d5fdcb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/51a953eb172a</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[ii]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[windows-server]]></category>
            <category><![CDATA[servers]]></category>
            <dc:creator><![CDATA[Vaidikthakkar]]></dc:creator>
            <pubDate>Sun, 21 Jun 2026 10:50:47 GMT</pubDate>
            <atom:updated>2026-06-21T10:50:47.667Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SQOvQMpepO0v9uPG" /><figcaption>Photo by <a href="https://unsplash.com/@lautaroandreani?utm_source=medium&amp;utm_medium=referral">Lautaro Andreani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Deploy your React (Vite or Create React App) project on your own Windows machine or server using IIS — without depending on Vercel, Netlify, or any third-party service.</p><p><strong>If you own a Windows system or a Windows Server</strong> and still don’t know how to deploy your React app on your own server without relying on other services, here’s exactly how you can achieve that.</p><p>Many developers working in corporate environments or on personal Windows machines prefer hosting their React apps on <strong>IIS (Internet Information Services)</strong> because it’s free, secure, and gives full control.</p><p>In this guide, I’ll walk you through the complete process — from building your app to fixing the common 404 routing issues.</p><h3>Prerequisites</h3><ul><li>Windows 10 / 11 or Windows Server</li><li>Node.js installed</li><li>A built React project (Vite or Create React App)</li><li>Administrator access</li></ul><h3>Step 1: Build Your React App for Production</h3><p><strong>For Vite projects:</strong></p><p>Bash</p><pre>npm run build</pre><p>→ Creates a dist folder</p><p><strong>For Create React App:</strong></p><p>Bash</p><pre>npm run build</pre><p>→ Creates a build folder</p><blockquote><strong><em>Pro Tip:</em></strong><em> If you’re deploying in a subfolder (e.g. yourdomain.com/myapp), update the base path in your config before building.</em></blockquote><h3>Step 2: Enable IIS on Windows</h3><ol><li>Go to <strong>Control Panel</strong> → <strong>Programs</strong> → <strong>Turn Windows features on or off</strong></li><li>Check <strong>Internet Information Services</strong></li><li>Expand and enable necessary features (especially <strong>World Wide Web Services</strong>)</li><li>Click OK and restart your computer if required.</li></ol><h3>Step 3: Install URL Rewrite Module</h3><p>This is <strong>critical</strong> for React Router to work properly.</p><ul><li>Download and install from: <a href="https://www.iis.net/downloads/microsoft/url-rewrite">IIS URL Rewrite</a></li><li>Restart IIS after installation.</li></ul><h3>Step 4: Create Website in IIS Manager</h3><ol><li>Open <strong>IIS Manager</strong> (inetmgr)</li><li>Right-click on <strong>Sites</strong> → <strong>Add Website</strong></li><li>Configure:</li></ol><ul><li>Site name: MyReactApp</li><li>Physical path: Path to your dist or build folder</li><li>Port: 80 (or any available port like 8080)</li></ul><ol><li>Click OK.</li></ol><h3>Step 5: Fix Client-Side Routing (Most Important)</h3><p>Create a <strong>web.config</strong> file in the root of your dist/build folder:</p><p>XML</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;configuration&gt;<br>  &lt;system.webServer&gt;<br>    &lt;rewrite&gt;<br>      &lt;rules&gt;<br>        &lt;rule name=&quot;React Router&quot; stopProcessing=&quot;true&quot;&gt;<br>          &lt;match url=&quot;.*&quot; /&gt;<br>          &lt;conditions logicalGrouping=&quot;MatchAll&quot;&gt;<br>            &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; negate=&quot;true&quot; /&gt;<br>            &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsDirectory&quot; negate=&quot;true&quot; /&gt;<br>          &lt;/conditions&gt;<br>          &lt;action type=&quot;Rewrite&quot; url=&quot;index.html&quot; /&gt;<br>        &lt;/rule&gt;<br>      &lt;/rules&gt;<br>    &lt;/rewrite&gt;</pre><pre>    &lt;staticContent&gt;<br>      &lt;mimeMap fileExtension=&quot;.json&quot; mimeType=&quot;application/json&quot; /&gt;<br>      &lt;mimeMap fileExtension=&quot;.wasm&quot; mimeType=&quot;application/wasm&quot; /&gt;<br>    &lt;/staticContent&gt;<br>  &lt;/system.webServer&gt;<br>&lt;/configuration&gt;</pre><h3>Step 6: Set Default Document</h3><p>In IIS Manager → Select your site → <strong>Default Document</strong> → Move index.html to the top.</p><h3>Common Issues &amp; Fixes</h3><p>ProblemFix404 on refresh / direct URLAdd web.config with URL RewriteBlank screenCheck base path &amp; console errorsCSS/JS not loadingVerify paths and MIME typesSubfolder deploymentSet base / homepage correctly</p><h3>Bonus Tips</h3><ul><li>Enable <strong>gzip compression</strong> in IIS for better performance</li><li>Set up <strong>HTTPS</strong> using Let’s Encrypt or your domain provider</li><li>For updates: Build new version → Replace files (or use folder switching for zero downtime)</li></ul><h3>Conclusion</h3><p>You no longer need to depend on third-party platforms. With IIS, you have full control over your React deployment on your own Windows system or server.</p><p>This method is especially useful for enterprise environments, internal tools, or anyone who prefers self-hosting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51a953eb172a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Query vs useEffect: Stop Misusing Them in 2026 (They’re Not the Same Thing)]]></title>
            <link>https://medium.com/@vaidikthakkar5/react-query-vs-useeffect-stop-misusing-them-in-2026-theyre-not-the-same-thing-fa2ce6864d10?source=rss-3df29d5fdcb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa2ce6864d10</guid>
            <category><![CDATA[react-usestate]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react-useeffect]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[react-query]]></category>
            <dc:creator><![CDATA[Vaidikthakkar]]></dc:creator>
            <pubDate>Sun, 17 May 2026 09:28:15 GMT</pubDate>
            <atom:updated>2026-05-17T09:28:15.742Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>React Query vs useEffect: Stop Misusing Them in 2026 (They’re Not the Same Thing)</blockquote><blockquote>Many influencers say “Just use React Query instead of useEffect” — but that’s misleading. Here’s when to use each one properly.</blockquote><p>If you’re a React developer, you’ve probably seen this advice on Twitter, YouTube, or TikTok: <strong>“Don’t use useEffect for data fetching — just use React Query.”</strong></p><p>This sounds simple… until you realize it’s <strong>half-true</strong> and often misleads new developers.</p><p><strong>React Query (now called TanStack Query) is NOT a direct replacement for useEffect.</strong> They solve <strong>different problems</strong>, even though they sometimes overlap in data fetching.</p><p>Let’s clear the confusion once and for all.</p><h4>What useEffect Actually Does</h4><p>useEffect is a <strong>general-purpose side-effect hook</strong>. It runs after render and is perfect for anything that needs to happen outside React’s normal flow.</p><p>Common use cases:</p><ul><li>Fetching data (manual way)</li><li>Adding event listeners (resize, scroll, keydown)</li><li>Timers (setTimeout / setInterval)</li><li>Manual DOM manipulations</li><li>Syncing with localStorage, WebSockets, or third-party libraries</li><li>Running analytics or logging on state change</li></ul><p>It gives you full control — but you have to handle <strong>everything</strong> yourself.</p><h4>What React Query (TanStack Query) Actually Does</h4><p>React Query is a <strong>powerful server-state management library</strong>. It’s specifically built for handling data that comes from a server (API calls).</p><p>It automatically gives you:</p><ul><li>Caching</li><li>Background refetching</li><li>Automatic retries on failure</li><li>Loading &amp; error states</li><li>Deduplication (no duplicate requests)</li><li>Data synchronization across components</li><li>Easy mutations with automatic cache updates</li></ul><h4>The Key Difference</h4><ul><li><strong>useEffect</strong> = Low-level tool → You build the entire data-fetching logic yourself.</li><li><strong>React Query</strong> = High-level tool → It handles all the complex server-state logic for you.</li></ul><p><strong>React Query replaces only one common use case of useEffect: data fetching from a server.</strong> It does <strong>not</strong> replace useEffect entirely.</p><h4>When You Should Use React Query (Instead of useEffect)</h4><p>Use React Query when:</p><ul><li>You’re fetching, updating, or syncing <strong>server data</strong> (GET, POST, PUT, DELETE)</li><li>You have multiple components that need the same data</li><li>You want caching, background updates, or retries</li><li>You’re building a medium-to-large production app</li></ul><p><strong>Example with useEffect + useState (Manual Approach):</strong></p><pre>import { useState } from &#39;react&#39;;<br><br>function AddPost() {<br>  const [title, setTitle] = useState(&#39;&#39;);<br>  const [loading, setLoading] = useState(false);<br><br>  const handleSubmit = async () =&gt; {<br>    setLoading(true);<br>    try {<br>      await fetch(&#39;https://jsonplaceholder.typicode.com/posts&#39;, {<br>        method: &#39;POST&#39;,<br>        body: JSON.stringify({ title }),<br>        headers: { &#39;Content-Type&#39;: &#39;application/json&#39; },<br>      });<br>      <br>      alert(&#39;Post added successfully!&#39;);<br>      setTitle(&#39;&#39;);<br>    } catch (err) {<br>      console.error(&#39;Failed to add post:&#39;, err);<br>    } finally {<br>      setLoading(false);<br>    }<br>  };<br><br>  return (<br>    &lt;div&gt;<br>      &lt;input <br>        value={title} <br>        onChange={(e) =&gt; setTitle(e.target.value)} <br>        placeholder=&quot;Post title&quot; <br>      /&gt;<br>      &lt;button onClick={handleSubmit} disabled={loading}&gt;<br>        {loading ? &#39;Adding Post...&#39; : &#39;Add Post&#39;}<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}<br></pre><p><strong>Problems with this approach:</strong></p><ul><li>Manual loading state management</li><li>No automatic cache invalidation</li><li>You must manually refetch the posts list after success</li><li>Weak error handling</li><li>No retry logic</li><li>Code becomes messy as your app grows</li></ul><p><strong>2. Using React Query — useMutation (Recommended)</strong></p><pre>import { useMutation, useQueryClient } from &#39;@tanstack/react-query&#39;;<br><br>function AddPost() {<br>  const queryClient = useQueryClient();<br><br>  const mutation = useMutation({<br>    mutationFn: async (newPost) =&gt; {<br>      const res = await fetch(&#39;https://jsonplaceholder.typicode.com/posts&#39;, {<br>        method: &#39;POST&#39;,<br>        body: JSON.stringify(newPost),<br>        headers: { &#39;Content-Type&#39;: &#39;application/json&#39; },<br>      });<br>      if (!res.ok) throw new Error(&#39;Failed to create post&#39;);<br>      return res.json();<br>    },<br>    onSuccess: () =&gt; {<br>      // 🔥 Automatically refresh the posts list<br>      queryClient.invalidateQueries({ queryKey: [&#39;posts&#39;] });<br>    },<br>  });<br><br>  return (<br>    &lt;div&gt;<br>      &lt;button<br>        onClick={() =&gt; mutation.mutate({ title: &#39;New Awesome Post&#39; })}<br>        disabled={mutation.isPending}<br>      &gt;<br>        {mutation.isPending ? &#39;Adding Post...&#39; : &#39;Add Post&#39;}<br>      &lt;/button&gt;<br><br>      {mutation.isError &amp;&amp; &lt;p style={{color: &#39;red&#39;}}&gt;Error: {mutation.error.message}&lt;/p&gt;}<br>    &lt;/div&gt;<br>  );<br>}</pre><p>React Query handles loading states, errors, caching, and more — automatically.</p><h4>When You Should Still Use useEffect (React Query Cannot Help Here)</h4><p>You <strong>must</strong> use useEffect for:</p><ul><li>Browser/DOM events (addEventListener for resize, scroll, etc.)</li><li>Timers (setInterval, setTimeout)</li><li>Syncing with localStorage or browser APIs</li><li>Manual DOM changes (focus, measuring elements)</li><li>Integrating third-party libraries (charts, maps, animations)</li><li>Any side effect that is <strong>not</strong> related to server data</li></ul><p><strong>Real examples where useEffect wins:</strong></p><ul><li>Tracking window resize</li><li>Auto-focusing an input</li><li>Saving theme preference to localStorage</li><li>Setting up a WebSocket connection</li><li>Cleaning up a third-party chart library</li></ul><h4>Real-World Decision Framework</h4><p>Ask yourself this simple question:</p><p><strong>“Is this side effect talking to a server (API)?”</strong></p><ul><li><strong>Yes</strong> → Use <strong>React Query</strong> (useQuery / useMutation)</li><li><strong>No</strong> → Use <strong>useEffect</strong></li></ul><h4>Quick Comparison Table</h4><p>FeatureuseEffect + useStateTanStack Query (React Query)Primary PurposeGeneral side effectsServer state managementData FetchingManualBuilt-inCachingNo (manual)AutomaticBackground RefetchingNoYesRetry on FailureNoYesLoading / Error StatesManualBuilt-inData Sync Across ComponentsHardEasyEvent Listeners / TimersPerfectNot suitableDOM ManipulationPerfectNot suitableBest ForSmall apps, non-server logicProduction apps with APIs</p><h4>Final Advice for New Developers</h4><p>Don’t blindly follow influencers who say “Never use useEffect again.” Learn both tools properly:</p><ul><li>Master useEffect first — it teaches you how React works.</li><li>Then adopt <strong>TanStack Query</strong> for all server-related data. It will save you hundreds of lines of code and many bugs.</li></ul><p>In 2026, the professional standard is clear: <strong>Use React Query for server state. Use useEffect for everything else.</strong></p><p>Have you been using useEffect for API calls? Or already switched to React Query? Drop your experience in the comments — especially the mistakes you made along the way!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa2ce6864d10" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Your React App Secretly Slow? Here’s How to Find Out and Fix It Fast]]></title>
            <link>https://medium.com/@vaidikthakkar5/is-your-react-app-secretly-slow-heres-how-to-find-out-and-fix-it-fast-f3f4698f998b?source=rss-3df29d5fdcb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3f4698f998b</guid>
            <category><![CDATA[build]]></category>
            <category><![CDATA[production]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[improvement]]></category>
            <dc:creator><![CDATA[Vaidikthakkar]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 05:19:24 GMT</pubDate>
            <atom:updated>2026-03-25T05:19:24.263Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nDO12u59F0aAK5X6" /></figure><blockquote>Performance Testing Guide: Rendering Cycle, Memoization, Bundle Analysis &amp; More (2026 Edition)</blockquote><p>Most React apps aren’t slow because React is bad — they’re slow due to unnecessary re-renders, huge bundles, poor state management, or expensive operations.</p><p><strong>Let’s break it down step-by-step.</strong></p><p><strong>First: Understand Why React Apps Get Slow — The Rendering Cycle</strong></p><p>Every state/prop change triggers:</p><ol><li><strong>Render Phase</strong> → React builds a new Virtual DOM tree.</li><li><strong>Diffing (Reconciliation)</strong> → Compares old vs. new Virtual DOM.</li><li><strong>Commit Phase</strong> → Applies real DOM changes (the expensive part).</li></ol><p><strong>Common culprits for slowdowns:</strong></p><ul><li>Too many unnecessary re-renders (parent updates → children re-render even if props unchanged).</li><li>Expensive calculations or API calls run on every render.</li><li>Massive lists (1000+ items) updating the DOM frequently.</li><li>Inline objects/functions creating new references every render → breaking memoization.</li></ul><p><strong>Real talk:</strong> Most apps fail not from React itself, but from:</p><ul><li>Overusing global state (everything re-renders on any change).</li><li>Poor API handling (blocking renders).</li><li>Large bundles loading unnecessary code.</li><li>Memory leaks in useEffect.</li></ul><h4>Key Fixes for Common Problems</h4><ul><li><strong>1.Frequent Re-renders</strong></li><li>Use keys properly in lists (stable unique IDs).</li><li>Wrap components: React.memo (shallow prop compare).</li><li>Stabilize functions/objects: useCallback / useMemo. <strong>Important:</strong> Memoization trades memory for CPU — don’t overuse it! In 2026, the React Compiler often handles this automatically for pure components.</li><li><strong>2.Large Lists</strong></li><li>Don’t render 1000+ items at once.</li><li><strong>Fix:</strong> Pagination, infinite scroll, or <strong>virtualization</strong> with react-window or react-virtualized (renders only visible items).</li><li><strong>3.Inline Objects/Functions</strong></li><li>{ onClick: () =&gt; doSomething() } creates a new function every render → breaks memo.</li><li>Move to useCallback: const handleClick = useCallback(() =&gt; …, [deps]);</li></ul><blockquote><strong>How to Actually Test &amp; Measure React Performance (2026 Edition)</strong></blockquote><p><strong>1.Bundle Analysis (Top Priority for Load Time)</strong></p><p>Modern React apps often use Vite (fastest bundler). Use rollup-plugin-visualizer (still the go-to in 2026 for Vite/Rollup):</p><pre>npm install --save-dev rollup-plugin-visualizer</pre><p>In vite.config.js</p><pre>import { defineConfig } from &#39;vite&#39;;<br>import react from &#39;@vitejs/plugin-react&#39;;<br>import { visualizer } from &#39;rollup-plugin-visualizer&#39;;<br><br>export default defineConfig({<br>  plugins: [<br>    react(),<br>    visualizer({<br>      open: true,              // Auto-opens report in browser<br>      filename: &#39;dist/stats.html&#39;,<br>      gzipSize: true,<br>      brotliSize: true,<br>    }),<br>  ],<br>});</pre><pre>npm run build</pre><p><strong>2.Analyze Build Output Manually</strong></p><p>After npm run build:</p><ul><li>Check dist/assets/*.js sizes (e.g., index-abc.js 120 KB → gzip ~40 KB).</li><li>Aim for &lt; 100–200 KB initial JS for good perf.</li></ul><p><strong>3.Preview Production Build</strong></p><pre>npm run preview</pre><p><strong>Runs your built app locally (critical — dev server hides issues!).</strong></p><p><strong>4.Runtime &amp; Core Web Vitals Testing</strong></p><ul><li><strong>Google Lighthouse</strong> (in Chrome DevTools): Run on preview URL → Get Performance score, INP (Interaction to Next Paint), blocking JS suggestions. Target 90+ score.</li><li><strong>React DevTools Profiler</strong> (install extension): Record a session → See flamegraph of renders, why components re-render (props/state/hooks), slow components. Highlight unnecessary re-renders in yellow/red.</li></ul><p><strong>5.Extra Tools</strong></p><ul><li><strong>source-map-explorer</strong>: npx source-map-explorer dist/assets/*.js (great for detailed breakdowns).</li><li>Chrome Performance tab: Record interactions to spot long tasks.</li></ul><blockquote><strong>Final Checklist &amp; Real-World Wins</strong></blockquote><ul><li>Profile first (React DevTools + Lighthouse) — never optimize blindly.</li><li>Split code (React.lazy + Suspense).</li><li>Use atomic/local state (Zustand/Jotai over heavy Redux).</li><li>In 2026: Leverage React Compiler (auto-optimizes re-renders) and Server Components (offload to server for zero-client JS).</li><li>Test on real devices — slow 3G + low-end phone reveals issues.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3f4698f998b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The API Gateway Superpower: The Front Door Your Backend Desperately Needs in 2026]]></title>
            <link>https://medium.com/@vaidikthakkar5/the-api-gateway-superpower-the-front-door-your-backend-desperately-needs-in-2026-78411523e104?source=rss-3df29d5fdcb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/78411523e104</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[Vaidikthakkar]]></dc:creator>
            <pubDate>Wed, 04 Mar 2026 05:18:07 GMT</pubDate>
            <atom:updated>2026-03-16T02:54:18.892Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1hc0rHk5_vcRlkpGhnE7mw.png" /></figure><p>An API Gateway is a server (or managed service) that sits between clients and your backend services and acts as a single entry point for all API requests.</p><p><strong>Think of it as a front door to your system.</strong></p><h3><strong>What an API Gateway does:</strong></h3><p><strong>When a client (web app, mobile app, external service) makes a request:</strong></p><p><strong>The gateway handles common concerns so your backend services don’t have to.</strong></p><pre>Client → API Gateway → Backend services</pre><h4><strong>Key responsibilities</strong></h4><h4><strong>1. Request routing</strong></h4><p>Routes requests to the correct service</p><pre> /users → user-service<br> /orders → order-service</pre><h4><strong>2. Authentication &amp; Authorization</strong></h4><ul><li>Verifies JWTs, API keys, OAuth tokens</li><li>Blocks unauthorized requests before they reach services</li></ul><h4><strong>3. Rate limiting &amp; throttling</strong></h4><p>Prevents abuse (e.g., 100 requests/min per user)</p><h4><strong>4. Load balancing</strong></h4><p>Distributes traffic across multiple instances of a service</p><h4><strong>5. Request/Response transformation</strong></h4><ul><li>Modify headers, query params, or response formats</li><li>Example: REST → gRPC, or XML → JSON</li></ul><h4><strong>6. Caching</strong></h4><p>Cache responses to reduce backend load and improve speed</p><h4><strong>7. Logging &amp; monitoring</strong></h4><p>Centralized logs, metrics, and tracing</p><h4><strong>Why API Gateways are important (especially in microservices)</strong></h4><blockquote><strong>Without an API Gateway:</strong></blockquote><ul><li>Clients must know every service’s URL</li><li>Authentication and rate limiting must be repeated in each service</li><li>Harder to evolve services independently</li></ul><blockquote><strong>With an API Gateway:</strong></blockquote><ul><li>One stable endpoint for clients</li><li>Backend services stay simple and focused</li><li>Easier security, monitoring, and scaling</li></ul><h3><strong>Common API Gateway examples</strong></h3><h4>Cloud-managed</h4><ul><li>AWS API Gateway</li><li>Azure API Management</li><li>Google Cloud API Gateway</li></ul><h4><strong>Open-source / self-hosted</strong></h4><ul><li>Kong</li><li>NGINX</li><li>Traefik</li><li>Envoy</li></ul><p><strong>Simple analogy:</strong></p><p><strong>Imagine an office building:</strong></p><ul><li>Reception desk = API Gateway</li><li>Departments = backend services</li></ul><p><strong>Visitors don’t roam freely; the receptionist:</strong></p><ul><li>Checks ID</li><li>Directs them to the right department</li><li>Controls access</li></ul><h4><strong>When you should use an API Gateway</strong></h4><p>✅ Microservices architecture<br> ✅ Public APIs<br> ✅ Multiple client types (web, mobile, partners)<br> ✅ Need centralized security and traffic control</p><p>❌ Very small apps or single-service apps (may be overkill)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78411523e104" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secure Your Backend APIs in 2025–2026: Essential Best Practices Every Backend Developer Needs]]></title>
            <link>https://medium.com/@vaidikthakkar5/secure-your-node-js-express-e48580e9c904?source=rss-3df29d5fdcb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e48580e9c904</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[api-security]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Vaidikthakkar]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 16:55:13 GMT</pubDate>
            <atom:updated>2026-03-25T09:55:02.758Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>As a backend developer building APIs with Node.js and Express, security should never be an afterthought. Poorly secured APIs can lead to data breaches, DDoS attacks, injection vulnerabilities, and more. In this guide, I’ll walk you through practical, production-ready security measures that prevent common threats — without overcomplicating your codebase.</blockquote><h4><strong>1. Add Security Headers and Protection Middlewares</strong></h4><p>Install these:</p><pre>npm install helmet cors xss-clean</pre><p>Apply them</p><pre>const helmet = require(&#39;helmet&#39;);<br>const cors = require(&#39;cors&#39;);<br>const xss = require(&#39;xss-clean&#39;);<br><br>// Security headers (anti-XSS, clickjacking, etc.)<br>app.use(helmet());<br><br>// CORS: Allow only trusted origins (update for your frontend)<br>app.use(cors({<br>  origin: [&#39;https://yourfrontend.com&#39;, &#39;http://localhost:3000&#39;],<br>  credentials: true,<br>}));<br><br>// Sanitize inputs against XSS<br>app.use(xss());<br><br></pre><h4>2. Validate &amp; Sanitize All User Inputs</h4><p>Never trust incoming data — validate it to prevent injection attacks (NoSQL, XSS, etc.).</p><p>Two great options:</p><ol><li>express-validator (Express-specific, chains easily)</li><li>Joi (more flexible schemas, great for complex objects)</li></ol><p>Install your choice:</p><pre>npm install express-validator    # or<br>npm install joi</pre><p><strong>Example with express-validator (recommended for most Express apps):</strong></p><pre>const { body, validationResult } = require(&#39;express-validator&#39;);<br><br>app.post(&#39;/users&#39;,<br>  [<br>    body(&#39;email&#39;).isEmail().normalizeEmail(),<br>    body(&#39;password&#39;).isLength({ min: 8 }).trim().escape(),<br>    body(&#39;name&#39;).trim().escape(),<br>  ],<br>  (req, res) =&gt; {<br>    const errors = validationResult(req);<br>    if (!errors.isEmpty()) {<br>      return res.status(400).json({ errors: errors.array() });<br>    }<br>    // Proceed safely<br>    res.json({ message: &#39;User created&#39; });<br>  }<br>);</pre><p>This sanitizes and validates automatically.</p><h4>3. Use an API Gateway (Optional but Powerful)</h4><p>For larger apps or microservices, an API gateway handles routing, auth, rate limiting, and more.</p><p><strong>Nginx option</strong>: Nginx as a reverse proxy (add rate limiting, headers, SSL termination).</p><p><strong>Node.js</strong> <strong>option</strong>: Libraries like `express-gateway` or build a lightweight one with `http-proxy`.</p><p><strong>Advanced</strong>: Kong, Tyk, or cloud services (AWS API Gateway, Azure).</p><p>For small/medium apps, start with Nginx + Express security middlewares.</p><h4>4. Implement Rate Limiting to Prevent Abuse and DDoS</h4><p>Hackers can overload your server with spam requests. Use `express-rate-limit` to throttle requests per IP.</p><p>Install:</p><pre>npm install express-rate-limit</pre><p>Usage (apply globally or per-route):</p><pre>const rateLimit = require(&#39;express-rate-limit&#39;);<br><br>const apiLimiter = rateLimit({<br>  windowMs: 15 * 60 * 1000, // 15 minutes<br>  max: 100,                 // Limit each IP to 100 requests per window<br>  message: { error: &#39;Too many requests, please try again later.&#39; },<br>  standardHeaders: true,    // Return rate limit info in headers<br>  legacyHeaders: false,<br>});<br><br>app.use(&#39;/api/&#39;, apiLimiter);  // Apply only to API routes</pre><p>This stops brute-force attacks and keeps your server stable.</p><h4>5. Use Environment-Specific .env Files (Never Hardcode Secrets)</h4><p>Hardcoding sensitive data like API keys, database URLs, or JWT secrets is a huge risk. Instead, use the `dotenv` package and separate `.env` files for each environment.</p><p><strong>Recommended setup :</strong></p><pre>.env.development` (local dev)<br>.env.production` (live server)</pre><p><strong>Example ‘.env.development’ :</strong></p><pre>PORT=3000<br>DATABASE_URL=mongodb://localhost:27017/myapp_dev<br>JWT_SECRET=dev-secret-key-123<br>NODE_ENV=development</pre><p>Example ‘.env.production’:</p><pre>PORT=8080<br>DATABASE_URL=mongodb+srv://user:pass@cluster.mongodb.net/myapp_prod<br>JWT_SECRET=super-strong-prod-secret<br>NODE_ENV=production</pre><p>In your ‘server.js’ or ‘app.js’ (load early, before anything else):</p><pre>require(&#39;dotenv&#39;).config({<br>  path: `.env.${process.env.NODE_ENV || &#39;development&#39;}`<br>});<br></pre><p>This automatically loads the right file based on ‘NODE_ENV’.</p><p>Tip: Add ‘.env’ to ‘.gitignore’ and provide a ‘.env.example’ with dummy values for team members.</p><blockquote><strong>Bonus Tips for Stronger Security</strong></blockquote><ul><li>Use HTTPS everywhere (Let’s Encrypt is free).</li><li>Hash passwords with ‘bcrypt&#39;.</li><li>Use JWT or sessions securely (HttpOnly, Secure cookies).</li><li>Log errors but never expose stack traces in production.</li><li>Keep dependencies updated (`npm audit`, Dependabot).</li><li>Add authentication (Passport.js, JWT) and authorization checks.</li></ul><p>Implement these step-by-step, and your Express API will be much harder to attack. Security is layered — start with these fundamentals.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e48580e9c904" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backend Developers: Document and Test APIs Easily With Swagger UI]]></title>
            <link>https://medium.com/@vaidikthakkar5/are-you-a-backend-developer-who-finds-writing-api-documentation-challenging-474fd780a8ea?source=rss-3df29d5fdcb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/474fd780a8ea</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[swagger]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Vaidikthakkar]]></dc:creator>
            <pubDate>Sun, 25 Jan 2026 12:12:47 GMT</pubDate>
            <atom:updated>2026-01-26T06:08:57.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*Yy8sff10Az-mLKzrGtd5Yg.avif" /></figure><p>If you’re a backend developer, you’ve probably faced this situation:</p><ul><li>Writing API documentation feels painful</li><li>Manual API testing wastes a lot of time</li><li>Explaining APIs repeatedly to frontend developers is frustrating</li></ul><p>I faced the same problems — until I started using <strong>Swagger UI (OpenAPI)</strong>.</p><h4><strong>What Is Swagger UI (OpenAPI)?</strong></h4><blockquote><strong>Swagger UI, now part of the OpenAPI Specification, is a powerful tool for REST API documentation</strong></blockquote><p>It automatically generates <strong>interactive API documentation</strong> from your OpenAPI definitions — without requiring you to write extra business logic.</p><p>With Swagger UI, developers can:</p><ul><li>View all API endpoints in a browser</li><li>Understand request and response formats</li><li>Test APIs directly from the UI</li></ul><p>This makes collaboration between backend and frontend developers much smoother.</p><h4>Why Backend Developers Love Swagger UI</h4><p>Swagger UI solves multiple problems at once:</p><ul><li>No more manual API documentation</li><li>Built-in API testing from the browser</li><li>Clear and standardized API structure</li><li>Less time explaining endpoints to frontend developers</li></ul><p>For backend developers, it’s a <strong>huge productivity boost</strong>.</p><h4>Setting Up Swagger UI in a Node.js Backend</h4><p>If you’re using <strong>JavaScript (Node.js + Express)</strong> for backend development, you can easily integrate Swagger using these npm packages:</p><ul><li>swagger-jsdoc</li><li>swagger-ui-express</li></ul><h3>Install the packages</h3><pre>npm install swagger-jsdoc swagger-ui-express</pre><h4>What Do These Packages Do?</h4><p><strong>swagger-jsdoc</strong></p><p>swagger-jsdoc generates an OpenAPI specification by reading special comments written in your code using <strong>JSDoc syntax</strong>.</p><p>It focuses on describing API endpoints, parameters, and responses.</p><p><strong>swagger-ui-express</strong></p><p>swagger-ui-express serves the Swagger UI interface for your API using the generated OpenAPI specification.</p><p>It allows you to host interactive API documentation directly on your server.</p><p><strong>Swagger Configuration (server.js / index.js)</strong></p><p>Set up Swagger in your main server file:</p><pre>const swaggerJsdoc = require(&quot;swagger-jsdoc&quot;);<br>const swaggerUi = require(&quot;swagger-ui-express&quot;);<br><br>const options = {<br>  definition: {<br>    openapi: &quot;3.0.0&quot;,<br>    info: {<br>      title: &quot;My API&quot;,<br>      version: &quot;1.0.0&quot;<br>    }<br>  },<br>  apis: [&quot;./routes/*.js&quot;]<br>};<br><br>const swaggerSpec = swaggerJsdoc(options);<br><br>app.use(&quot;/api-docs&quot;, swaggerUi.serve, swaggerUi.setup(swaggerSpec));</pre><p>Once configured, you can access your API documentation at:</p><p><a href="http://localhost:3000/api-docs">http://localhost:${PORT}/api-docs</a></p><h4>Writing Swagger Documentation: Two Common Approaches</h4><p>There are two popular ways to write Swagger (OpenAPI) documentation in a Node.js backend project. Both approaches work well — you can choose based on your project structure and</p><ol><li><strong>Writing Swagger Comments Inside Route Files</strong></li></ol><p>In this approach, Swagger comments are written directly above the API routes.<br> This keeps the documentation close to the actual implementation.</p><p><strong>Example: Get All Users API (routes/users.js)</strong></p><pre>/**<br> * @swagger<br> * /users:<br> *   get:<br> *     summary: Get all users<br> *     description: Returns a list of all users<br> *     responses:<br> *       200:<br> *         description: Successful response with a list of users<br> */<br>app.get(&quot;/users&quot;, (req, res) =&gt; {<br>  res.send(&quot;List of users&quot;);<br>});</pre><p><strong>When to use this approach:</strong></p><ul><li>Small to medium-sized projects</li><li>When you want documentation and code in one place</li><li>Easier to keep docs in sync with the API logic</li></ul><p>2. <strong>Writing Swagger Comments in a Separate File</strong></p><p>In this approach, Swagger documentation is written in a separate folder (commonly called api-docs).<br> This keeps documentation cleanly separated from business logic.</p><pre>project-root<br>│<br>├── routes<br>│   └── users.js<br>├── api-docs<br>│   └── users.js</pre><p><strong>Example: Swagger Documentation File (api-docs/users.js)</strong></p><pre>/**<br> * @swagger<br> * /users:<br> *   get:<br> *     summary: Get all users<br> *     description: Returns a list of all users<br> *     responses:<br> *       200:<br> *         description: Successful response with a list of users<br> */</pre><p>Your actual route implementation remains clean:</p><pre>app.get(&quot;/users&quot;, (req, res) =&gt; {<br>  res.send(&quot;List of users&quot;);<br>});</pre><p>Make sure your Swagger configuration includes the api-docs folder:</p><pre>apis: [&quot;./routes/*.js&quot;, &quot;./api-docs/*.js&quot;]</pre><h3>When to use this approach:</h3><ul><li>Large or enterprise-level projects</li><li>When you want clean separation between code and documentation</li><li>Easier collaboration between developers and technical writers</li></ul><h4>Which Approach Should You Choose?</h4><ul><li><strong>Small projects</strong> → Write Swagger comments inside route files</li><li><strong>Large projects</strong> → Use a separate api-docs folder</li></ul><h3>conclusion:</h3><ul><li>Document APIs efficiently</li><li>Reduce manual testing</li><li>Improve collaboration with frontend developers</li></ul><p>If you’re tired of writing API documentation by hand, <strong>Swagger UI is absolutely worth using</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=474fd780a8ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>