<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sai Bhargav</title>
    <description>The latest articles on DEV Community by Sai Bhargav (@saibhargav).</description>
    <link>https://dev.to/saibhargav</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3548605%2Fa338a3d1-2835-4842-bf76-45e49965d3a1.png</url>
      <title>DEV Community: Sai Bhargav</title>
      <link>https://dev.to/saibhargav</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saibhargav"/>
    <language>en</language>
    <item>
      <title>CORS Explained for Developers: Why the Browser Blocks Your fetch (and How to Actually Fix It)</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Fri, 27 Nov 2026 10:25:07 +0000</pubDate>
      <link>https://dev.to/saibhargav/cors-explained-for-developers-why-the-browser-blocks-your-fetch-and-how-to-actually-fix-it-27e8</link>
      <guid>https://dev.to/saibhargav/cors-explained-for-developers-why-the-browser-blocks-your-fetch-and-how-to-actually-fix-it-27e8</guid>
      <description>&lt;p&gt;Every web developer meets the same red console message: Access to fetch at '&lt;a href="https://api.example.com" rel="noopener noreferrer"&gt;https://api.example.com&lt;/a&gt;' from origin '&lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;' has been blocked by CORS policy. The reflex is to search for a browser flag or a proxy that makes it go away. Resist it. CORS is a conversation between the browser and the server, and the only real fix is on the server side. This guide explains what the browser is actually enforcing, when the preflight OPTIONS request fires, the exact headers that fix each failure, and the mistakes that make CORS errors look like something they are not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the browser blocks you at all
&lt;/h2&gt;

&lt;p&gt;Your browser sends your cookies with every request to a domain, automatically. That ambient authority is what keeps you logged in, and it is exactly what makes cross-site requests dangerous: without a rule, any page you open could quietly call your bank's API as you. The &lt;strong&gt;same-origin policy&lt;/strong&gt; says a page may read responses only from its own origin, where an origin is the triple of scheme, host, and port. &lt;code&gt;https://app.example.com&lt;/code&gt; and &lt;code&gt;https://api.example.com&lt;/code&gt; are different origins. So are &lt;code&gt;http&lt;/code&gt; vs &lt;code&gt;https&lt;/code&gt;, and &lt;code&gt;:3000&lt;/code&gt; vs &lt;code&gt;:8080&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;CORS (Cross-Origin Resource Sharing) is the controlled exception: the server tells the browser which other origins may read its responses. The key mental model: &lt;strong&gt;the request usually happens; the browser blocks your code from reading the response.&lt;/strong&gt; That is why the API works in curl and Postman but fails in the browser, and why the server log shows the request arriving.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple requests vs the preflight
&lt;/h2&gt;

&lt;p&gt;Requests that a plain HTML form could already make (GET, HEAD, POST with &lt;code&gt;text/plain&lt;/code&gt;, &lt;code&gt;application/x-www-form-urlencoded&lt;/code&gt;, or &lt;code&gt;multipart/form-data&lt;/code&gt;, and only safelisted headers) go straight out as "simple" requests. The browser attaches an &lt;code&gt;Origin&lt;/code&gt; header and checks the response for permission afterwards.&lt;/p&gt;

&lt;p&gt;Anything more interesting triggers a &lt;strong&gt;preflight&lt;/strong&gt;: the browser first sends an OPTIONS request asking permission. Preflights fire when you use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Methods beyond GET/HEAD/POST: &lt;code&gt;PUT&lt;/code&gt;, &lt;code&gt;PATCH&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Content-Type: application/json&lt;/code&gt; — this alone is why every JSON API call preflights&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Custom headers, most commonly &lt;code&gt;Authorization&lt;/code&gt; (so every Bearer-token call preflights too)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The preflight asks: may this origin use this method with these headers? The server answers with &lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt;, &lt;code&gt;Access-Control-Allow-Methods&lt;/code&gt;, and &lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt;. Only if the answer covers the real request does the browser send it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The server-side fix, header by header
&lt;/h2&gt;

&lt;p&gt;An Express example that covers the common cases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://app.example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"http://localhost:3000"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Access-Control-Allow-Origin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// echo, never "*"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Access-Control-Allow-Methods"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"GET, POST, PUT, DELETE, OPTIONS"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Access-Control-Allow-Headers"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type, Authorization"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Access-Control-Max-Age"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"86400"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// cache the preflight for a day&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"OPTIONS"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;204&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// answer preflights here&lt;/span&gt;
&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt; — the one required header. An exact origin, or &lt;code&gt;*&lt;/code&gt; for genuinely public APIs. When you echo the requesting origin from an allowlist, also send &lt;code&gt;Vary: Origin&lt;/code&gt; so caches do not serve one origin's answer to another.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Access-Control-Allow-Methods&lt;/code&gt; / &lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt; — preflight answers. List what you actually support; &lt;code&gt;Content-Type, Authorization&lt;/code&gt; covers most JSON APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Access-Control-Max-Age&lt;/code&gt; — lets the browser cache the preflight so it does not OPTIONS before every call.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Access-Control-Allow-Credentials: true&lt;/code&gt; — required if the frontend sends cookies or uses &lt;code&gt;credentials: "include"&lt;/code&gt;. With credentials, &lt;code&gt;*&lt;/code&gt; is forbidden: the header must name the exact origin. The wildcard-plus-credentials combination is silently rejected and is a classic hour-eater.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Access-Control-Expose-Headers&lt;/code&gt; — by default JS can read only a handful of response headers. If your API returns pagination in &lt;code&gt;X-Total-Count&lt;/code&gt; or tokens in a custom header, expose them explicitly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The client side is one line
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cookie-based session: opt in on BOTH sides&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://api.example.com/me"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="n"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"include"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// token-based: the Authorization header triggers a preflight&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://api.example.com/data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Bearer "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no CORS "mode" you set on fetch to get permission. &lt;code&gt;mode: "no-cors"&lt;/code&gt; does not bypass the policy; it tells the browser to send the request and hand you back an opaque, unreadable response. It exists for things like analytics pings, and it is never the answer for an API you need to read.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistakes that waste hours
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fixing the happy path only.&lt;/strong&gt; If your error handler returns a 500 without the CORS headers, the browser reports a CORS failure and hides the real error. Put the headers on every response, including errors and 404s. Half of all "random CORS errors in production" are unhandled 500s.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Thinking CORS protects the server.&lt;/strong&gt; It does not. curl, Postman, and every server-to-server call ignore it completely. CORS only governs what browsers let page JavaScript read. Rate limiting, auth, and CSRF tokens are still your job.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Routing through a public CORS proxy.&lt;/strong&gt; Services that fetch the API for you and add permissive headers "work" in demos, but you are sending your users' data and tokens through a stranger's server, and production apps that depend on them break the day the proxy rate-limits or shuts down. Use a dev-only proxy you control instead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wildcard with credentials.&lt;/strong&gt; As above: &lt;code&gt;Access-Control-Allow-Origin: *&lt;/code&gt; plus &lt;code&gt;Allow-Credentials: true&lt;/code&gt; is rejected by every browser. Echo the exact origin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Preflight answered by the wrong layer.&lt;/strong&gt; With nginx or a CDN in front, make sure OPTIONS actually reaches (or is answered by) something that returns the headers. A preflight that hits a static-file rule and returns 405 fails the whole request.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Local development without the pain
&lt;/h2&gt;

&lt;p&gt;The clean dev fix is a proxy on the dev server: Vite and the Next.js rewrites config forward &lt;code&gt;/api/*&lt;/code&gt; to the real backend, so the browser only ever talks to one origin and CORS never enters the picture. This mirrors production when the API and app sit behind the same domain, which is the most robust setup of all.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// vite.config.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="n"&gt;proxy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"/api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://api.example.com"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Error message to fix, quickly
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Console says&lt;/th&gt;
&lt;th&gt;Actual cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;| No 'Access-Control-Allow-Origin' header | Server did not send the header (or the response was an error page without it) | Add the header on every response, errors included |&lt;/p&gt;

&lt;p&gt;| Request header field authorization is not allowed | Preflight answer missing &lt;code&gt;Authorization&lt;/code&gt; | Add it to &lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt; |&lt;/p&gt;

&lt;p&gt;| Method PUT is not allowed | Preflight answer missing the method | Add it to &lt;code&gt;Access-Control-Allow-Methods&lt;/code&gt; |&lt;/p&gt;

&lt;p&gt;| Credential is not supported if the CORS header is '&lt;em&gt;' | Wildcard origin plus credentials | Echo the exact origin instead of `&lt;/em&gt;` |&lt;/p&gt;

&lt;p&gt;| CORS error but curl works fine | Normal: curl ignores CORS | Debug in the browser's Network tab, inspect the OPTIONS response |&lt;/p&gt;

&lt;p&gt;| Worked yesterday, fails after deploy | New error page or proxy layer lost the headers | Check who now answers OPTIONS and error paths |&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging methodically
&lt;/h2&gt;

&lt;p&gt;Open the Network tab and find the OPTIONS request, not just the failed one. Its response headers are the server's actual answer; compare them against what your request needs. If OPTIONS never appears, your request was "simple" and the missing header is on the main response. If OPTIONS returns 404/405/500, the preflight is being routed wrong. And if you want to see the raw exchange without the browser, the &lt;a href="https://www.devbench.co.in/blog/curl-cheat-sheet" rel="noopener noreferrer"&gt;curl cheat sheet&lt;/a&gt; covers &lt;code&gt;curl -v -X OPTIONS -H "Origin: ..."&lt;/code&gt; for simulating a preflight from the terminal.&lt;/p&gt;

&lt;p&gt;Related reading: &lt;a href="https://www.devbench.co.in/blog/http-status-codes-explained" rel="noopener noreferrer"&gt;HTTP status codes&lt;/a&gt; for the 204 your preflight should return and the 500s that masquerade as CORS errors, and &lt;a href="https://www.devbench.co.in/blog/jwt-explained" rel="noopener noreferrer"&gt;JWT explained&lt;/a&gt; for the Authorization header pattern that triggers preflights on every authenticated call. When the JSON finally comes through, our &lt;a href="https://www.devbench.co.in/tools/json-formatter" rel="noopener noreferrer"&gt;JSON Formatter&lt;/a&gt; makes the response readable.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post originally appeared on the &lt;a href="https://www.devbench.co.in/blog/cors-explained-for-developers" rel="noopener noreferrer"&gt;DevBench blog&lt;/a&gt;. DevBench is a free collection of 183+ browser-based developer tools, including a &lt;a href="https://www.devbench.co.in/tools/json-formatter" rel="noopener noreferrer"&gt;JSON Formatter&lt;/a&gt; for reading API responses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>curl Cheat Sheet: The Commands You Actually Use, Explained</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:35:59 +0000</pubDate>
      <link>https://dev.to/saibhargav/curl-cheat-sheet-the-commands-you-actually-use-explained-3d04</link>
      <guid>https://dev.to/saibhargav/curl-cheat-sheet-the-commands-you-actually-use-explained-3d04</guid>
      <description>&lt;p&gt;curl is the HTTP client that is already installed on your machine, your CI runner, your Docker image, and the server you just SSH'd into. It is also the format every API's documentation secretly uses: when a doc shows you a request, it shows you a curl command. This cheat sheet covers the flags you will actually use, the ones that save you during debugging, and the shell traps that make curl look broken when it is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The anatomy: method, header, body
&lt;/h2&gt;

&lt;p&gt;Three flags cover most requests: &lt;code&gt;-X&lt;/code&gt; sets the method, &lt;code&gt;-H&lt;/code&gt; adds a header, &lt;code&gt;-d&lt;/code&gt; attaches a body.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -X POST -H "Content-Type: application/json" -d '{"name":"ada"}' https://api.example.com/users&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Two things to know. First, &lt;code&gt;-d&lt;/code&gt; implies POST, so &lt;code&gt;-X POST&lt;/code&gt; is redundant there; you only need &lt;code&gt;-X&lt;/code&gt; for PUT, PATCH, and DELETE. Second, &lt;code&gt;-d&lt;/code&gt; does not set a Content-Type for you: it defaults to &lt;code&gt;application/x-www-form-urlencoded&lt;/code&gt;, which is why APIs reject JSON bodies sent without the header.&lt;/p&gt;

&lt;h2&gt;
  
  
  GET requests with query strings
&lt;/h2&gt;

&lt;p&gt;Never hand-assemble query strings. Use &lt;code&gt;-G&lt;/code&gt; with &lt;code&gt;--data-urlencode&lt;/code&gt; and curl encodes each parameter correctly:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -G https://api.example.com/search --data-urlencode "q=hello world" --data-urlencode "lang=en"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This produces &lt;code&gt;?q=hello%20world&amp;amp;lang=en&lt;/code&gt;. Spaces, ampersands, and non-ASCII text are handled for you. If you paste a raw query string into the URL instead, quote the whole URL or the shell will split it at the &lt;code&gt;&amp;amp;&lt;/code&gt; and run half your request as a background job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending JSON the short way
&lt;/h2&gt;

&lt;p&gt;Since curl 7.82, &lt;code&gt;--json&lt;/code&gt; bundles the three flags a JSON POST needs: it sets the Content-Type and Accept headers and attaches the body.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl --json '{"name":"ada"}' https://api.example.com/users&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To send a JSON file instead of an inline string, use &lt;code&gt;--json @payload.json&lt;/code&gt;. The &lt;code&gt;@&lt;/code&gt; prefix reads from a file with &lt;code&gt;-d&lt;/code&gt; too, but &lt;code&gt;--json&lt;/code&gt; gets the headers right in one step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Forms and file uploads
&lt;/h2&gt;

&lt;p&gt;HTML-style form posts use &lt;code&gt;-d&lt;/code&gt; with &lt;code&gt;key=value&lt;/code&gt; pairs (repeat the flag for each field). Multipart uploads, the kind with files, use &lt;code&gt;-F&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@report.pdf" -F "title=Q3 report" https://api.example.com/upload&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-F&lt;/code&gt; builds a proper multipart/form-data request; &lt;code&gt;-d @file&lt;/code&gt; sends the raw file bytes as the whole body, which is what you want for a plain PUT of a file to signed storage URLs. Mixing them up is a classic source of "the server says my file is empty."&lt;/p&gt;

&lt;h2&gt;
  
  
  Auth patterns
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Basic auth:&lt;/strong&gt; &lt;code&gt;-u username:password&lt;/code&gt; (prompts for the password if you write &lt;code&gt;-u username&lt;/code&gt;, keeping it out of your shell history)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bearer tokens:&lt;/strong&gt; &lt;code&gt;-H "Authorization: Bearer $TOKEN"&lt;/code&gt;, with the token in an environment variable so it never lands in the command itself&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API keys:&lt;/strong&gt; usually just a header, &lt;code&gt;-H "X-API-Key: ..."&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cookies:&lt;/strong&gt; &lt;code&gt;-c jar.txt&lt;/code&gt; saves cookies from a response, &lt;code&gt;-b jar.txt&lt;/code&gt; sends them on the next request; use both together to stay logged in across a scripted session&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Seeing what actually happened
&lt;/h2&gt;

&lt;p&gt;When a request misbehaves, three flags tell you everything. &lt;code&gt;-i&lt;/code&gt; includes the response headers (status line, cookies, caching) above the body. &lt;code&gt;-v&lt;/code&gt; shows the full conversation: the exact request curl sent, TLS details, and every response header. And &lt;code&gt;-w&lt;/code&gt; prints timing and status after the body:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://api.example.com/health&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That last one is the uptime-check pattern: discard the body, print just the status code and total time. Pair &lt;code&gt;-s&lt;/code&gt; (silent) with &lt;code&gt;-S&lt;/code&gt; (show errors) as &lt;code&gt;-sS&lt;/code&gt; in scripts so progress noise disappears but real failures still surface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Downloads that behave
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;-o name.zip&lt;/code&gt; saves to a filename you choose; &lt;code&gt;-O&lt;/code&gt; keeps the server's filename. &lt;code&gt;-L&lt;/code&gt; follows redirects, and you almost always want it for downloads, since most file hosts 302 to a CDN. &lt;code&gt;--fail&lt;/code&gt; (or &lt;code&gt;-f&lt;/code&gt;) makes curl exit non-zero on HTTP errors instead of happily saving an HTML error page as your download. A resumable download adds &lt;code&gt;-C -&lt;/code&gt;, which picks up where the previous attempt stopped.&lt;/p&gt;

&lt;p&gt;The working download incantation: &lt;code&gt;curl -fLO --retry 3 -C - https://example.com/big.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The quoting trap
&lt;/h2&gt;

&lt;p&gt;Most "curl is broken" reports are shell quoting. Single quotes protect everything but cannot contain a single quote; double quotes allow &lt;code&gt;$VARIABLE&lt;/code&gt; expansion but also let the shell eat backticks and &lt;code&gt;!&lt;/code&gt; in interactive shells. A JSON body with a variable in it needs the hybrid: &lt;code&gt;-d '{"name":"'"$NAME"'"}'&lt;/code&gt;, or better, build the body with a tool like jq. On Windows, cmd.exe does not understand single quotes at all: use double quotes outside and escape the inner ones.&lt;/p&gt;

&lt;p&gt;And a word on &lt;code&gt;-k&lt;/code&gt; (&lt;code&gt;--insecure&lt;/code&gt;): it disables certificate verification. Fine against your own staging box with a self-signed cert, never fine as a permanent fix. If you need it in production, the real problem is a missing or misconfigured certificate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;| &lt;code&gt;-X PUT&lt;/code&gt; | Set the HTTP method |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-H "K: V"&lt;/code&gt; | Add a request header (repeatable) |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-d data&lt;/code&gt; | Request body; implies POST; &lt;code&gt;@file&lt;/code&gt; reads a file |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;--json data&lt;/code&gt; | JSON body with correct headers in one flag |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-G --data-urlencode&lt;/code&gt; | Build an encoded query string for GET |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-F field=@file&lt;/code&gt; | Multipart form upload |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-u user:pass&lt;/code&gt; | Basic auth |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-b / -c jar&lt;/code&gt; | Send / save cookies |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-i / -v&lt;/code&gt; | Show response headers / full debug trace |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-sS&lt;/code&gt; | Quiet but still show errors |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-o / -O&lt;/code&gt; | Save body to named / server-named file |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-L&lt;/code&gt; | Follow redirects |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;--fail&lt;/code&gt; | Exit non-zero on HTTP errors |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-C -&lt;/code&gt; | Resume an interrupted download |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;-w format&lt;/code&gt; | Print status, timing, sizes after the body |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;--retry 3&lt;/code&gt; | Retry transient failures |&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it together: an API test in one line
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;curl -sS --fail --json '{"email":"ada@example.com"}' https://api.example.com/users | jq .id&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Quiet unless something fails, non-zero exit when the API returns an error, JSON headers handled, and the response piped into jq for the one field you care about. This pattern drops straight into CI scripts and health checks.&lt;/p&gt;

&lt;p&gt;When your query strings get complicated, our &lt;a href="https://www.devbench.co.in/tools/url-encode" rel="noopener noreferrer"&gt;URL Encoder&lt;/a&gt; shows exactly how each character encodes, useful for checking what curl will send. Related reading: &lt;a href="https://www.devbench.co.in/blog/http-status-codes-explained" rel="noopener noreferrer"&gt;HTTP status codes&lt;/a&gt; for reading the responses, &lt;a href="https://www.devbench.co.in/blog/url-encoding-explained" rel="noopener noreferrer"&gt;URL encoding&lt;/a&gt; for the percent-encoding rules, and &lt;a href="https://www.devbench.co.in/blog/dns-record-types-explained" rel="noopener noreferrer"&gt;DNS record types&lt;/a&gt; for when curl cannot resolve the host at all.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post originally appeared on the &lt;a href="https://www.devbench.co.in/blog/curl-cheat-sheet" rel="noopener noreferrer"&gt;DevBench blog&lt;/a&gt;. DevBench is a free collection of 183+ browser-based developer tools, including a &lt;a href="https://www.devbench.co.in/tools/url-encode" rel="noopener noreferrer"&gt;URL Encoder&lt;/a&gt; that shows exactly how each character encodes.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cli</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>DNS Record Types Explained: A, AAAA, CNAME, MX, TXT, NS, SOA and the Mistakes That Break Email</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:35:39 +0000</pubDate>
      <link>https://dev.to/saibhargav/dns-record-types-explained-a-aaaa-cname-mx-txt-ns-soa-and-the-mistakes-that-break-email-a6b</link>
      <guid>https://dev.to/saibhargav/dns-record-types-explained-a-aaaa-cname-mx-txt-ns-soa-and-the-mistakes-that-break-email-a6b</guid>
      <description>&lt;p&gt;DNS is the phone book of the internet, but the "phone book" metaphor hides the part that actually bites developers: there is no single record per domain, there are a dozen record types, each with its own rules. Misconfigure a CNAME at your apex and email breaks. Set the wrong TTL before a migration and users see the old server for hours. This is the working guide to the record types you will actually touch, what breaks when you get them wrong, and how to check any of them in seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  A and AAAA — the address records
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;A&lt;/code&gt; record maps a name to an IPv4 address (&lt;code&gt;93.184.216.34&lt;/code&gt;); the &lt;code&gt;AAAA&lt;/code&gt; record does the same for IPv6. These are the only records that point directly at a server. Everything else either aliases to a name that eventually resolves to an A/AAAA record, or carries metadata.&lt;/p&gt;

&lt;p&gt;Practical notes: you can have multiple A records for one name (round-robin load distribution — clients pick one, roughly at random). And when you move hosts, the A record is what you change; everything about "DNS propagation" is really about how long caches keep the old A record answer, which brings us to TTL below.&lt;/p&gt;

&lt;h2&gt;
  
  
  CNAME — the alias, with one hard rule
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;CNAME&lt;/code&gt; says "this name is just another name for that name" — &lt;code&gt;www.example.com&lt;/code&gt; → &lt;code&gt;example.com&lt;/code&gt;, or &lt;code&gt;app.example.com&lt;/code&gt; → &lt;code&gt;my-app.vercel.app&lt;/code&gt;. The resolver follows the chain until it hits an A or AAAA record.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hard rule: a CNAME cannot coexist with any other record type at the same name.&lt;/strong&gt; This is why you cannot put a CNAME at your apex (bare domain): the apex must have SOA and NS records, so a CNAME there is illegal. Providers work around this with proprietary flattening (Cloudflare calls it CNAME flattening, Route53 calls them alias records) that resolves the target and serves the result as synthetic A records. If your apex "CNAME" works, that is what is happening underneath.&lt;/p&gt;

&lt;h2&gt;
  
  
  MX — where your email goes
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;MX&lt;/code&gt; records name the mail servers that accept email for your domain, each with a priority number — lower wins, and the others are fallbacks. Two things trip people up: MX targets must be hostnames, not IP addresses, and those hostnames must themselves have A/AAAA records (a MX pointing at a CNAME is technically allowed but widely discouraged because it doubles lookups). If email suddenly stops after a DNS change, check MX first — it often gets clobbered when someone recreates the zone file.&lt;/p&gt;

&lt;h2&gt;
  
  
  TXT — the junk drawer that runs security
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;TXT&lt;/code&gt; records hold arbitrary strings, and an entire ecosystem grew up inside them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SPF&lt;/strong&gt; — which servers may send email as your domain (&lt;code&gt;v=spf1 include:_spf.google.com ~all&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DKIM&lt;/strong&gt; — the public key recipients use to verify your mail signatures&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DMARC&lt;/strong&gt; — what recipients should do when SPF or DKIM fails&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Verification&lt;/strong&gt; — proving domain ownership to Google Search Console, Microsoft, Stripe, and everyone else ("add this TXT record")&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One domain can have many TXT records, and order does not matter. The classic mistake is creating a second SPF record instead of merging includes into the existing one — two SPF records make both invalid, and your email deliverability silently degrades.&lt;/p&gt;

&lt;h2&gt;
  
  
  NS and SOA — who is in charge
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;NS&lt;/code&gt; records delegate a zone to nameservers; they are set at your registrar and inside the zone itself. Changing hosts or moving to Cloudflare means changing NS at the registrar, and the old and new nameservers must serve the same records during the transition or things flap. &lt;code&gt;SOA&lt;/code&gt; (Start of Authority) is the zone's metadata record: primary nameserver, admin contact, and the serial number secondary servers use to know when to re-sync. You rarely edit SOA by hand, but its refresh/retry/expire timers explain why some secondaries lag hours behind.&lt;/p&gt;

&lt;h2&gt;
  
  
  TTL — the number that decides how fast changes apply
&lt;/h2&gt;

&lt;p&gt;Every record carries a TTL in seconds: how long resolvers may cache the answer. A TTL of 3600 means your change can take an hour to be visible everywhere; 86400 means a day. &lt;strong&gt;Before any migration, lower the TTL to 300 a day ahead&lt;/strong&gt;, make the change, verify, then raise it back. Forgetting this is the difference between a 5-minute cutover and a day of "it works for me but not for the client."&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Holds&lt;/th&gt;
&lt;th&gt;Watch out for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;| &lt;code&gt;A&lt;/code&gt; | IPv4 address | Multiple records = round-robin |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;AAAA&lt;/code&gt; | IPv6 address | Missing AAAA on an IPv6-only host = unreachable |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;CNAME&lt;/code&gt; | Alias to another name | Illegal at the apex; cannot coexist with other records |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;MX&lt;/code&gt; | Mail servers + priority | Target must be a hostname with an A record |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;TXT&lt;/code&gt; | Arbitrary strings | Two SPF records invalidate both |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;NS&lt;/code&gt; | Authoritative nameservers | Keep old and new serving during moves |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;SOA&lt;/code&gt; | Zone metadata + serial | Timers explain secondary lag |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;SRV&lt;/code&gt; | Service host + port | Used by SIP, XMPP, Minecraft, not web |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;CAA&lt;/code&gt; | Which CAs may issue certs | A wrong CAA blocks certificate issuance |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;PTR&lt;/code&gt; | Reverse: IP → name | Set at the IP owner, not your DNS provider |&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging in the real world
&lt;/h2&gt;

&lt;p&gt;When something DNS-shaped breaks, work the chain: query the record, then query it against a specific resolver (&lt;code&gt;dig example.com A @1.1.1.1&lt;/code&gt;), then against the authoritative nameserver (&lt;code&gt;dig example.com A @ns1.yourhost.com&lt;/code&gt;). If the authoritative answer is right but the resolver answer is stale, you are waiting on TTL. If the authoritative answer is wrong, the problem is your zone file, and no amount of waiting fixes it.&lt;/p&gt;

&lt;p&gt;No terminal handy? Our &lt;a href="https://www.devbench.co.in/tools/dns-lookup" rel="noopener noreferrer"&gt;DNS Lookup&lt;/a&gt; tool queries A, AAAA, MX, TXT, CNAME, NS, and SOA for any domain via DNS-over-HTTPS, straight from your browser — handy on a phone mid-incident.&lt;/p&gt;

&lt;p&gt;Related reading: &lt;a href="https://www.devbench.co.in/blog/http-status-codes-explained" rel="noopener noreferrer"&gt;HTTP status codes&lt;/a&gt; for the layer above DNS, &lt;br&gt;
&lt;a href="https://www.devbench.co.in/blog/url-encoding-explained" rel="noopener noreferrer"&gt;URL encoding&lt;/a&gt; for what happens to hostnames and query strings, and &lt;br&gt;
&lt;a href="https://www.devbench.co.in/blog/unix-timestamps-explained" rel="noopener noreferrer"&gt;Unix timestamps&lt;/a&gt; for the TTL and SOA timer math.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post originally appeared on the &lt;a href="https://www.devbench.co.in/blog/dns-record-types-explained" rel="noopener noreferrer"&gt;DevBench blog&lt;/a&gt;. DevBench is a free collection of 183+ browser-based developer tools, including a &lt;a href="https://www.devbench.co.in/tools/dns-lookup" rel="noopener noreferrer"&gt;DNS Lookup&lt;/a&gt; that queries any record type from your browser.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>networking</category>
      <category>devops</category>
      <category>beginners</category>
    </item>
    <item>
      <title>HTTP Status Codes Explained: The Ones That Actually Matter When Debugging APIs and Deploys</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:35:03 +0000</pubDate>
      <link>https://dev.to/saibhargav/http-status-codes-explained-the-ones-that-actually-matter-when-debugging-apis-and-deploys-5hba</link>
      <guid>https://dev.to/saibhargav/http-status-codes-explained-the-ones-that-actually-matter-when-debugging-apis-and-deploys-5hba</guid>
      <description>&lt;p&gt;Every API response, every page load, every failed deploy comes down to a three-digit number. HTTP status codes look like trivia until you are debugging a production incident at 2 AM and the difference between a &lt;code&gt;502&lt;/code&gt; and a &lt;code&gt;504&lt;/code&gt; tells you which service to restart. This is the working set of codes that actually show up in logs, plus the ones that quietly change how browsers and caches treat your site.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five classes, in one glance
&lt;/h2&gt;

&lt;p&gt;The first digit is the category. &lt;strong&gt;1xx&lt;/strong&gt; is informational (rare in practice, mostly protocol upgrades like &lt;code&gt;101 Switching Protocols&lt;/code&gt; for WebSockets). &lt;strong&gt;2xx&lt;/strong&gt; means success. &lt;strong&gt;3xx&lt;/strong&gt; means the resource lives somewhere else, or has not changed. &lt;strong&gt;4xx&lt;/strong&gt; means the client sent something wrong. &lt;strong&gt;5xx&lt;/strong&gt; means the server failed. If you remember nothing else: 4xx is your caller's fault, 5xx is yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  2xx — success is not always 200
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;200 OK&lt;/code&gt; covers most responses, but three others carry real meaning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;201 Created&lt;/code&gt; — the correct response to a POST that makes a new resource. Return it with a &lt;code&gt;Location&lt;/code&gt; header pointing at the new resource. Clients that poll for creation depend on this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;204 No Content&lt;/code&gt; — success with an empty body. Ideal for DELETE endpoints and fire-and-forget updates. Sending a 200 with &lt;code&gt;{}&lt;/code&gt; instead forces clients to parse a meaningless payload.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;206 Partial Content&lt;/code&gt; — the server honored a &lt;code&gt;Range&lt;/code&gt; request. This is what makes resumable downloads and video scrubbing work; if you serve large files, check that your CDN passes it through.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3xx — the redirect codes that change SEO and caching
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;301 Moved Permanently&lt;/code&gt; tells browsers and search engines the old URL is gone forever; Google transfers ranking signals to the target. &lt;code&gt;302 Found&lt;/code&gt; is a temporary move and passes nothing. Sending a 302 when you mean 301 is one of the most common silent SEO bugs — the old URL keeps competing with the new one in search results.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;307&lt;/code&gt; and &lt;code&gt;308&lt;/code&gt; are the strict modern versions: unlike 301/302, they forbid changing the request method, so a POST stays a POST. Use &lt;code&gt;308 Permanent Redirect&lt;/code&gt; for API endpoint migrations where a method flip would break clients.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;304 Not Modified&lt;/code&gt; is the quiet performance win. When a browser revalidates with &lt;code&gt;If-None-Match&lt;/code&gt; or &lt;code&gt;If-Modified-Since&lt;/code&gt; and your ETag or timestamp still matches, a 304 sends no body at all. On repeat visits this is the difference between transferring 200 KB and transferring 200 bytes.&lt;/p&gt;

&lt;h2&gt;
  
  
  4xx — client errors, and the two everyone confuses
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;401 Unauthorized&lt;/code&gt; means "you are not authenticated" — no valid credentials were presented. &lt;code&gt;403 Forbidden&lt;/code&gt; means "I know who you are, and you are not allowed." Returning 403 for a logged-out user sends them in circles; returning 401 when permissions are the problem sends them to re-login for no reason. The names are misleading (401 should have been called Unauthenticated), but the distinction matters for client retry logic.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;400 Bad Request&lt;/code&gt; — malformed syntax; the request could not be parsed at all.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;404 Not Found&lt;/code&gt; — no resource at this URL. For APIs, also correct when the ID does not exist; do not return 200 with an error body.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;409 Conflict&lt;/code&gt; — the request collides with current state, like creating a username that exists or editing a stale version of a record.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;413 Payload Too Large&lt;/code&gt; — body exceeds the server limit; check nginx &lt;code&gt;client_max_body_size&lt;/code&gt; and your platform's cap before blaming app code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;415 Unsupported Media Type&lt;/code&gt; — wrong &lt;code&gt;Content-Type&lt;/code&gt;, usually JSON sent as form data or vice versa.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;422 Unprocessable Content&lt;/code&gt; — syntactically valid JSON that fails validation. Preferred over 400 for field-level errors in modern APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;429 Too Many Requests&lt;/code&gt; — rate limited. Always pair it with a &lt;code&gt;Retry-After&lt;/code&gt; header so well-behaved clients back off instead of hammering.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5xx — server errors, and which service to blame
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;500 Internal Server Error&lt;/code&gt; is the generic "code threw an exception." &lt;code&gt;502 Bad Gateway&lt;/code&gt; means a proxy (nginx, a load balancer, Cloudflare) got an invalid response from the upstream — the app server answered badly or crashed mid-response. &lt;code&gt;503 Service Unavailable&lt;/code&gt; means the server is alive but refusing work: overload, maintenance mode, or a deploy in progress; send &lt;code&gt;Retry-After&lt;/code&gt; with it. &lt;code&gt;504 Gateway Timeout&lt;/code&gt; means the proxy waited and the upstream never answered — the request is probably still running somewhere.&lt;/p&gt;

&lt;p&gt;The practical split: 502 says "the upstream talked nonsense," 504 says "the upstream said nothing." If you see 504s during traffic spikes, look at slow queries and worker pools, not crashes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick reference: the 15 codes worth memorizing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;What it means in practice&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;| &lt;code&gt;200&lt;/code&gt; | OK | Standard success with a body |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;201&lt;/code&gt; | Created | POST made a new resource; check Location header |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;204&lt;/code&gt; | No Content | Success, nothing to return |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;301&lt;/code&gt; | Moved Permanently | URL is gone for good; SEO transfers |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;304&lt;/code&gt; | Not Modified | Cache is fresh; no body sent |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;308&lt;/code&gt; | Permanent Redirect | 301 that keeps the request method |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;400&lt;/code&gt; | Bad Request | Unparseable request syntax |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;401&lt;/code&gt; | Unauthorized | Not logged in (or bad credentials) |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;403&lt;/code&gt; | Forbidden | Logged in, but not allowed |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;404&lt;/code&gt; | Not Found | No resource at this URL |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;409&lt;/code&gt; | Conflict | Collides with current state |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;422&lt;/code&gt; | Unprocessable Content | Valid JSON, failed validation |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;429&lt;/code&gt; | Too Many Requests | Rate limited; respect Retry-After |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;502&lt;/code&gt; | Bad Gateway | Upstream sent an invalid response |&lt;/p&gt;

&lt;p&gt;| &lt;code&gt;503&lt;/code&gt; | Service Unavailable | Overloaded or in maintenance |&lt;/p&gt;

&lt;h2&gt;
  
  
  A debugging habit that pays off
&lt;/h2&gt;

&lt;p&gt;When an integration fails, read the status code before the error message. The code tells you whose problem it is and whether a retry will help: 4xx means fix the request (retrying unchanged is pointless), 429 means retry later with backoff, 5xx means retry soon but alert if it persists. Half of API debugging is just honoring that split.&lt;/p&gt;

&lt;p&gt;Need the full list, searchable, with what triggers each code and when to use it? Our &lt;a href="https://www.devbench.co.in/tools/http-status-reference" rel="noopener noreferrer"&gt;HTTP Status Reference&lt;/a&gt; covers every code from 100 to 599, free and in your browser.&lt;/p&gt;

&lt;p&gt;Related reading: &lt;a href="https://www.devbench.co.in/blog/jwt-explained" rel="noopener noreferrer"&gt;how JWT authentication works&lt;/a&gt; (the source of many 401s), &lt;br&gt;
&lt;a href="https://www.devbench.co.in/blog/common-json-errors" rel="noopener noreferrer"&gt;the JSON mistakes behind most 400s&lt;/a&gt;, and &lt;br&gt;
&lt;a href="https://www.devbench.co.in/blog/url-encoding-explained" rel="noopener noreferrer"&gt;URL encoding&lt;/a&gt; for the 414s and malformed-query 400s.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post originally appeared on the &lt;a href="https://www.devbench.co.in/blog/http-status-codes-explained" rel="noopener noreferrer"&gt;DevBench blog&lt;/a&gt;. DevBench is a free collection of 183+ browser-based developer tools, including a &lt;a href="https://www.devbench.co.in/tools/url-encode" rel="noopener noreferrer"&gt;URL Encoder&lt;/a&gt; that shows exactly how each character encodes.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>api</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Git Rebase vs Merge: What Each Actually Does, and the One Rule That Keeps Rebase Safe</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:32:13 +0000</pubDate>
      <link>https://dev.to/saibhargav/git-rebase-vs-merge-what-each-actually-does-and-the-one-rule-that-keeps-rebase-safe-31ei</link>
      <guid>https://dev.to/saibhargav/git-rebase-vs-merge-what-each-actually-does-and-the-one-rule-that-keeps-rebase-safe-31ei</guid>
      <description>&lt;p&gt;Every team eventually has the argument: should feature branches merge or rebase onto main? The honest answer is that both are right, for different jobs. Merge preserves history exactly as it happened. Rebase rewrites history into a straight line. The trouble starts when someone rebases a branch other people have pulled, or merges everything and turns the log into spaghetti. This guide explains what each one actually does to your commits, when to use which, and the one rule that keeps rebase safe.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a merge really does
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git merge feature&lt;/code&gt; takes the two branch tips and their common ancestor and creates a &lt;strong&gt;merge commit&lt;/strong&gt; with two parents. Nothing that already existed changes: every commit keeps its original hash, author, and timestamp. The history is a faithful record, including the fact that work happened in parallel.&lt;/p&gt;

&lt;p&gt;The cost is shape. On a busy repo where everyone merges their feature branches into main, the log becomes a braid of crossing lines, and &lt;code&gt;git log&lt;/code&gt; fills up with "Merge branch 'x' into main" commits that carry no information. &lt;code&gt;git log --first-parent&lt;/code&gt; helps, but the underlying graph is still noisy.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a rebase really does
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git rebase main&lt;/code&gt; takes your branch's commits, temporarily sets them aside, fast-forwards your branch to main's tip, then &lt;strong&gt;replays your commits one by one on top&lt;/strong&gt;. Each replayed commit is a new commit: same changes and same message, but a new hash and a new committer date. When it finishes, your branch looks like you started from the latest main all along.&lt;/p&gt;

&lt;p&gt;The payoff is a linear history: every feature lands as a clean sequence of commits, &lt;code&gt;git log&lt;/code&gt; reads like a changelog, and &lt;code&gt;git bisect&lt;/code&gt; works without navigating merge commits. The danger is exactly the thing that makes it work: it rewrites commits.&lt;/p&gt;

&lt;h2&gt;
  
  
  The golden rule of rebase
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Never rebase commits that exist anywhere outside your local repo.&lt;/strong&gt; If you pushed a branch and a teammate pulled it, rebasing it gives the same logical commits new hashes. Their copy and yours now disagree about history, and the next pull merges the old and new versions together, duplicating every commit. This is the accident that gives rebase its scary reputation.&lt;/p&gt;

&lt;p&gt;The safe scope for rebase is work only you have: your local branch, or a feature branch that is genuinely yours alone. If you do rebase a branch you already pushed, the push needs &lt;code&gt;--force-with-lease&lt;/code&gt;, which refuses to overwrite the remote if someone else added commits since your last fetch. Plain &lt;code&gt;--force&lt;/code&gt; skips that check; there is almost never a reason to use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical workflow that uses both
&lt;/h2&gt;

&lt;p&gt;The common pattern in teams that like clean history:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;While you work:&lt;/strong&gt; rebase your feature branch onto main regularly (&lt;code&gt;git fetch &amp;amp;&amp;amp; git rebase origin/main&lt;/code&gt;) so it stays current and conflicts arrive in small, understandable doses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Before opening the PR:&lt;/strong&gt; optionally &lt;code&gt;git rebase -i&lt;/code&gt; to squash fixup commits, so reviewers see the story, not your typos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Landing the PR:&lt;/strong&gt; merge it (or squash-merge, which is a different beast: GitHub builds one new commit from the whole branch) so the main branch records when the feature actually landed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On shared long-lived branches&lt;/strong&gt; (main, release branches): merge only. Rebase never touches these.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conflicts: the real difference in feel
&lt;/h2&gt;

&lt;p&gt;With a merge you resolve every conflict &lt;strong&gt;once&lt;/strong&gt;, in the merge commit. With a rebase you resolve conflicts &lt;strong&gt;per replayed commit&lt;/strong&gt;, in the order they were written. If three of your commits all touch the same lines that changed on main, you may resolve the same hunk three times, but each resolution is small and sits next to the commit that caused it. &lt;code&gt;git rerere&lt;/code&gt; (reuse recorded resolution) remembers how you resolved a conflict and applies it automatically next time; turn it on if you rebase often.&lt;/p&gt;

&lt;p&gt;Mid-rebase you have three exits: fix and &lt;code&gt;git rebase --continue&lt;/code&gt;, skip the commit with &lt;code&gt;--skip&lt;/code&gt;, or bail out entirely with &lt;code&gt;git rebase --abort&lt;/code&gt;, which puts your branch back exactly as it was. Abort is the feature that makes rebasing safe to learn on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interactive rebase in three commands
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git rebase -i HEAD~5&lt;/code&gt; opens the last five commits in your editor. Change &lt;code&gt;pick&lt;/code&gt; to &lt;code&gt;reword&lt;/code&gt; to fix a message, &lt;code&gt;squash&lt;/code&gt; to fold a commit into the one above it, or &lt;code&gt;drop&lt;/code&gt; to delete it. Save and git rewrites the sequence. This is how "wip", "fix", "actually fix" becomes one presentable commit, and it only touches commits that are already yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Merge&lt;/th&gt;
&lt;th&gt;Rebase&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rewrites existing commits?&lt;/td&gt;
&lt;td&gt;Never&lt;/td&gt;
&lt;td&gt;Yes (new hashes)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;History shape&lt;/td&gt;
&lt;td&gt;True graph, can get noisy&lt;/td&gt;
&lt;td&gt;Linear, reads like a changelog&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safe on shared branches?&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No, never&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Conflict resolution&lt;/td&gt;
&lt;td&gt;Once, at the merge&lt;/td&gt;
&lt;td&gt;Per replayed commit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Undo path&lt;/td&gt;
&lt;td&gt;Revert the merge commit&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--abort&lt;/code&gt; mid-way, reflog after&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Landing PRs, shared branches&lt;/td&gt;
&lt;td&gt;Updating and cleaning your own branch&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  When it goes wrong anyway
&lt;/h2&gt;

&lt;p&gt;If you rebased something you should not have, or lost a commit in an interactive rebase, &lt;code&gt;git reflog&lt;/code&gt; is the safety net: it records everywhere HEAD has been, including the state before the rebase. Find the pre-rebase entry and &lt;code&gt;git reset --hard&lt;/code&gt; to it. Commits are almost never truly lost; they are just unreferenced for a while.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post originally appeared on the &lt;a href="https://www.devbench.co.in/blog/git-rebase-vs-merge-explained" rel="noopener noreferrer"&gt;DevBench blog&lt;/a&gt;. DevBench is a free collection of 183+ browser-based developer tools, including a &lt;a href="https://www.devbench.co.in/tools/hash-generator" rel="noopener noreferrer"&gt;Hash Generator&lt;/a&gt; that shows the SHA family git uses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>WebSocket vs Polling: How Real-Time Features Actually Work (and When Polling Is Fine)</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:31:05 +0000</pubDate>
      <link>https://dev.to/saibhargav/websocket-vs-polling-how-real-time-features-actually-work-and-when-polling-is-fine-h65</link>
      <guid>https://dev.to/saibhargav/websocket-vs-polling-how-real-time-features-actually-work-and-when-polling-is-fine-h65</guid>
      <description>&lt;p&gt;HTTP has one awkward limitation: the server can never start the conversation. Every response needs a request first. That works fine for pages and APIs, but the moment you build a live dashboard, a chat, a multiplayer game, or a "someone is typing" indicator, you need the server to push news to the client the instant it happens. There are four ways people solve this: short polling, long polling, Server-Sent Events, and WebSocket. This guide explains how each one actually works, what it costs, and how to choose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Short polling: ask over and over
&lt;/h2&gt;

&lt;p&gt;Short polling is the brute-force answer: the client fires a request every few seconds and asks "anything new?". Most of the time the answer is no.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/api/messages"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is simple, stateless, and works through every proxy and firewall on earth. The cost is waste: if updates arrive once a minute and you poll every 5 seconds, roughly 11 out of 12 requests return nothing. Each one still pays the full price of connection setup, TLS, authentication, and a database query. Multiply by a few thousand connected users and you are running a self-inflicted DDoS for data that has not changed.&lt;/p&gt;

&lt;p&gt;Updates also arrive late by up to the poll interval, and every client sees them at a different moment. For a notification badge, fine. For a stock ticker, unusable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Long polling: ask, then wait
&lt;/h2&gt;

&lt;p&gt;Long polling flips the timing. The client sends a request and the server &lt;strong&gt;holds it open&lt;/strong&gt; instead of answering immediately. When new data arrives, the server finally responds; the client processes it and immediately opens the next request. If nothing happens within a timeout (usually 30-60 seconds), the server responds empty and the client reconnects.&lt;/p&gt;

&lt;p&gt;Now every response carries real news, and latency drops to near zero because a request is always parked on the server waiting. The costs move server-side: each waiting client ties up a connection (and on naive stacks, a thread or worker), and you need careful timeout handling so load balancers do not kill the parked request early. It also still creates a fresh HTTP request per message burst, so chatty streams are inefficient. Long polling was the backbone of early web chat and still survives as a fallback in libraries like Socket.IO.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server-Sent Events: a one-way firehose
&lt;/h2&gt;

&lt;p&gt;Server-Sent Events (SSE) are the underused middle option. The client opens one ordinary HTTP request and the server never finishes it: it keeps the response open and streams events down as text, one &lt;code&gt;data:&lt;/code&gt; block at a time. The browser's &lt;code&gt;EventSource&lt;/code&gt; API handles parsing and, crucially, &lt;strong&gt;reconnects automatically&lt;/strong&gt; with the last event ID.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;EventSource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/api/stock-feed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onmessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;tick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;updatePrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tick&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SSE is just HTTP, so it works with standard proxies, auth headers are tricky but cookies work, and it needs no special server framework. Its limits: it is strictly server-to-client (the client talks back over ordinary fetch calls), it is text-only, and browsers cap HTTP/1.1 connections per domain (six), which a few open SSE streams can eat into. For feeds, notifications, live logs, and progress bars, SSE is often the right answer and far simpler than WebSocket.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebSocket: a real two-way channel
&lt;/h2&gt;

&lt;p&gt;WebSocket is a different protocol that starts life as HTTP. The client sends a normal request with an &lt;code&gt;Upgrade: websocket&lt;/code&gt; header; if the server agrees, it replies &lt;code&gt;101 Switching Protocols&lt;/code&gt; and the TCP connection stops speaking HTTP at all. From then on both sides send lightweight frames whenever they want, in either direction, with a few bytes of overhead per message instead of full HTTP headers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;GET&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt;
&lt;span class="nc"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
&lt;span class="nc"&gt;Upgrade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;websocket&lt;/span&gt;
&lt;span class="nc"&gt;Connection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Upgrade&lt;/span&gt;
&lt;span class="na"&gt;Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;
&lt;span class="nc"&gt;Sec&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WebSocket&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;

&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt; &lt;span class="mi"&gt;101&lt;/span&gt; &lt;span class="nc"&gt;Switching&lt;/span&gt; &lt;span class="nc"&gt;Protocols&lt;/span&gt;
&lt;span class="nc"&gt;Upgrade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;websocket&lt;/span&gt;
&lt;span class="nc"&gt;Connection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Upgrade&lt;/span&gt;
&lt;span class="na"&gt;Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser side is a small API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ws&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;WebSocket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"wss://example.com/chat"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onopen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"join"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"general"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onmessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;showMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onclose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;scheduleReconnect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// sockets do not reconnect on their own&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A minimal server with the &lt;code&gt;ws&lt;/code&gt; package in Node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;WebSocketServer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"ws"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;wss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;WebSocketServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;wss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"connection"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// broadcast to everyone else&lt;/span&gt;
    &lt;span class="n"&gt;wss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;clients&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note &lt;code&gt;wss://&lt;/code&gt; in the client URL: it is the TLS version, and you should treat plain &lt;code&gt;ws://&lt;/code&gt; as development-only, exactly like HTTP vs HTTPS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side by side
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Short polling&lt;/th&gt;
&lt;th&gt;Long polling&lt;/th&gt;
&lt;th&gt;SSE&lt;/th&gt;
&lt;th&gt;WebSocket&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Direction&lt;/td&gt;
&lt;td&gt;Client pulls&lt;/td&gt;
&lt;td&gt;Client pulls&lt;/td&gt;
&lt;td&gt;Server pushes&lt;/td&gt;
&lt;td&gt;Both ways&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency&lt;/td&gt;
&lt;td&gt;Up to the interval&lt;/td&gt;
&lt;td&gt;Near zero&lt;/td&gt;
&lt;td&gt;Near zero&lt;/td&gt;
&lt;td&gt;Near zero&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overhead per message&lt;/td&gt;
&lt;td&gt;Full HTTP request&lt;/td&gt;
&lt;td&gt;Full HTTP request per burst&lt;/td&gt;
&lt;td&gt;Tiny text frame&lt;/td&gt;
&lt;td&gt;A few bytes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Auto-reconnect&lt;/td&gt;
&lt;td&gt;N/A (always retries)&lt;/td&gt;
&lt;td&gt;You build it&lt;/td&gt;
&lt;td&gt;Built in&lt;/td&gt;
&lt;td&gt;You build it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Binary data&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No (text only)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Proxy/firewall friendly&lt;/td&gt;
&lt;td&gt;Perfectly&lt;/td&gt;
&lt;td&gt;Mostly&lt;/td&gt;
&lt;td&gt;Mostly&lt;/td&gt;
&lt;td&gt;Sometimes blocked&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server complexity&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Highest&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How to choose
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Updates every minute or more, one screen, low stakes:&lt;/strong&gt; short polling. An interval fetch behind &lt;code&gt;setInterval&lt;/code&gt; or SWR/React Query's &lt;code&gt;refetchInterval&lt;/code&gt; is boring and correct. Do not over-engineer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server-to-client stream only&lt;/strong&gt; (feeds, notifications, live logs, progress): SSE. One endpoint, automatic reconnection, plain HTTP infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Both sides talk frequently&lt;/strong&gt; (chat, collaborative editing, multiplayer, live cursors): WebSocket. The bidirectional, low-overhead channel is what it was built for.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Must work through hostile corporate proxies, or as a fallback:&lt;/strong&gt; long polling, or let Socket.IO negotiate for you (it starts on long polling and upgrades to WebSocket when it can).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The gotchas that bite in production
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Idle timeouts kill connections.&lt;/strong&gt; Load balancers and proxies (nginx, Cloudflare, AWS ALB) close connections that look idle, often after 60 seconds. Send a ping/heartbeat every 20-30 seconds, or your "real-time" channel silently dies whenever traffic pauses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WebSocket does not reconnect.&lt;/strong&gt; Networks drop, laptops sleep, mobile radios switch towers. Implement reconnect with exponential backoff and jitter, and replay any state the client missed while it was gone. SSE does this for you; WebSocket does not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auth happens at the handshake.&lt;/strong&gt; A WebSocket connection is authenticated once, at the HTTP upgrade request, usually with a cookie or a short-lived token in the query string. If the session expires at 2 PM, the open socket does not notice. Decide how your server handles expiry mid-connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scaling past one server is a design problem.&lt;/strong&gt; With polling, any server can answer any request. With WebSocket or SSE, the connection lives on one specific server: you need sticky sessions at the load balancer, and a pub/sub layer (Redis, NATS, Kafka) so a message produced on server A reaches clients connected to server B. Plan for this before launch day, not after.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post originally appeared on the &lt;a href="https://www.devbench.co.in/blog/websocket-vs-polling" rel="noopener noreferrer"&gt;DevBench blog&lt;/a&gt;. DevBench is a free collection of 183+ browser-based developer tools, including a &lt;a href="https://www.devbench.co.in/tools/json-formatter" rel="noopener noreferrer"&gt;JSON Formatter&lt;/a&gt; for reading raw socket frames.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>I Built 100+ Free Developer Tools That Run Entirely in Your Browser — Here's Why</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Wed, 20 May 2026 07:52:01 +0000</pubDate>
      <link>https://dev.to/saibhargav/i-built-100-free-developer-tools-that-run-entirely-in-your-browser-heres-why-22jb</link>
      <guid>https://dev.to/saibhargav/i-built-100-free-developer-tools-that-run-entirely-in-your-browser-heres-why-22jb</guid>
      <description>&lt;p&gt;I was debugging an authentication issue at 11pm when I caught myself pasting a production JWT token into a random online decoder.&lt;/p&gt;

&lt;p&gt;The token contained user IDs, roles, and expiry claims. The site had no privacy policy. I had no idea where that token was going.&lt;/p&gt;

&lt;p&gt;I closed the tab, fixed the bug using &lt;code&gt;console.log&lt;/code&gt;, and spent the next few weeks building &lt;a href="https://devbench.co.in" rel="noopener noreferrer"&gt;DevBench&lt;/a&gt; — a toolbox where nothing you paste ever leaves your browser.&lt;/p&gt;




&lt;h2&gt;
  
  
  What DevBench is
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://devbench.co.in" rel="noopener noreferrer"&gt;DevBench&lt;/a&gt; is a collection of 135 free developer utilities, all running client-side in the browser using JavaScript and the Web Crypto API. No account. No upload queue. No server receives your data.&lt;/p&gt;

&lt;p&gt;Here's what's available today:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSON tools (12)&lt;/strong&gt;&lt;br&gt;
Format, validate, minify, diff, tree view, JSON↔YAML, JSON↔CSV, JSON↔TypeScript, JSON Schema validation, AES-256-GCM encryption, NDJSON parser, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dev utilities (36)&lt;/strong&gt;&lt;br&gt;
JWT decoder + encoder (HS256/384/512 via Web Crypto), regex tester, SQL formatter, cURL-to-fetch converter, UUID/ULID/NanoID generator, hash generator (SHA-1/256/384/512), color converter, QR code generator, CSS box-shadow builder, Linux command reference, HTTP status codes reference, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encoding (13)&lt;/strong&gt;&lt;br&gt;
Base64 encode/decode, URL encode/decode, HTML entities, Hex, Binary, ROT13, Morse code — all client-side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PDF tools (14)&lt;/strong&gt;&lt;br&gt;
Compress, merge, split, rotate, watermark, convert PDF to Word/Excel/images — processed locally using PDF.js and pdf-lib.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Text tools (18)&lt;/strong&gt;&lt;br&gt;
Diff checker, markdown preview, case converter, string inspector, Lorem ipsum generator, Unicode checker, word counter, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Image tools (6)&lt;/strong&gt;&lt;br&gt;
Background remover (WASM ML model), resizer, compressor, format converter, EXIF viewer — no pixels leave your device.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plus&lt;/strong&gt; conversion tools, finance calculators, health calculators, math tools, and date/time utilities.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why "runs in your browser" actually matters
&lt;/h2&gt;

&lt;p&gt;Most of us paste sensitive data into online tools without thinking about it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JWT tokens containing user roles and session claims&lt;/li&gt;
&lt;li&gt;API responses with PII or internal service data&lt;/li&gt;
&lt;li&gt;Hashed passwords (even hashes can be revealing)&lt;/li&gt;
&lt;li&gt;Private SSH keys into format converters&lt;/li&gt;
&lt;li&gt;Confidential PDFs into compression tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every tool that sends your data to a server is a potential data exposure. It doesn't require malice — even accidental logging, misconfigured S3 buckets, or a breach of the tool's database can expose data you thought was "just being formatted."&lt;/p&gt;

&lt;p&gt;DevBench uses the &lt;strong&gt;Web Crypto API&lt;/strong&gt; for all cryptographic operations (JWT verification, AES encryption, hashing) so the computation happens in your browser's secure context. For PDF processing, we use pdf-lib compiled to WebAssembly. For the AI background remover, the ML model runs via WASM entirely on your device.&lt;/p&gt;

&lt;p&gt;The tradeoff is that we can't support files over ~50MB on some operations (browser memory limits), and very complex operations can be slower than server-side equivalents. For most developer use cases — debugging a JWT, formatting a JSON response, compressing a PDF — the browser is fast enough.&lt;/p&gt;




&lt;h2&gt;
  
  
  The tech stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Framework:&lt;/strong&gt; Next.js 16 (App Router) with Turbopack&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI:&lt;/strong&gt; React 19, Tailwind CSS v4&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cryptography:&lt;/strong&gt; Web Crypto API (native browser API, no third-party crypto library)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PDF processing:&lt;/strong&gt; pdf-lib + PDF.js&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI background removal:&lt;/strong&gt; WASM ML model (runs locally)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosting:&lt;/strong&gt; Vercel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repo:&lt;/strong&gt; &lt;a href="https://github.com/SaiBhargavRallapalli/all-in-one" rel="noopener noreferrer"&gt;github.com/SaiBhargavRallapalli/all-in-one&lt;/a&gt; (MIT License)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The repo is fully open source with Playwright e2e tests, Vitest unit tests, GitHub Actions CI, and Lighthouse CI enforcing performance budgets.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I learned building 135 tools in one codebase
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Single tool registry was the right call.&lt;/strong&gt; Every tool is defined in a central &lt;code&gt;tools-registry.ts&lt;/code&gt; with metadata (name, slug, description, category, keywords). New tools are one registry entry + one component. The &lt;code&gt;/tools/[slug]&lt;/code&gt; dynamic route handles metadata, schema markup, and layout automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client-side PDF is harder than it looks.&lt;/strong&gt; The Web APIs are powerful but quirky. PDF rendering fidelity varies by browser. Font embedding is a consistent pain point. Plan for 2–3x more time than you'd expect on any PDF feature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Topical authority matters more than I expected.&lt;/strong&gt; Writing blog content around each tool category (not just building the tools) is what gets the pages indexed and ranked. Tools without supporting content are invisible to search engines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web Crypto API is genuinely excellent.&lt;/strong&gt; The &lt;code&gt;crypto.subtle&lt;/code&gt; API covers HMAC signing, AES-GCM encryption, RSA operations, and secure random generation natively in every modern browser. No &lt;code&gt;crypto-js&lt;/code&gt;, no &lt;code&gt;forge&lt;/code&gt;, no external dependencies. Smaller bundle, better security.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;VS Code extension to open DevBench tools from the command palette&lt;/li&gt;
&lt;li&gt;Pro tier (ad-free, file upload history, API access)&lt;/li&gt;
&lt;li&gt;More language/framework-specific tools (TypeScript playground, SQL query builder, regex with named groups UI)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have a tool you reach for constantly that isn't here — &lt;a href="https://github.com/SaiBhargavRallapalli/all-in-one/issues" rel="noopener noreferrer"&gt;open an issue&lt;/a&gt;. The contributing guide is at &lt;code&gt;CONTRIBUTING.md&lt;/code&gt; and the first-contribution list has approachable tasks.&lt;/p&gt;

&lt;p&gt;And if the privacy-first, client-side approach resonates with you — share it with your team. The JWT debugger specifically is worth bookmarking as an alternative to jwt.io for anything involving real tokens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://devbench.co.in" rel="noopener noreferrer"&gt;&lt;strong&gt;Try DevBench →&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>opensource</category>
      <category>devtools</category>
    </item>
    <item>
      <title>5 browser-based dev tools I use instead of bookmarking 10 different sites tags: webdev, tools, productivity, javascript</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Wed, 06 May 2026 18:05:33 +0000</pubDate>
      <link>https://dev.to/saibhargav/5-browser-based-dev-tools-i-use-instead-of-bookmarking-10-different-sites-tags-webdev-tools-2e0p</link>
      <guid>https://dev.to/saibhargav/5-browser-based-dev-tools-i-use-instead-of-bookmarking-10-different-sites-tags-webdev-tools-2e0p</guid>
      <description>&lt;p&gt;Every developer has a graveyard of bookmarked tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One site for JWT decoding&lt;/li&gt;
&lt;li&gt;Another for JSON formatting
&lt;/li&gt;
&lt;li&gt;A third for Base64&lt;/li&gt;
&lt;li&gt;A fourth for Regex testing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I got tired of context-switching and built them all into one place: &lt;br&gt;
&lt;a href="https://www.devbench.co.in" rel="noopener noreferrer"&gt;DevBench&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the 5 I use most:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. JWT Debugger
&lt;/h2&gt;

&lt;p&gt;Paste any token → see header, payload, signature decoded instantly. &lt;br&gt;
Shows expiry in local time, not UTC.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. JSON Formatter
&lt;/h2&gt;

&lt;p&gt;Validates + formats + highlights exactly where your JSON broke and why.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Base64 Encoder/Decoder
&lt;/h2&gt;

&lt;p&gt;Handles both text and file input. Shows byte size before/after.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Regex Tester
&lt;/h2&gt;

&lt;p&gt;Live match highlighting with a breakdown of what each part of your &lt;br&gt;
pattern does in plain English.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. UUID Generator
&lt;/h2&gt;

&lt;p&gt;Generates v4 UUIDs, ULIDs, and NanoIDs — all explained with &lt;br&gt;
use-case differences.&lt;/p&gt;

&lt;p&gt;Everything runs in the browser. No login, no data sent anywhere, &lt;br&gt;
works offline after first load.&lt;/p&gt;

&lt;p&gt;What tools do you keep open all day? Drop them below 👇&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>showdev</category>
      <category>tooling</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Mastering RAG: Beyond Simple Retrieval-Augmented Generation</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Wed, 08 Oct 2025 12:39:12 +0000</pubDate>
      <link>https://dev.to/saibhargav/mastering-rag-beyond-simple-retrieval-augmented-generation-3h6k</link>
      <guid>https://dev.to/saibhargav/mastering-rag-beyond-simple-retrieval-augmented-generation-3h6k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Retrieval-Augmented Generation (RAG) has emerged as one of the most transformative approaches in modern AI, bridging the gap between large language models and real-world knowledge systems. By combining the reasoning capabilities of LLMs with dynamic information retrieval, RAG enables applications that are not only intelligent but also grounded in accurate, up-to-date information.&lt;/p&gt;

&lt;p&gt;As organizations race to implement AI solutions, understanding the nuances of RAG—beyond its basic implementation—has become crucial. It's not just about connecting a vector database to an LLM; it's about understanding the architectural patterns, precision challenges, and advanced techniques that separate production-ready systems from proof-of-concepts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Featured RAG Articles from My Medium Profile
&lt;/h2&gt;

&lt;p&gt;I've been deeply exploring RAG architectures and their practical implementations. Here are some of my key insights that challenge conventional thinking and offer practical solutions:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The RAG Precision Trap: Why Semantic Search Alone Will Always Fail
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://medium.com/everyday-ai/the-rag-precision-trap-why-semantic-search-alone-will-always-fail-b97e19bb96a1" rel="noopener noreferrer"&gt;Read the full article →&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Semantic search is powerful, but it's not enough. This article dives into why relying solely on vector similarity can lead to catastrophic failures in production RAG systems. I explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The fundamental limitations of semantic search in enterprise contexts&lt;/li&gt;
&lt;li&gt;Real-world scenarios where similarity-based retrieval falls short&lt;/li&gt;
&lt;li&gt;Hybrid approaches that combine semantic and lexical search&lt;/li&gt;
&lt;li&gt;Practical strategies to improve retrieval precision without sacrificing recall&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you've ever wondered why your RAG system returns "relevant" but ultimately unhelpful results, this article reveals the underlying issues and proven solutions.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. You Don't Know RAG. You Know Simple RAG.
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://medium.com/everyday-ai/you-dont-know-rag-you-know-simple-rag-2a089df087b9" rel="noopener noreferrer"&gt;Read the full article →&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most tutorials teach "Simple RAG"—a basic pattern that rarely works in production. This article explores the evolution from naive implementations to sophisticated, production-grade RAG architectures. Topics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The limitations of the naive RAG approach&lt;/li&gt;
&lt;li&gt;Advanced RAG patterns: query transformation, multi-stage retrieval, and re-ranking&lt;/li&gt;
&lt;li&gt;Agentic RAG and self-correcting retrieval loops&lt;/li&gt;
&lt;li&gt;Evaluation frameworks for measuring RAG effectiveness&lt;/li&gt;
&lt;li&gt;Real-world case studies and architectural decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is essential reading for anyone serious about deploying RAG in production environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why These Topics Matter
&lt;/h2&gt;

&lt;p&gt;The RAG landscape is evolving rapidly. What worked six months ago might be considered an anti-pattern today. By understanding these advanced concepts, you'll be better equipped to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build RAG systems that actually work in production&lt;/li&gt;
&lt;li&gt;Avoid common pitfalls that waste time and resources&lt;/li&gt;
&lt;li&gt;Make informed architectural decisions based on your specific use case&lt;/li&gt;
&lt;li&gt;Stay ahead of the curve as RAG continues to evolve&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Explore More on Medium
&lt;/h2&gt;

&lt;p&gt;These articles are just the beginning. I regularly publish in-depth technical content exploring AI architectures, practical implementations, and emerging patterns in the generative AI space.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit my Medium profile for more insights and innovations:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;a href="https://medium.com/@saibhargavr" rel="noopener noreferrer"&gt;https://medium.com/@saibhargavr&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You'll find detailed technical breakdowns, architectural patterns, and practical guides that go beyond surface-level explanations.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Have questions about RAG or want to discuss these concepts further? Feel free to reach out or leave a comment below!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rag</category>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>You Don't Know RAG. You Know Simple RAG.</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Tue, 07 Oct 2025 07:52:08 +0000</pubDate>
      <link>https://dev.to/saibhargav/you-dont-know-rag-you-know-simple-rag-4mi8</link>
      <guid>https://dev.to/saibhargav/you-dont-know-rag-you-know-simple-rag-4mi8</guid>
      <description>&lt;h2&gt;
  
  
  Hey DEV Community! 👋
&lt;/h2&gt;

&lt;p&gt;If you've been working with AI and large language models, you've probably heard that &lt;strong&gt;Retrieval-Augmented Generation (RAG)&lt;/strong&gt; is the secret sauce for making AI smarter and more up-to-date. The concept is straightforward: instead of relying solely on pre-trained knowledge, your AI fetches real-time data from a database to answer questions. It's like giving a student an open-book exam.&lt;/p&gt;

&lt;p&gt;But here's what most developers miss: &lt;strong&gt;RAG isn't just one technique&lt;/strong&gt;. It's an entire family of architectural patterns, each designed for specific use cases. If you're only using the basic version, you're leaving serious power on the table.&lt;/p&gt;

&lt;p&gt;Let me break down the different RAG architectures and show you when to use each one.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Simple RAG: The Foundation
&lt;/h2&gt;

&lt;p&gt;This is the RAG you're likely familiar with. A user asks a question, the system queries a fixed database, retrieves relevant documents, and the LLM generates an answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Query → Retrieval → LLM → Response&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; FAQ bots, product manuals, or internal knowledge bases. Think of a chatbot answering warranty questions. The information is static and doesn't change often, making Simple RAG efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Want to implement it?&lt;/strong&gt; &lt;a href="https://ai.plainenglish.io/build-a-custom-ai-assistant-with-rag-a-practical-guide-for-developers-938d74d0a16b" rel="noopener noreferrer"&gt;Check out this end-to-end guide&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Simple RAG with Memory: The Conversationalist
&lt;/h2&gt;

&lt;p&gt;What if your AI needs to remember previous questions? This architecture adds a "memory" layer, allowing the model to carry context from past interactions into new retrievals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Query + Past Context → Retrieval → LLM → Response&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Customer support chats or personalized assistants. The model doesn't ask you to repeat yourself, creating a natural, continuous conversation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Implementation guide:&lt;/strong&gt; &lt;a href="https://pub.towardsai.net/how-to-build-agentic-rag-a-step-by-step-guide-to-intelligent-retrieval-augmented-generationtaking-c9dfbfeadbc3" rel="noopener noreferrer"&gt;E2E tutorial here&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Branched RAG: The Specialist
&lt;/h2&gt;

&lt;p&gt;Instead of searching one massive database, Branched RAG first decides which data source is most relevant, then retrieves from there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Query → Choose Data Source (API, Database, etc.) → Retrieval → LLM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Legal research tools or complex enterprise systems. Imagine a system that distinguishes between legal and financial questions and automatically searches the correct specialized database. This reduces noise and improves accuracy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deep dive:&lt;/strong&gt; &lt;a href="https://ai.plainenglish.io/how-to-route-queries-dynamically-in-ai-apps-using-langgraph-rag-llms-5da3516b75fa" rel="noopener noreferrer"&gt;Implementation tutorial&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  4. HyDe (Hypothetical Document Embedding): The Creative Thinker
&lt;/h2&gt;

&lt;p&gt;This is fascinating. Before searching for real documents, the model generates a "hypothetical document" — a mock answer to the query. It then uses this mock answer to find actual documents that are semantically similar, even if keywords don't match exactly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Query → Generate Hypothetical Document → Use it to search → Retrieval → LLM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Innovation and research settings where queries are abstract or vague. If a scientist asks about a new experimental material, HyDe can create a guide that helps pull real-world studies that are closely related.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Adaptive RAG: The Smart Switcher
&lt;/h2&gt;

&lt;p&gt;This architecture changes its retrieval strategy based on query complexity. Simple question? Quick single lookup. Complex multi-part question? Intensive multi-source search.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Query → Complexity Analysis → Adapt Retrieval Strategy → LLM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Enterprise search platforms. An employee asking for the Wi-Fi password gets an instant answer, while a detailed financial report request triggers a comprehensive search.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn more:&lt;/strong&gt; &lt;a href="https://pub.towardsai.net/adaptive-rag-the-smart-self-correcting-framework-for-complex-ai-queries-414583593907" rel="noopener noreferrer"&gt;Implementation guide&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Corrective RAG (CRAG): The Quality Controller
&lt;/h2&gt;

&lt;p&gt;Mistakes can be costly. CRAG adds quality control by checking retrieved information. If data is irrelevant or low-quality, it can retry the search or find new sources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Retrieval → Check Quality → Retry if Needed → LLM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; High-stakes fields like medicine, finance, and law. It ensures information accuracy before generating responses, which is critical for avoiding errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tutorial:&lt;/strong&gt; &lt;a href="https://pub.towardsai.net/corrective-rag-how-to-build-self-correcting-retrieval-augmented-generation-6dc6db11a145" rel="noopener noreferrer"&gt;E2E implementation&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Self-RAG: The Self-Refining Model
&lt;/h2&gt;

&lt;p&gt;Instead of waiting for user queries, Self-RAG creates its own sub-queries while generating responses. It fills information gaps on the fly, leading to more detailed and comprehensive answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Query → Retrieval → LLM generates and self-evaluates → Creates new sub-queries → Repeats process&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Generating long-form content or complex reports. If you ask for a detailed market analysis, the system continuously refines its search as it writes, bringing in the most up-to-date data.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;The next time you think about RAG, remember it's more than just a simple lookup. It's a versatile toolkit of strategies that can be customized for specific problems. &lt;/p&gt;

&lt;p&gt;By choosing the right architecture, you can build AI applications that are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ More reliable&lt;/li&gt;
&lt;li&gt;✅ More accurate
&lt;/li&gt;
&lt;li&gt;✅ More context-aware&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which RAG architecture have you used? Or are you planning to try one? Drop your thoughts in the comments! 💬&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://medium.com/everyday-ai/you-dont-know-rag-you-know-simple-rag-2a089df087b9" rel="noopener noreferrer"&gt;Medium - Everyday AI&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Mastering LangChain &amp; LangGraph: Your Ultimate Resource Hub</title>
      <dc:creator>Sai Bhargav</dc:creator>
      <pubDate>Mon, 06 Oct 2025 18:16:34 +0000</pubDate>
      <link>https://dev.to/saibhargav/mastering-langchain-langgraph-your-ultimate-resource-hub-2h15</link>
      <guid>https://dev.to/saibhargav/mastering-langchain-langgraph-your-ultimate-resource-hub-2h15</guid>
      <description>&lt;h2&gt;
  
  
  🚀 Introduction
&lt;/h2&gt;

&lt;p&gt;Are you diving into the world of AI development with LangChain and LangGraph? Whether you're a beginner or an experienced developer, having a comprehensive resource hub can make all the difference in your learning journey.&lt;/p&gt;

&lt;h2&gt;
  
  
  📚 What This Resource Hub Offers
&lt;/h2&gt;

&lt;p&gt;I've recently published an extensive article on Medium that serves as &lt;strong&gt;the ultimate reference hub for LangChain and LangGraph&lt;/strong&gt;. This comprehensive guide brings together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Curated Learning Resources&lt;/strong&gt;: Carefully selected tutorials, documentation, and guides&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Practices&lt;/strong&gt;: Real-world patterns and approaches for building AI applications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community Resources&lt;/strong&gt;: Links to forums, discussions, and expert insights&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Examples&lt;/strong&gt;: Practical implementations to jumpstart your projects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Latest Updates&lt;/strong&gt;: Stay current with the rapidly evolving LangChain ecosystem&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💡 Why This Hub Matters
&lt;/h2&gt;

&lt;p&gt;LangChain and LangGraph are powerful frameworks for building AI-powered applications, but navigating the ecosystem can be overwhelming. This resource hub consolidates everything you need in one place, saving you hours of searching and helping you focus on what matters most - building amazing AI applications.&lt;/p&gt;

&lt;p&gt;Whether you're working on chatbots, document analysis, agents, or complex AI workflows, this resource hub provides the foundation you need to succeed.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔗 Read the Full Article
&lt;/h2&gt;

&lt;p&gt;I invite you to check out the complete resource hub on Medium:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://saibhargavr.medium.com/the-ultimate-langchain-langgraph-reference-hub-14d0a4e82b66" rel="noopener noreferrer"&gt;Mastering LangChain &amp;amp; LangGraph: The Ultimate Resource Hub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  📝 Connect &amp;amp; Follow
&lt;/h2&gt;

&lt;p&gt;If you found this helpful, I'd love to connect with you! I regularly share insights on AI development, LangChain, and more on my Medium profile:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://saibhargavr.medium.com/" rel="noopener noreferrer"&gt;Visit My Medium Profile&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feel free to follow me for more articles on AI, machine learning, and software development. I'm always excited to engage with fellow developers and hear about your projects!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What are you building with LangChain? Drop a comment below - I'd love to hear about your experiences!&lt;/em&gt; 🎯&lt;/p&gt;

</description>
      <category>langchain</category>
      <category>ai</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
