<?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: Rahul Agarwal</title>
    <description>The latest articles on DEV Community by Rahul Agarwal (@rahul_agarwal18).</description>
    <link>https://dev.to/rahul_agarwal18</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%2F4006513%2Fa81a0b5b-4624-448e-a7f5-029b67a9a3c9.png</url>
      <title>DEV Community: Rahul Agarwal</title>
      <link>https://dev.to/rahul_agarwal18</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahul_agarwal18"/>
    <language>en</language>
    <item>
      <title>I put a real LLM in my portfolio. It runs on your GPU, not my server.</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Fri, 13 Nov 2026 13:04:45 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/i-put-a-real-llm-in-my-portfolio-it-runs-on-your-gpu-not-my-server-1cj8</link>
      <guid>https://dev.to/rahul_agarwal18/i-put-a-real-llm-in-my-portfolio-it-runs-on-your-gpu-not-my-server-1cj8</guid>
      <description>&lt;p&gt;Every AI-engineer portfolio says "I build with LLMs." I wanted mine to &lt;em&gt;prove&lt;/em&gt; it in the first ten seconds.&lt;/p&gt;

&lt;p&gt;So the chat box on my homepage has a button: &lt;strong&gt;Run a real LLM on your GPU&lt;/strong&gt;. Click it and a 0.5B-parameter model downloads into your browser, boots on your graphics card through WebGPU, and answers questions about my work. No server. No API key. Nothing you type leaves your machine.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Try it:&lt;/strong&gt; &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt; (desktop Chrome or Edge works best)&lt;/p&gt;

&lt;p&gt;Here's how it works, and the four things I got wrong before it worked well.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens when you click the button
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;The page checks for WebGPU and whether your GPU supports 16-bit floats.&lt;/li&gt;
&lt;li&gt;It lazy-loads &lt;a href="https://github.com/mlc-ai/web-llm" rel="noopener noreferrer"&gt;WebLLM&lt;/a&gt; from a CDN (none of this code ships until you ask for it).&lt;/li&gt;
&lt;li&gt;It downloads &lt;strong&gt;Qwen2.5-0.5B-Instruct&lt;/strong&gt; (about 270 MB, 4-bit quantised). Your browser caches it, so the second visit is instant.&lt;/li&gt;
&lt;li&gt;Every question runs a tiny retrieval step over my notes, then the model answers using only what was retrieved.&lt;/li&gt;
&lt;li&gt;Each generated token fires a pulse through the animated neural network behind the hero, so you can literally watch it think.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Loading the model (the part that's easier than you'd expect)
&lt;/h2&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;adapter&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;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gpu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;requestAdapter&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;f16&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;adapter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;features&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'shader-f16'&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;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f16&lt;/span&gt;
  &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'Qwen2.5-0.5B-Instruct-q4f16_1-MLC'&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Qwen2.5-0.5B-Instruct-q4f32_1-MLC'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// fallback for GPUs without fp16&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;webllm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https://cdn.jsdelivr.net/npm/@mlc-ai/web-llm@0.2.86/+esm'&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;engine&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;webllm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CreateMLCEngine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;initProgressCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;updateProgressBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&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;That's it. WebLLM exposes an OpenAI-style API, so streaming looks familiar:&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;chunks&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;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&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="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;160&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="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;await&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;c&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;chunks&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;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textContent&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="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;neural&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fire&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// light up the hero network&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details matter: &lt;strong&gt;pin the CDN version&lt;/strong&gt; (an unpinned import can change under you), and &lt;strong&gt;check for &lt;code&gt;shader-f16&lt;/code&gt;&lt;/strong&gt; instead of assuming it. Plenty of laptop GPUs don't have it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Grounding a 0.5B model with a 30-line RAG
&lt;/h2&gt;

&lt;p&gt;A half-billion-parameter model knows nothing about me and will happily invent things. So it never answers from memory. Every question goes through a retrieval step first:&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="c1"&gt;// Simplified from the real code, which also weights longer keywords higher&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;retrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;question&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;q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&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="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;NOTES&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;note&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;note&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;q&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;k&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;length&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="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&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;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;note&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="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;SYSTEM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`Answer in 1 to 3 short sentences using ONLY the notes provided.
If the notes don't contain the answer, say you don't know.
Never invent companies, numbers, dates or links.`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The notes are a dozen short paragraphs I wrote (projects, stack, experience). Keyword scoring sounds crude next to embeddings, but with a dozen documents it's instant, deterministic and easy to debug. Under every answer the UI shows what it used:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; Where does he work now?&lt;br&gt;
&lt;strong&gt;A:&lt;/strong&gt; Rahul is the sole engineer at Aryan News Agency, where he builds and develops websites and apps.&lt;br&gt;
↳ retrieved 1 note (intro) · 22 tokens in 2.8s · generated on your GPU&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And the test I cared about most:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; What is his favourite food?&lt;br&gt;
&lt;strong&gt;A:&lt;/strong&gt; Rahul is not specifically known for his favorite food.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;No hallucination. Low temperature plus a strict "only the notes" prompt does most of the work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four things I got wrong
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The first answer took 28 seconds
&lt;/h3&gt;

&lt;p&gt;The model loaded fine, but the first question sat there "thinking." WebGPU compiles its shaders lazily, on the first real inference. The fix is a throwaway warm-up generation while the progress bar is still visible:&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;await&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&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="n"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Hi'&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;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&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;Now the slow part happens during loading, where users expect waiting, not after they've asked a question.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. A text animation wrecked my layout score
&lt;/h3&gt;

&lt;p&gt;My headline "decodes" from random glyphs into the real text. It looked great, and it gave the page a &lt;strong&gt;Cumulative Layout Shift of 1.41&lt;/strong&gt; (anything above 0.25 is "poor"). Random glyphs have different widths, so the line re-wrapped about 60 times a second and shoved everything below it around.&lt;/p&gt;

&lt;p&gt;The fix: wrap each word in an inline-block, lock it to its real width, scramble inside it, then unwrap.&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;for&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;w&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;display&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'inline-block'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getBoundingClientRect&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;width&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'px'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// ...animate...then restore plain text nodes&lt;/span&gt;
&lt;span class="n"&gt;words&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="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replaceWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createTextNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&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;Same effect, layout shift &lt;strong&gt;0.00&lt;/strong&gt;. One more catch: measure &lt;em&gt;after&lt;/em&gt; &lt;code&gt;document.fonts.ready&lt;/code&gt;, or you lock in the fallback font's widths.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. My CDN was editing my HTML
&lt;/h3&gt;

&lt;p&gt;I added a strict Content-Security-Policy (hash-based, no &lt;code&gt;unsafe-inline&lt;/code&gt;). Locally: zero violations. In production: errors. My domain was proxied through Cloudflare &lt;em&gt;in front of&lt;/em&gt; Vercel, and Cloudflare was injecting its own inline scripts (analytics and bot detection) and rewriting my email address into an obfuscated link. That put an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; inside my "copy email" &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Switching the DNS records to "DNS only" removed the extra hop and the rewriting. The strict CSP went back on, and the page got faster. &lt;strong&gt;If you put a CDN in front of a platform that's already a CDN, check what it's adding to your pages.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Assuming everyone has WebGPU
&lt;/h3&gt;

&lt;p&gt;Plenty of visitors (many phones, older browsers) can't run the model. The chat works without it: by default it streams pre-written answers token by token, clearly labelled as "scripted mode". The real model is opt-in, behind an explicit button that shows the download size. Nobody gets a 270 MB surprise on mobile data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&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;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Framework&lt;/td&gt;
&lt;td&gt;none: plain HTML, CSS and JavaScript&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTML + CSS + JS over the wire&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;~37 KB&lt;/strong&gt; gzipped&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lighthouse (desktop)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;100 / 100 / 100 / 100&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lighthouse (mobile)&lt;/td&gt;
&lt;td&gt;97 / 100 / 100 / 100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mozilla Observatory&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;A+&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model download (optional)&lt;/td&gt;
&lt;td&gt;~270 MB once, then cached&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No React, no build step. Every heavy thing (the model, the runtime) loads only when someone asks for it, and every animation pauses when it scrolls off screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd do differently
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A 0.5B model is a demo, not a product.&lt;/strong&gt; It's grounded and fast, but its phrasing is sometimes clumsy. With a bigger download budget, a 1.5B model is noticeably better.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keyword retrieval doesn't scale.&lt;/strong&gt; Past a few dozen notes I'd switch to small embeddings computed in the browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;First load is the real UX problem.&lt;/strong&gt; On a slow connection the download takes minutes. The progress bar helps, but caching the model with a service worker before anyone clicks would be smarter.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Have you shipped anything that runs a model fully client-side? I'd love to hear what you used and what broke. Drop it in the comments 👇&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>javascript</category>
      <category>showdev</category>
    </item>
    <item>
      <title>I built a private, offline AI chat you can run with one command: npx unmuzzled</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Fri, 06 Nov 2026 13:09:47 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/i-built-a-private-offline-ai-chat-you-can-run-with-one-command-npx-unmuzzled-1bl</link>
      <guid>https://dev.to/rahul_agarwal18/i-built-a-private-offline-ai-chat-you-can-run-with-one-command-npx-unmuzzled-1bl</guid>
      <description>&lt;p&gt;Most AI chat apps send every prompt to someone else's servers. I wanted the opposite: a chat app where the model runs on &lt;strong&gt;my&lt;/strong&gt; hardware, works offline, and takes one command to start.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx unmuzzled
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's &lt;a href="https://github.com/rahulagarwal18/unmuzzled" rel="noopener noreferrer"&gt;Unmuzzled&lt;/a&gt;. It's open source (MIT), and this post covers how it works and the problems I didn't expect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foyo8ph76jg6936rgm0y7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foyo8ph76jg6936rgm0y7.gif" alt="Unmuzzled streaming a reply from a local 9B model" width="720" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A real run on my laptop. The reasoning streams first, then the answer. Generation is sped up 8×; the real speed (1.7 tok/s) is shown at the end.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Opens a chat UI in your browser. On first run, a setup screen shows the model, its size, your RAM and free disk, and &lt;strong&gt;downloads nothing until you click Download&lt;/strong&gt; (with pause and resume).&lt;/li&gt;
&lt;li&gt;Runs the model locally through &lt;a href="https://github.com/ggml-org/llama.cpp" rel="noopener noreferrer"&gt;llama.cpp&lt;/a&gt; via &lt;a href="https://github.com/withcatai/node-llama-cpp" rel="noopener noreferrer"&gt;node-llama-cpp&lt;/a&gt;, using Vulkan, CUDA or Metal when available.&lt;/li&gt;
&lt;li&gt;Streams answers with Markdown and syntax highlighting, and shows the model's &lt;strong&gt;reasoning&lt;/strong&gt; live in a collapsible, timed panel.&lt;/li&gt;
&lt;li&gt;Supports editing, regenerating and searchable history. Chats are stored only in your browser.&lt;/li&gt;
&lt;li&gt;Works with any GGUF model: &lt;code&gt;npx unmuzzled --model ./your-model.gguf&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why it's different
&lt;/h2&gt;

&lt;p&gt;There are great local-AI tools already. Most of them assume you're comfortable with a terminal, model formats and config files. Unmuzzled is built for the person who just wants a private AI that works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nothing to set up.&lt;/strong&gt; No Python, Docker or config files. One command on desktop, one tap on Android. The app checks your RAM and disk and fetches the right file; you never need to know what "Q4_K_M GGUF" means.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private by design.&lt;/strong&gt; The model runs on your device. After the one-time download it works in airplane mode, and there is no account, telemetry or server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No refusal filters.&lt;/strong&gt; The default model has had its refusal training removed (details below), so it answers questions mainstream assistants decline. That's useful for research, security work and fiction, and it means the judgement is yours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Same experience everywhere.&lt;/strong&gt; The desktop and Android apps share the same design, the same model and the same reasoning view.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The model
&lt;/h2&gt;

&lt;p&gt;The default is a 9B model with an interesting family tree:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Qwen3.5-9B&lt;/strong&gt;, the base model&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jackrong/DeepSeek-V4-Pro-Qwen3.5-9B&lt;/strong&gt;, fine-tuned on ~250k reasoning samples generated by DeepSeek-V4-Pro&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;xtools-at/…-UNCENSORED-heretic&lt;/strong&gt;, with refusal behaviour removed using &lt;a href="https://heretic-project.org" rel="noopener noreferrer"&gt;Heretic&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;mradermacher/…-i1-GGUF&lt;/strong&gt;, quantised to Q4_K_M (5.63 GB)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every step is Apache-2.0. Despite the name, it is &lt;em&gt;not&lt;/em&gt; DeepSeek's model; it's a small Qwen model trained to imitate DeepSeek's reasoning style. Unmuzzled doesn't redistribute the weights; they download straight from Hugging Face.&lt;/p&gt;

&lt;p&gt;Because refusal training has been removed, it answers things other assistants decline, and like any LLM it can be confidently wrong. The README has a responsible-use section, and any model with safety training intact works too.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;The whole thing is deliberately small: no framework and no build step on the desktop side.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/unmuzzled.js   CLI: arguments, setup state, model download, startup
src/server.js      HTTP server, static files, streaming chat API (SSE)
src/engine.js      node-llama-cpp wrapper, reasoning/answer separation
src/models.js      model catalog, download with pause/resume
public/            the interface: plain HTML, CSS and ES modules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Streaming.&lt;/strong&gt; The browser POSTs the conversation to &lt;code&gt;/api/chat&lt;/code&gt;, and the server streams Server-Sent Events: &lt;code&gt;thought&lt;/code&gt; chunks, &lt;code&gt;text&lt;/code&gt; chunks, and a final &lt;code&gt;done&lt;/code&gt; event with token count and tokens/second. node-llama-cpp separates the model's reasoning into segments; for templates that don't, a small state machine splits &lt;code&gt;&amp;lt;think&amp;gt;…&amp;lt;/think&amp;gt;&lt;/code&gt; out of the raw stream, including tags that arrive split across chunks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The UI.&lt;/strong&gt; I wanted it to look like a carefully made desktop tool rather than a template: warm neutrals, one muted accent, IBM Plex Sans and Mono served locally (so it works offline), hand-drawn icons, and no gradients or glow. Model output is untrusted, so raw HTML is escaped and remote images are never fetched.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part I didn't expect: localhost security
&lt;/h2&gt;

&lt;p&gt;A local AI server feels private, but &lt;strong&gt;any website you visit can try to talk to &lt;code&gt;127.0.0.1&lt;/code&gt;&lt;/strong&gt;. Two attacks matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CSRF-style requests.&lt;/strong&gt; A page can fire a &lt;code&gt;text/plain&lt;/code&gt; POST at your local server without a CORS preflight. Unmuzzled requires &lt;code&gt;application/json&lt;/code&gt;, which forces a preflight the server never approves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS rebinding.&lt;/strong&gt; A malicious domain can resolve to &lt;code&gt;127.0.0.1&lt;/code&gt; after the page loads, making the browser treat your local server as same-origin. Unmuzzled rejects any request whose &lt;code&gt;Host&lt;/code&gt; header isn't a local name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same guard protects the setup endpoints, so no website can start a 5 GB download on your machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest numbers
&lt;/h2&gt;

&lt;p&gt;On my laptop (Intel i5-1135G7, Iris Xe integrated graphics via Vulkan, 16 GB RAM), the 9B model runs at &lt;strong&gt;about 2 tokens/second&lt;/strong&gt; (1.7–2.7 across my runs) after a ~40–50 second load. "Offline" doesn't mean "fast"; hardware is the whole story. A discrete GPU or an Apple Silicon Mac is many times faster. Reasoning models also generate their thinking before the answer, which adds to wait time on slow hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shipping it on Android
&lt;/h2&gt;

&lt;p&gt;The Android app (beta) runs the same uncensored model &lt;strong&gt;on the phone itself&lt;/strong&gt;. It's not a thin client for a server or your laptop; once the model is downloaded, the phone needs no network at all.&lt;/p&gt;

&lt;p&gt;What using it looks like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Open the app.&lt;/strong&gt; It checks your phone's memory and free storage and tells you whether the 9B model will fit (it needs about 12 GB of RAM, which current flagships have).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tap Download.&lt;/strong&gt; The 5.6 GB model downloads with a progress bar, speed and time left. You can pause it, and if you leave the app it saves its place and resumes when you come back. The screen stays on until it's done.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chat.&lt;/strong&gt; Replies stream in with Markdown and a collapsible reasoning panel. A &lt;strong&gt;Think&lt;/strong&gt; toggle in the composer switches between deep reasoning and instant answers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Already have a GGUF file? "I already have a .gguf file" imports it from the phone's storage instead. Chats, settings and the model live only on the device, and there's no sign-in.&lt;/p&gt;

&lt;p&gt;Under the hood it's React Native (Expo) with &lt;a href="https://github.com/mybigday/llama.rn" rel="noopener noreferrer"&gt;llama.rn&lt;/a&gt;. It ships llama.cpp builds tuned for modern ARM cores (dotprod/i8mm) and optional OpenCL offload on Adreno GPUs. &lt;strong&gt;&lt;a href="https://github.com/rahulagarwal18/unmuzzled/releases/tag/android-v0.1.0" rel="noopener noreferrer"&gt;Download the APK (beta)&lt;/a&gt;&lt;/strong&gt;. Open it on the phone and allow installs from that source when asked.&lt;/p&gt;

&lt;p&gt;Building it on Windows was its own adventure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gradle couldn't download anything&lt;/strong&gt; until I forced Java onto IPv4. The network's IPv6 was broken, and Java tried it first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Markdown library imported Node's built-in &lt;code&gt;punycode&lt;/code&gt;&lt;/strong&gt;, which doesn't exist in React Native, so I installed the standalone package.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows' 260-character path limit&lt;/strong&gt; broke the native build: one library's generated C++ paths reached 297 characters, and Android's bundled Ninja 1.10 can't use long paths. I replaced the library with a 30-line Kotlin module that reads the system bar insets directly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The app goes on GitHub Releases rather than Google Play. An app built around an uncensored model doesn't fit Play's AI-content policy, and side-loading an open-source APK is a well-trodden path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx unmuzzled                         &lt;span class="c"&gt;# setup screen, then chat&lt;/span&gt;
npx unmuzzled --model ./model.gguf    &lt;span class="c"&gt;# bring your own model&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/rahulagarwal18/unmuzzled" rel="noopener noreferrer"&gt;https://github.com/rahulagarwal18/unmuzzled&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;npm: &lt;a href="https://www.npmjs.com/package/unmuzzled" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/unmuzzled&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you run it, I'd love to know your tokens/second and hardware. Issues and PRs are welcome.&lt;/p&gt;




&lt;p&gt;💬 &lt;strong&gt;Discussion on LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/posts/rahul-agarwal-ai_opensource-ai-llm-ugcPost-7524464964498165760-hAvi/" rel="noopener noreferrer"&gt;join the conversation here&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>javascript</category>
      <category>llm</category>
    </item>
    <item>
      <title>How I Built a Safe, Anti-Ban LinkedIn MCP Server for AI Agents (Claude &amp; Cursor)</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Mon, 12 Oct 2026 09:25:39 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/how-i-built-a-safe-anti-ban-linkedin-mcp-server-for-ai-agents-claude-cursor-15o0</link>
      <guid>https://dev.to/rahul_agarwal18/how-i-built-a-safe-anti-ban-linkedin-mcp-server-for-ai-agents-claude-cursor-15o0</guid>
      <description>&lt;h1&gt;
  
  
  How I Built a Safe, Anti-Ban LinkedIn MCP Server for AI Agents
&lt;/h1&gt;

&lt;p&gt;When developers want an AI assistant like &lt;strong&gt;Claude&lt;/strong&gt;, &lt;strong&gt;Cursor&lt;/strong&gt;, or &lt;strong&gt;Antigravity&lt;/strong&gt; to help them with real-world professional tasks on LinkedIn, they hit a hard wall: &lt;strong&gt;there is no official LinkedIn Model Context Protocol (MCP) server.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because of that, community alternatives usually fall into two categories:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Official OAuth API tools:&lt;/strong&gt; Extremely restricted. You can publish plain text posts, but you cannot search jobs, read user profiles, or send messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Raw Scraper tools:&lt;/strong&gt; High capability, but dangerous. They require you to manually copy-paste sensitive session cookies (&lt;code&gt;li_at&lt;/code&gt;) into configuration files, and they fire requests in millisecond bursts, triggering LinkedIn's security filters and account restrictions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I built &lt;strong&gt;&lt;a href="https://github.com/rahulagarwal18/Linkedin_MCP" rel="noopener noreferrer"&gt;LinkedIn Guardrail MCP&lt;/a&gt;&lt;/strong&gt; to solve both problems: high capability paired with strict account safety.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6gv8nytmzjbyxnevuqjc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6gv8nytmzjbyxnevuqjc.jpg" alt="LinkedIn MCP System Architecture" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🛡️ The Architecture: Safety &amp;amp; Security First
&lt;/h2&gt;

&lt;p&gt;Connecting an autonomous agent to a platform with strict anti-bot detection requires an architecture that mirrors real human behavior:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Zero Credential Leaks (No Cookie Pasting)
&lt;/h3&gt;

&lt;p&gt;Instead of extracting and injecting secret session cookies, the server launches an interactive Chromium window once. You log in naturally using your credentials and 2-Factor Authentication (2FA). The browser profile persists on your machine locally. Zero passwords or session tokens are stored in the codebase or logged.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Stealth Bot Evasion
&lt;/h3&gt;

&lt;p&gt;By integrating &lt;code&gt;playwright-extra&lt;/code&gt; with &lt;code&gt;puppeteer-extra-plugin-stealth&lt;/code&gt;, the browser driver removes automated flags (&lt;code&gt;navigator.webdriver = false&lt;/code&gt;, normalized WebGL/Canvas footprints, and realistic viewport scaling).&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Human Pacing &amp;amp; Random Jitter
&lt;/h3&gt;

&lt;p&gt;Outbound actions (direct messaging, invitations) never execute in rapid bursts. Outbound requests are throttled with randomized human delays (30s to 90s) and simulate natural reading behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Hard Daily Safety Quotas
&lt;/h3&gt;

&lt;p&gt;The engine tracks daily interaction volume and automatically caps activity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maximum 50 profile views / day&lt;/li&gt;
&lt;li&gt;Maximum 15 connection requests / day&lt;/li&gt;
&lt;li&gt;Maximum 15 direct messages / day&lt;/li&gt;
&lt;li&gt;Maximum 3 posts / day&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚡ What Features Does It Provide?
&lt;/h2&gt;

&lt;p&gt;The server registers 6 core tools compliant with the Model Context Protocol:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;linkedin_get_safety_status&lt;/code&gt;: Inspect daily quotas, health status, and active queues.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;linkedin_search_jobs&lt;/code&gt;: Query LinkedIn job openings with keywords, location, and date filters.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;linkedin_get_profile&lt;/code&gt;: Safely inspect public profile headlines, experience, and summaries.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;linkedin_schedule_post&lt;/code&gt;: Draft and publish feed updates.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;linkedin_send_message&lt;/code&gt;: Automatically resolve a contact by name and deliver a direct message.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;linkedin_queue_connection_invite&lt;/code&gt;: Queue connection invites with personalized notes.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔌 Universal AI Compatibility
&lt;/h2&gt;

&lt;p&gt;Because it uses standard MCP JSON-RPC over &lt;code&gt;stdio&lt;/code&gt;, you can plug it into any MCP client:&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Desktop Configuration
&lt;/h3&gt;

&lt;p&gt;Add to &lt;code&gt;%APPDATA%\Claude\claude_desktop_config.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"linkedin"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/path/to/Linkedin_MCP/dist/index.js"&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;h3&gt;
  
  
  Cursor Configuration
&lt;/h3&gt;

&lt;p&gt;Under &lt;strong&gt;Settings → Features → MCP Servers → Add New MCP Server&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; &lt;code&gt;linkedin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;command&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Command:&lt;/strong&gt; &lt;code&gt;node /path/to/Linkedin_MCP/dist/index.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔗 Open Source Repository
&lt;/h2&gt;

&lt;p&gt;The entire codebase is open source under the MIT license:&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://github.com/rahulagarwal18/Linkedin_MCP" rel="noopener noreferrer"&gt;github.com/rahulagarwal18/Linkedin_MCP&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>python</category>
      <category>javascript</category>
    </item>
    <item>
      <title>OKF vs RAG: Why RAG Alone is Failing Enterprise AI Agents (And What's Next)</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Mon, 05 Oct 2026 06:26:02 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/okf-vs-rag-why-rag-alone-is-failing-enterprise-ai-agents-and-whats-next-2d34</link>
      <guid>https://dev.to/rahul_agarwal18/okf-vs-rag-why-rag-alone-is-failing-enterprise-ai-agents-and-whats-next-2d34</guid>
      <description>&lt;p&gt;If you've deployed Retrieval-Augmented Generation (RAG) into production, you’ve likely encountered its dirty secret:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RAG is probabilistic.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;It splits your documentation into arbitrary chunks, embeds them into high-dimensional vectors, and hopes that cosine similarity pulls back the exact truth. When it works, it feels like magic. When it fails, your agent cites outdated policies, pulls fragmented code snippets without context, and hallucinates business metrics.&lt;/p&gt;

&lt;p&gt;Enter &lt;strong&gt;OKF (Open Knowledge Format)&lt;/strong&gt; — a new paradigm gaining massive traction across AI engineering teams.&lt;/p&gt;

&lt;p&gt;Is OKF here to kill RAG, or are we looking at the foundation of the modern enterprise AI stack? Let’s break down the architecture, trade-offs, and how to combine them.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Understanding the Two Paradigms
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────────────────────────────────────┐
│                    RAG (Vector Search)                      │
│   Raw Docs ──▶ Chunker ──▶ Embeddings ──▶ Vector DB ──▶ LLM  │
│   [Probabilistic • Unstructured • Fragmented Chunks]        │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│                    OKF (Open Knowledge Format)              │
│   Curated Markdown + YAML ──▶ Knowledge Graph ──▶ LLM Cache │
│   [Deterministic • Structured • Authoritative Ground Truth] │
└─────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ⚡ What is RAG and Where Does It Break?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Retrieval-Augmented Generation (RAG)&lt;/strong&gt; indexes unstructured text (PDFs, Notion pages, Zendesk tickets) by chopping text into 500-token chunks and storing their embeddings in vector databases like Pinecone, Qdrant, or pgvector.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why RAG Fails in Mission-Critical Scenarios:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Chunk Boundary Problem:&lt;/strong&gt; Splitting text breaks structural context. If an API contract spans 3 chunks, vector search often retrieves chunk #1 and chunk #3, omitting critical constraints in chunk #2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Ambiguity:&lt;/strong&gt; Vector search matches &lt;em&gt;semantic similarity&lt;/em&gt;, not &lt;em&gt;logical authority&lt;/em&gt;. If you ask &lt;em&gt;"What is our refund policy for Q3?"&lt;/em&gt;, RAG might retrieve a deprecated 2023 policy because its semantic embedding is 98% identical to the new policy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Traversable Relationships:&lt;/strong&gt; Chunks are disconnected islands. RAG cannot natively traverse dependencies like &lt;code&gt;Metric ➔ Table Schema ➔ SQL Query ➔ Authorization Role&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🧠 What is OKF (Open Knowledge Format)?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Open Knowledge Format (OKF)&lt;/strong&gt; is an open, vendor-neutral specification designed to represent canonical knowledge for AI agents.&lt;/p&gt;

&lt;p&gt;Instead of arbitrary binary vector blobs, OKF structures curated knowledge as a directory of &lt;strong&gt;human-readable Markdown files enriched with YAML frontmatter&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;---
concept_id: customer_churn_rate
title: Customer Churn Rate Definition
type: business_metric
owner: finance_team
last_verified: 2026-09-15
dependencies:
  &lt;span class="k"&gt;- &lt;/span&gt;[subscription_lifecycle](concepts/subscription_lifecycle.md)
  &lt;span class="k"&gt;- &lt;/span&gt;[mrr_calculation](concepts/mrr_calculation.md)
---

&lt;span class="gu"&gt;# Customer Churn Rate
&lt;/span&gt;
&lt;span class="gu"&gt;## Authoritative Definition
&lt;/span&gt;Customer Churn Rate is defined strictly as:
&lt;span class="sb"&gt;`Lost Customers during Period / Total Customers at Start of Period`&lt;/span&gt;

&lt;span class="gu"&gt;## SQL Implementation
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
sql&lt;br&gt;
SELECT &lt;br&gt;
  COUNT(DISTINCT user_id) FILTER (WHERE churned = TRUE) * 1.0 / COUNT(DISTINCT user_id)&lt;br&gt;
FROM analytics.monthly_subscriptions;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
markdown&lt;/p&gt;
&lt;h3&gt;
  
  
  Why OKF is a Game-Changer:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic &amp;amp; Authoritative:&lt;/strong&gt; There is zero probabilistic guessing. The AI agent navigates explicit, verified ground truth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traversable Knowledge Graph:&lt;/strong&gt; Concepts link to other concepts via standard Markdown links (&lt;code&gt;[dependency](path.md)&lt;/code&gt;), allowing the agent to follow dependency chains deterministically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git-Native Version Control:&lt;/strong&gt; Every change, schema update, and policy revision is pull-requested, code-reviewed, and diffed using standard Git workflows.&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  🆚 Head-to-Head Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;RAG (Retrieval-Augmented Generation)&lt;/th&gt;
&lt;th&gt;OKF (Open Knowledge Format)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Retrieval Mechanism&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Probabilistic Vector Similarity&lt;/td&gt;
&lt;td&gt;Deterministic Graph / Context Navigation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Data Nature&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Unstructured, high-volume, dynamic&lt;/td&gt;
&lt;td&gt;Curated, structured, authoritative&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best For&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Support logs, customer emails, raw PDFs&lt;/td&gt;
&lt;td&gt;Business metrics, API schemas, compliance rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Context Quality&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fragmented 500-token chunks&lt;/td&gt;
&lt;td&gt;Complete, structured conceptual files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Version Control&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Complex vector DB re-indexing&lt;/td&gt;
&lt;td&gt;Native Git pull requests &amp;amp; commits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost Profile&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ongoing embedding &amp;amp; vector DB costs&lt;/td&gt;
&lt;td&gt;Near-zero storage + Prompt Cache friendly&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  🚀 The Winning Formula: The Hybrid "Brain + Search" Architecture
&lt;/h2&gt;

&lt;p&gt;The debate isn't &lt;strong&gt;OKF vs. RAG&lt;/strong&gt; — it's how to build a &lt;strong&gt;Hybrid Knowledge Engine&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                              User Query
                                  │
                                  ▼
                   ┌──────────────────────────────┐
                   │       AI Agent Router        │
                   └──────────────┬───────────────┘
                                  │
         ┌────────────────────────┴────────────────────────┐
         │ (Deterministic Schema / Rule)                   │ (Broad Unstructured Search)
         ▼                                                 ▼
┌─────────────────────────────────┐               ┌─────────────────────────────────┐
│        OKF Layer (Brain)        │               │        RAG Layer (Search)       │
│  • Curated Markdown &amp;amp; YAML      │               │  • Vector Embeddings            │
│  • Canonical business rules     │               │  • Historical support tickets   │
│  • API contracts &amp;amp; SQL schemas  │               │  • Long-tail documentation      │
└────────────────┬────────────────┘               └────────────────┬────────────────┘
                 │                                                 │
                 └────────────────────────┬────────────────────────┘
                                          │
                                          ▼
                             ┌─────────────────────────┐
                             │       LLM Engine        │
                             │  (100% Grounded Answer) │
                             └─────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;OKF acts as the Agent's Long-Term Core Brain:&lt;/strong&gt; It holds high-trust, canonical facts (business logic, database schemas, calculation formulas, and access policies) that are pre-loaded or cached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAG acts as the Dynamic Search Engine:&lt;/strong&gt; It scans the long tail of high-volume, continuously changing unstructured raw data (customer tickets, audit logs, slack archives).&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💡 Key Takeaway for AI Architects
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If your AI agent needs to &lt;strong&gt;search through 10,000 PDF user manuals&lt;/strong&gt;, use &lt;strong&gt;RAG&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If your AI agent needs to &lt;strong&gt;never miscalculate revenue, adhere to strict GDPR rules, or write correct SQL queries against your database&lt;/strong&gt;, use &lt;strong&gt;OKF&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The best production architectures use &lt;strong&gt;OKF for structure&lt;/strong&gt; and &lt;strong&gt;RAG for scale&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;What is your experience with RAG failures in production? Are you adopting structured formats like OKF? Let's discuss in the comments below!&lt;/em&gt; 👇&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>architecture</category>
      <category>python</category>
    </item>
    <item>
      <title>How I Legally Slashed Anthropic Claude API &amp; Claude Code Bills by 70%</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Mon, 05 Oct 2026 06:19:24 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/how-i-legally-slashed-anthropic-claude-api-claude-code-bills-by-70-19b4</link>
      <guid>https://dev.to/rahul_agarwal18/how-i-legally-slashed-anthropic-claude-api-claude-code-bills-by-70-19b4</guid>
      <description>&lt;p&gt;If you have been building with &lt;strong&gt;Claude Code&lt;/strong&gt;, &lt;strong&gt;Cursor&lt;/strong&gt;, or autonomous agentic workflows over the past few months, you've probably felt the sting of runaway Anthropic API bills.&lt;/p&gt;

&lt;p&gt;A few days of multi-turn coding sessions can easily run up hundreds of dollars in token usage.&lt;/p&gt;

&lt;p&gt;Today, I'm open-sourcing &lt;strong&gt;&lt;a href="https://github.com/rahulagarwal18/ClaudeCut" rel="noopener noreferrer"&gt;ClaudeCut&lt;/a&gt;&lt;/strong&gt; — a lightweight local reverse proxy that automatically reduces Anthropic Claude API expenses by &lt;strong&gt;40% to 70%&lt;/strong&gt; without sacrificing code quality or model intelligence.&lt;/p&gt;

&lt;p&gt;Here is the exact engineering behind how it works.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ The Root Problem: Why Claude Gets Expensive
&lt;/h2&gt;

&lt;p&gt;When you use Claude in an IDE or CLI, your client sends:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;entire repository structure &amp;amp; opened files&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;developer rules / system instructions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;full tool definition schemas&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;entire multi-turn conversation history&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every single time you send a message, your tool re-sends that entire 30,000+ token context from scratch.&lt;/p&gt;

&lt;p&gt;By default, Anthropic bills input tokens at standard full rates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude 3.7 / 3.5 Sonnet:&lt;/strong&gt; $3.00 per million input tokens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Opus:&lt;/strong&gt; $15.00 per million input tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The "Hidden" 90% Discount
&lt;/h3&gt;

&lt;p&gt;Anthropic offers &lt;strong&gt;Prompt Caching&lt;/strong&gt;, which discounts cached input tokens by &lt;strong&gt;90%&lt;/strong&gt; ($0.30/M on Sonnet).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The catch:&lt;/strong&gt; To get this discount, requests must contain explicit &lt;code&gt;cache_control: {"type": "ephemeral"}&lt;/code&gt; breakpoints. In standard setups, developers don't configure these breakpoints manually, so they pay full price every turn.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 How ClaudeCut Solves This
&lt;/h2&gt;

&lt;p&gt;ClaudeCut is a drop-in local proxy that sits seamlessly between your IDE / CLI and Anthropic:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdyqadh18mh34w589nxbf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdyqadh18mh34w589nxbf.jpg" alt="ClaudeCut Architecture" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1️⃣ Automated Ephemeral Prompt Caching (90% Off)
&lt;/h3&gt;

&lt;p&gt;ClaudeCut dynamically intercepts incoming payload requests and places up to 4 cache breakpoints (Anthropic's maximum limit):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;System instructions&lt;/li&gt;
&lt;li&gt;Tool definition schemas&lt;/li&gt;
&lt;li&gt;Multi-turn chat checkpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Claude recognizes the cache bookmarks and automatically applies the &lt;strong&gt;90% discount&lt;/strong&gt; on all repeat context.&lt;/p&gt;

&lt;h3&gt;
  
  
  2️⃣ Dynamic Task-Based Model Switching
&lt;/h3&gt;

&lt;p&gt;Why pay flagship rates to write a 1-line git commit message or fix a typo?&lt;br&gt;
ClaudeCut inspects task heuristics in real-time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tier 1 (Lightweight / 90% cheaper):&lt;/strong&gt; Formats, typo fixes, git commit messages, regex, syntax checks ➔ Routed to &lt;strong&gt;Claude 3.5 Haiku&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tier 2 (Standard Workhorse):&lt;/strong&gt; Feature coding, refactoring, multi-file edits, unit tests ➔ &lt;strong&gt;Claude 3.7 Sonnet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tier 3 (Deep Reasoning):&lt;/strong&gt; Architecture design, formal verification, security audits ➔ &lt;strong&gt;Claude Opus&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3️⃣ Context &amp;amp; Whitespace Minification
&lt;/h3&gt;

&lt;p&gt;Strips redundant delimiters, blank lines, and trailing whitespace bloat before tokenization (saving 10%–25% tokens without breaking syntax).&lt;/p&gt;

&lt;h3&gt;
  
  
  4️⃣ Real-Time Financial Dashboard
&lt;/h3&gt;

&lt;p&gt;Runs a local dashboard at &lt;code&gt;http://localhost:8000/dashboard&lt;/code&gt; displaying live dollars saved, actual API spend, cache hit ratios, and model tier distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 The Math: 10-Turn Benchmark
&lt;/h2&gt;

&lt;p&gt;Here is a real comparison on a 10-turn coding session with 35,000 context tokens:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setup&lt;/th&gt;
&lt;th&gt;Input Tokens&lt;/th&gt;
&lt;th&gt;Cache Reads (90% OFF)&lt;/th&gt;
&lt;th&gt;Output Tokens&lt;/th&gt;
&lt;th&gt;Total Cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Standard Claude (Direct)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;360,000&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;6,000&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$1.170&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;With ClaudeCut Optimizer&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10,000&lt;/td&gt;
&lt;td&gt;315,000&lt;/td&gt;
&lt;td&gt;6,000&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.346&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Net Cost Reduction&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;🔥 70.38% SAVED&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🚀 Quickstart in 60 Seconds
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Clone &amp;amp; Run ClaudeCut
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/rahulagarwal18/ClaudeCut.git
&lt;span class="nb"&gt;cd&lt;/span&gt; ClaudeCut
pip install -r requirements.txt
python -m claudecut.cli start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Connect Claude Code CLI
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://127.0.0.1:8000"&lt;/span&gt;
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Connect Python SDK / Cursor
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://127.0.0.1:8000"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔗 Try It Out &amp;amp; Star the Repo!
&lt;/h2&gt;

&lt;p&gt;The project is live on GitHub:&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://github.com/rahulagarwal18/ClaudeCut" rel="noopener noreferrer"&gt;github.com/rahulagarwal18/ClaudeCut&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If this saved you money on your Claude bills, consider dropping a ⭐ on GitHub!&lt;/p&gt;

&lt;p&gt;What are your favorite techniques for optimizing LLM inference costs? Let's discuss in the comments below! 👇&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>programming</category>
    </item>
    <item>
      <title>Passion Pilot - AI-Powered Learning Journeys</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Sun, 12 Jul 2026 13:11:34 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/passion-pilot-ai-powered-learning-journeys-12ll</link>
      <guid>https://dev.to/rahul_agarwal18/passion-pilot-ai-powered-learning-journeys-12ll</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/weekend-2026-07-09"&gt;Weekend Challenge: Passion Edition 2026&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Passion Pilot&lt;/strong&gt; is an intelligent, interactive roadmap generator and contextual AI mentor designed to help you master any new hobby or obsession. &lt;/p&gt;

&lt;p&gt;When you type in a passion (e.g., "Gaming", "Photography", or "Woodworking") and your current skill level, Passion Pilot uses the Groq API to instantly generate a highly structured learning syllabus. Instead of a boring text list, it dynamically renders your roadmap as a beautiful, interactive &lt;strong&gt;Skill Tree&lt;/strong&gt; where you can track your progress. It also generates a tiered &lt;strong&gt;Gear List&lt;/strong&gt; outlining exactly what equipment you need to buy and how much it will cost.&lt;/p&gt;

&lt;p&gt;The coolest feature? The &lt;strong&gt;Contextual AI Mentor&lt;/strong&gt;. The floating chat bubble is deeply integrated with the global UI state. It knows exactly which task node you currently have marked as "Active" and provides hyper-focused, personalized advice based on exactly where you are stuck in your journey!&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Live Project URL:&lt;/strong&gt; &lt;a href="https://passion-pilot-three.vercel.app/" rel="noopener noreferrer"&gt;https://passion-pilot-three.vercel.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuv7a8fhcig7oe6nn5gl8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuv7a8fhcig7oe6nn5gl8.png" alt=" " width="745" height="652"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8xpao3sxewqud259zeoa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8xpao3sxewqud259zeoa.png" alt=" " width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft6k34bw1z8b8b7eblx0d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft6k34bw1z8b8b7eblx0d.png" alt=" " width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7fcppse4le4dp8czvyax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7fcppse4le4dp8czvyax.png" alt=" " width="428" height="618"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;
        rahulagarwal18
      &lt;/a&gt; / &lt;a href="https://github.com/rahulagarwal18/passion-pilot" rel="noopener noreferrer"&gt;
        passion-pilot
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Passion Pilot&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Passion Pilot is an AI-powered roadmap generator and contextual mentor designed to help you master any new hobby or obsession.&lt;/p&gt;
&lt;p&gt;Built for the DEV.to Hackathon.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Features&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instant Syllabus Generation:&lt;/strong&gt; Enter any passion and skill level to receive a highly-structured JSON syllabus outlining phases and tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Gear List:&lt;/strong&gt; Generates a tiered gear list required to pursue the hobby, complete with estimated costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Skill Tree:&lt;/strong&gt; Visualize your learning roadmap dynamically with interactive nodes and progress tracking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual AI Mentor:&lt;/strong&gt; The built-in AI chat bubble is deeply integrated with the UI state. It knows exactly which task you are currently working on and gives hyper-focused, contextual advice.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Tech Stack&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;React &amp;amp; Vite&lt;/li&gt;
&lt;li&gt;Zustand (Global State Management)&lt;/li&gt;
&lt;li&gt;Tailwind &amp;amp; Vanilla CSS (Dark Mode / Glassmorphism)&lt;/li&gt;
&lt;li&gt;Groq API (Llama 3.3 for lightning-fast structured JSON output)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Getting Started&lt;/h2&gt;

&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Clone the repository:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone https://github.com/rahulagarwal18/passion-pilot.git
&lt;span class="pl-c1"&gt;cd&lt;/span&gt; passion-pilot&lt;/pre&gt;

&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Install dependencies:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;npm install&lt;/pre&gt;

&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;
&lt;p&gt;Configure your…&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/rahulagarwal18/passion-pilot" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;I built this application using a modern, lightning-fast frontend stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;React &amp;amp; Vite&lt;/strong&gt;: For a rapid, component-driven frontend architecture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tailwind &amp;amp; Vanilla CSS&lt;/strong&gt;: To design a premium, dark-mode dashboard with glassmorphism elements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zustand&lt;/strong&gt;: For complex global state management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Groq API &amp;amp; Llama-3.3-70b-versatile&lt;/strong&gt;: For blazing fast AI inference.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1. Global State Management (Zustand)
&lt;/h3&gt;

&lt;p&gt;To make the AI Mentor truly "context-aware", I needed the chat component to know exactly what the user was looking at. I used Zustand to create a global store that tracks the user's active task anywhere in the app:&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="n"&gt;create&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'zustand'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;usePassionStore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;set&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="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;passion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;skillLevel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;roadmap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;activeTask&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Tracks the node the user is currently working on!&lt;/span&gt;
  &lt;span class="n"&gt;isGenerating&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

  &lt;span class="n"&gt;setPassion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;passion&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;passion&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;setSkillLevel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skillLevel&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;skillLevel&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;setRoadmap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;roadmap&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;roadmap&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;setActiveTask&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;activeTask&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;task&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;setIsGenerating&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;isGenerating&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;isGenerating&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="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="n"&gt;usePassionStore&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. The Contextual AI Mentor
&lt;/h3&gt;

&lt;p&gt;By subscribing to the &lt;code&gt;activeTask&lt;/code&gt; state, the Chatbot component automatically injects the exact task the user is struggling with into the AI prompt. This means you don't have to explain your problem to the AI—it already knows!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;usePassionStore&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'../store/usePassionStore'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;askMentor&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'../services/gemini'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Bot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Sparkles&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'lucide-react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;ContextualChat&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;activeTask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;passion&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;usePassionStore&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="kd"&gt;const&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="n"&gt;setMessages&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setInput&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;''&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;handleSend&lt;/span&gt; &lt;span class="o"&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&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="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Injecting the global UI state context directly into the chat!&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;contextStr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;activeTask&lt;/span&gt; 
      &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="sb"&gt;`The user is currently working on this specific task: "${activeTask.title}".`&lt;/span&gt;
      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`The user is learning about ${passion}.`&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;userMsg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;setMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="n"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userMsg&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;setInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;try&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;askMentor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;passion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;activeTask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nf"&gt;setMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="n"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'assistant'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&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="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&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="c1"&gt;// ... rendering logic ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Forcing Strict JSON with Llama 3
&lt;/h3&gt;

&lt;p&gt;One of the biggest challenges was parsing the AI's response into a predictable UI. I engineered a highly specific prompt to force the Llama model to return nothing but strict JSON, bypassing markdown formatting:&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;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;generateSyllabus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;passion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;skillLevel&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;apiKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;VITE_GROQ_API_KEY&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="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing Groq API Key"&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;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`You are a master mentor for the topic: "${passion}". 
The user is at a "${skillLevel}" skill level.
Generate a structured learning roadmap and a gear list.
You MUST respond ONLY with a raw, valid JSON object. Do not include markdown formatting like \`\`\`json.
...`&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;response&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.groq.com/openai/v1/chat/completions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"POST"&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="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Bearer ${apiKey}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;body&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="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"llama-3.3-70b-versatile"&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="n"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;prompt&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;temperature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;response_format&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;"json_object"&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;data&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;response&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="k"&gt;return&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;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&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;&lt;strong&gt;The Engineering Pivot:&lt;/strong&gt;&lt;br&gt;
Originally, I intended to build this using Google's experimental Gemini models. However, halfway through the hackathon, I ran into unexpected account restrictions with my Google Cloud preview keys, which completely blocked the API. With the clock ticking, I engineered a rapid pivot to the &lt;strong&gt;Groq API&lt;/strong&gt;. Because Groq's Llama 3.3 model is incredibly fast and supports strict JSON schema generation, the transition was incredibly seamless. Pivoting mid-hackathon to a completely different AI provider while keeping the UI parsing logic intact was a fantastic exercise in building resilient, loosely-coupled architectures!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>weekendchallenge</category>
      <category>react</category>
      <category>ai</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Reality of AI and Tech Layoffs in India (And How to Survive Them)</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Mon, 06 Jul 2026 06:38:25 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/the-reality-of-ai-and-tech-layoffs-in-india-and-how-to-survive-them-11k0</link>
      <guid>https://dev.to/rahul_agarwal18/the-reality-of-ai-and-tech-layoffs-in-india-and-how-to-survive-them-11k0</guid>
      <description>&lt;p&gt;If you browse tech forums in India today, the anxiety is palpable. Major IT service companies are slowing down hiring, startups are running lean, and the word "layoff" is trending on LinkedIn every other week. &lt;/p&gt;

&lt;p&gt;At the center of this fear is Artificial Intelligence. The big question on everyone's mind: &lt;strong&gt;Is AI helping developers, or is it causing a massive decline in tech jobs in India?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The truth is nuanced, and if you want to survive the 2026 tech market, you need to look past the panic.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Reality of Layoffs: Is AI to Blame?
&lt;/h3&gt;

&lt;p&gt;Yes and no. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Decline of the "Code Monkey"&lt;/strong&gt;&lt;br&gt;
Historically, a massive portion of the Indian IT sector relied on high-volume, low-complexity outsourcing (e.g., basic CRUD apps, manual QA testing, and legacy maintenance). AI tools like GitHub Copilot and autonomous agents &lt;em&gt;are&lt;/em&gt; absolutely devastating this segment of the market. A task that used to require a team of five junior developers can now be done by one mid-level developer orchestrating an LLM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Economic Factor&lt;/strong&gt;&lt;br&gt;
However, it is unfair to blame AI entirely. High interest rates globally have forced Western companies to cut costs, which naturally trickles down to outsourcing hubs in India. Startups that were fueled by easy VC money have had to prioritize profitability over headcount. &lt;/p&gt;

&lt;h3&gt;
  
  
  Where AI is Actually Helping (The GCC Boom)
&lt;/h3&gt;

&lt;p&gt;While service-based roles for basic web development are shrinking, &lt;strong&gt;Global Capability Centers (GCCs)&lt;/strong&gt; in India are booming. &lt;/p&gt;

&lt;p&gt;Top-tier companies are no longer just outsourcing cheap labor; they are building core R&amp;amp;D centers in Bengaluru, Hyderabad, and Pune. These companies are desperately looking for developers who know how to &lt;em&gt;integrate&lt;/em&gt; AI into their products. &lt;/p&gt;

&lt;p&gt;AI is creating a massive demand for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Developers who understand Retrieval-Augmented Generation (RAG).&lt;/li&gt;
&lt;li&gt;  Engineers who can optimize cloud architecture for AI inference.&lt;/li&gt;
&lt;li&gt;  Frontend devs who can build streaming, generative UIs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Solution: How to Bulletproof Your Career
&lt;/h3&gt;

&lt;p&gt;If you are worried about layoffs, here is the harsh truth: &lt;strong&gt;AI won't replace software engineers, but engineers who use AI will replace those who don't.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the exact playbook to survive and thrive in this market:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Stop Competing on Syntax
&lt;/h4&gt;

&lt;p&gt;Knowing React or Node.js syntax is no longer a competitive advantage—an AI can generate a React component in two seconds. Your value is in &lt;strong&gt;Architecture and Problem Solving&lt;/strong&gt;. Focus on system design, database optimization, and scalable architectures.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Become an "AI Orchestrator"
&lt;/h4&gt;

&lt;p&gt;Stop treating AI as a threat and start treating it as a compiler. Learn how to use agents to write your boilerplate, so you can spend 100% of your time on business logic. If you can output the work of three developers by effectively prompting an AI, you become indispensable to your employer.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Shift to Product-Minded Engineering
&lt;/h4&gt;

&lt;p&gt;The era of just picking up a Jira ticket, writing the code, and closing it is over. You need to understand the business. Ask yourself: &lt;em&gt;How does this feature increase revenue or decrease churn?&lt;/em&gt; Product-minded engineers who understand the user experience and business metrics are layoff-proof.&lt;/p&gt;

&lt;p&gt;The Indian tech market isn't dying; it is evolving. The barrier to entry has simply been raised. Upskill, embrace the AI wave, and position yourself as an architect, not just a coder.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Are you seeing the impact of AI at your current company? Let's discuss in the comments.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>ai</category>
      <category>india</category>
      <category>programming</category>
    </item>
    <item>
      <title>HTMX vs React: When to Actually Use Which in 2026</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Mon, 06 Jul 2026 06:34:34 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/htmx-vs-react-when-to-actually-use-which-in-2026-4fd7</link>
      <guid>https://dev.to/rahul_agarwal18/htmx-vs-react-when-to-actually-use-which-in-2026-4fd7</guid>
      <description>&lt;p&gt;If you spend any time on developer Twitter (or X), you've probably seen the raging war between React developers and the HTMX cult. &lt;/p&gt;

&lt;p&gt;React developers claim HTMX is just a regression back to 2010s jQuery spaghetti. HTMX developers claim React is a bloated, over-engineered mess that ships 5MB of JavaScript just to render a static blog.&lt;/p&gt;

&lt;p&gt;As a Full Stack Developer, I've built production applications with both. The truth is, they solve entirely different problems. Here is the definitive guide on when to use which in 2026.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Case for HTMX
&lt;/h3&gt;

&lt;p&gt;HTMX is brilliant because it extends HTML. Instead of writing JavaScript to &lt;code&gt;fetch&lt;/code&gt; data and update the DOM, you simply add attributes like &lt;code&gt;hx-get&lt;/code&gt; and &lt;code&gt;hx-swap&lt;/code&gt; directly to your buttons and forms. The server returns raw HTML, and HTMX swaps it into the page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use HTMX When:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;You are building a CRUD application:&lt;/strong&gt; Dashboards, internal admin tools, and content management systems. HTMX thrives here.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You have a backend-heavy team:&lt;/strong&gt; If your team loves Python (Django), Go, or PHP (Laravel), HTMX allows them to build highly interactive UIs without ever touching Node.js or Webpack.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;SEO and Initial Load Speed are critical:&lt;/strong&gt; Because everything is rendered on the server, you ship zero kilobytes of framework JavaScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Case for React
&lt;/h3&gt;

&lt;p&gt;React (especially modern React with Next.js App Router) is an application architecture, not just a UI library. It excels at managing complex, deeply nested state on the client side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use React When:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;You are building a highly interactive Web App:&lt;/strong&gt; If you are building a tool like Figma, Google Docs, or a complex video editor in the browser, HTMX will fail you. You &lt;em&gt;need&lt;/em&gt; client-side state management.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You have a dedicated frontend team:&lt;/strong&gt; React's component model and massive ecosystem (Tailwind, Radix UI, Framer Motion) make it vastly superior for building highly polished, heavily animated design systems.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You are building offline-first or PWA features:&lt;/strong&gt; HTMX fundamentally requires a server connection to render changes. React can work entirely offline using local state and IndexedDB.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Pragmatic Developer
&lt;/h3&gt;

&lt;p&gt;Stop treating tech stacks like religions. &lt;/p&gt;

&lt;p&gt;If you are building an internal data dashboard, using Next.js with Redux is probably overkill. Grab HTMX and build it in half the time.&lt;/p&gt;

&lt;p&gt;If you are building a highly interactive SaaS product with complex client-side interactions, trying to force HTMX to handle offline sync and complex animations will be a nightmare. Grab React.&lt;/p&gt;

&lt;p&gt;The best developers don't have a favorite tool; they have a well-stocked toolbox.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>htmx</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Rise of DeepSeek and Qwen: Are Western LLMs Losing Their Moat?</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Mon, 06 Jul 2026 06:34:31 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/the-rise-of-deepseek-and-qwen-are-western-llms-losing-their-moat-45cl</link>
      <guid>https://dev.to/rahul_agarwal18/the-rise-of-deepseek-and-qwen-are-western-llms-losing-their-moat-45cl</guid>
      <description>&lt;p&gt;For the past couple of years, the AI narrative in the developer world has been dominated by a few major players: OpenAI (GPT-4), Anthropic (Claude 3.5), and Google (Gemini). They set the benchmark for coding tasks, reasoning, and context windows.&lt;/p&gt;

&lt;p&gt;But in 2026, the landscape is shifting rapidly. The moat that Western closed-source labs built is being aggressively challenged by a new wave of highly optimized, open-weight models from China—most notably &lt;strong&gt;DeepSeek&lt;/strong&gt; and Alibaba's &lt;strong&gt;Qwen&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is why developers are starting to switch.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Cost-to-Performance Ratio
&lt;/h3&gt;

&lt;p&gt;The biggest advantage of models like DeepSeek-Coder is their unprecedented cost efficiency. While GPT-4 remains a powerhouse, running millions of tokens through it for an automated dev-agent workflow gets expensive fast. &lt;/p&gt;

&lt;p&gt;Chinese labs have focused heavily on architectural optimizations (like highly tuned Mixture-of-Experts) that allow their models to punch way above their weight class while costing a fraction of the price of Western frontier models. For startups building AI-heavy applications, this cost difference isn't just a perk; it determines whether the business model is viable.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The Open-Weight Advantage
&lt;/h3&gt;

&lt;p&gt;Anthropic and OpenAI offer API access, but you can't run their models on your own infrastructure. Qwen and DeepSeek release incredibly powerful open weights. &lt;/p&gt;

&lt;p&gt;For enterprise applications dealing with sensitive healthcare or financial data, sending code snippets and user data to a third-party API is a massive compliance risk. The ability to pull a 72B Qwen model and run it locally on a private server using vLLM or Ollama is a game changer for enterprise developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Coding Benchmarks
&lt;/h3&gt;

&lt;p&gt;It used to be a given that open-source models couldn't code. Not anymore. &lt;br&gt;
DeepSeek-Coder and Qwen-Coder have consistently traded blows with GPT-4 on the HumanEval and MBPP benchmarks. In many practical scenarios—like generating React components or writing Python boilerplate—the difference in output quality is virtually indistinguishable, yet the inference speed of the open models is significantly faster.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Verdict
&lt;/h3&gt;

&lt;p&gt;Are Western models obsolete? Absolutely not. For the most complex, highly nuanced reasoning tasks, models like Claude 3.5 Sonnet still hold the crown. &lt;/p&gt;

&lt;p&gt;However, for 90% of standard web development tasks, RAG pipelines, and automated coding agents, the gap has closed. The future of AI development isn't a single dominant model—it's a routing layer that sends complex tasks to Claude/GPT-4, and standard tasks to lightning-fast, cost-effective models like DeepSeek and Qwen.&lt;/p&gt;

&lt;p&gt;Which models are you primarily using in your dev workflow right now? Let me know in the comments!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>programming</category>
    </item>
    <item>
      <title>The End of useMemo: Why React 19's Compiler is a Game Changer</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Sun, 05 Jul 2026 12:58:14 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/the-end-of-usememo-why-react-19s-compiler-is-a-game-changer-4nd0</link>
      <guid>https://dev.to/rahul_agarwal18/the-end-of-usememo-why-react-19s-compiler-is-a-game-changer-4nd0</guid>
      <description>&lt;p&gt;If you’ve been building complex React applications over the last few years, you are intimately familiar with the "memoization tax." We’ve all spent hours wrapping components in &lt;code&gt;React.memo&lt;/code&gt;, variables in &lt;code&gt;useMemo&lt;/code&gt;, and functions in &lt;code&gt;useCallback&lt;/code&gt;, just to stop a rogue context update from re-rendering the entire page.&lt;/p&gt;

&lt;p&gt;Well, as of React 19, &lt;strong&gt;the era of manual memoization is officially over.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: We Were Doing the Compiler's Job
&lt;/h3&gt;

&lt;p&gt;Historically, React's rendering model was blunt: if state changes, re-render the component and all its children. To optimize this, developers had to act as human compilers, manually identifying which computations were expensive and caching them. &lt;/p&gt;

&lt;p&gt;Not only did this pollute our codebases with &lt;code&gt;useMemo&lt;/code&gt; hooks, but it also introduced subtle bugs when dependency arrays were inevitably misconfigured.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enter the React Compiler
&lt;/h3&gt;

&lt;p&gt;The React Compiler (formerly known as React Forget) changes everything. It is an ahead-of-time (AOT) compiler that understands your JavaScript and automatically applies fine-grained reactivity. &lt;/p&gt;

&lt;p&gt;Instead of re-rendering everything, the compiler analyzes your code during the build step and automatically caches values and components that haven't changed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before React 19:&lt;/strong&gt;&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="nc"&gt;UserProfile&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="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;theme&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;formattedName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useMemo&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sb"&gt;`${user.firstName} ${user.lastName}`&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&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="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useCallback&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Clicked:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;formattedName&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="n"&gt;formattedName&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="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="n"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;handleClick&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;formattedName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;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;&lt;strong&gt;With React 19:&lt;/strong&gt;&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="nc"&gt;UserProfile&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="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;theme&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;formattedName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`${user.firstName} ${user.lastName}`&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;handleClick&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="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Clicked:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;formattedName&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="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="n"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;handleClick&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;formattedName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;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;&lt;em&gt;Look at how clean that is.&lt;/em&gt; The compiler automatically does the work of &lt;code&gt;useMemo&lt;/code&gt; and &lt;code&gt;useCallback&lt;/code&gt; under the hood.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why This Makes You a Better Developer
&lt;/h3&gt;

&lt;p&gt;By removing the mental overhead of tracking dependencies, the React Compiler allows you to focus purely on business logic and component architecture. Your code becomes strictly declarative again.&lt;/p&gt;

&lt;p&gt;If you are migrating a legacy app to React 19, you can literally run a script to delete thousands of &lt;code&gt;useMemo&lt;/code&gt; hooks and watch your app run &lt;em&gt;faster&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Welcome to the golden age of React. 🚀&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>React Server Components (RSC): You're Probably Fetching Data Wrong</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Sun, 05 Jul 2026 12:58:12 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/react-server-components-rsc-youre-probably-fetching-data-wrong-49j1</link>
      <guid>https://dev.to/rahul_agarwal18/react-server-components-rsc-youre-probably-fetching-data-wrong-49j1</guid>
      <description>&lt;p&gt;For years, the standard way to load data into a React application was the infamous &lt;code&gt;useEffect&lt;/code&gt; hook. We would render a loading spinner on the client, fire off a REST API call, and then painfully update the state once the data arrived.&lt;/p&gt;

&lt;p&gt;This pattern led to massive JavaScript bundles, waterfall network requests, and terrible SEO.&lt;/p&gt;

&lt;p&gt;With the stabilization of &lt;strong&gt;React Server Components (RSC)&lt;/strong&gt; in modern frameworks like Next.js App Router, the entire paradigm of data fetching has been turned upside down. If you are still relying heavily on &lt;code&gt;useEffect&lt;/code&gt; in 2026, you are building legacy applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Shift: Server vs. Client Components
&lt;/h3&gt;

&lt;p&gt;The fundamental innovation of RSC is that components can now run &lt;strong&gt;exclusively on the server&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;This means your component can securely access databases, read filesystems, and fetch APIs directly, without ever shipping a single byte of JavaScript to the user's browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Old Way (Client-Side Fetching):&lt;/strong&gt;&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="s2"&gt;"use client"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Dashboard&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="kd"&gt;const&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="n"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/user-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;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;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="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;setData&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Spinner&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Welcome&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="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;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;&lt;strong&gt;The New Way (Server Component):&lt;/strong&gt;&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="c1"&gt;// This runs purely on the server!&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@/lib/db'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Dashboard&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;// Direct, secure database query. No API route needed!&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;data&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;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findFirst&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="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Welcome&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="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;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;h3&gt;
  
  
  The Unfair Performance Advantage
&lt;/h3&gt;

&lt;p&gt;When you use RSCs, the HTML is generated on the server and streamed directly to the client. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Zero Client-Side JS:&lt;/strong&gt; The server component itself is never sent to the browser. Only the resulting HTML is.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant LCP:&lt;/strong&gt; The user sees the content immediately, without waiting for the browser to parse JavaScript and trigger a network waterfall.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enhanced Security:&lt;/strong&gt; You can safely keep API keys and secret logic inside your React components because they never leave your server.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Takeaway
&lt;/h3&gt;

&lt;p&gt;Client components (using &lt;code&gt;"use client"&lt;/code&gt;) should now be strictly reserved for interactive elements—like buttons, forms, and animations. Everything else? Move it to the server. &lt;/p&gt;

&lt;p&gt;Embracing React Server Components isn't just an optimization; it's the new baseline for professional web development.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>architecture</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building AI-Powered React Apps in 2026: Beyond Basic Prompts</title>
      <dc:creator>Rahul Agarwal</dc:creator>
      <pubDate>Sun, 05 Jul 2026 12:58:11 +0000</pubDate>
      <link>https://dev.to/rahul_agarwal18/building-ai-powered-react-apps-in-2026-beyond-basic-prompts-17al</link>
      <guid>https://dev.to/rahul_agarwal18/building-ai-powered-react-apps-in-2026-beyond-basic-prompts-17al</guid>
      <description>&lt;p&gt;A few years ago, adding AI to a web app meant tossing a clunky chatbot iframe in the corner of the screen. Today, as a Full Stack React Developer, if you aren't deeply integrating Large Language Models (LLMs) into your core UI, you are falling behind.&lt;/p&gt;

&lt;p&gt;The industry has moved past basic prompt wrappers. In 2026, the gold standard is &lt;strong&gt;Generative UI&lt;/strong&gt;—streaming AI responses that render dynamic React components in real-time.&lt;/p&gt;

&lt;p&gt;Here is how modern AI-powered React applications are actually built.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Challenge: LLMs are Slow, UI must be Fast
&lt;/h3&gt;

&lt;p&gt;Standard HTTP requests are synchronous: you ask the server for data, wait, and get a JSON response. &lt;/p&gt;

&lt;p&gt;LLMs don't work like this. They generate text token-by-token. If you wait for the entire response to finish before updating your React state, your application will feel broken. The solution is &lt;strong&gt;HTTP Streaming&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enter the Vercel AI SDK
&lt;/h3&gt;

&lt;p&gt;The standard tooling for this has coalesced around the Vercel AI SDK. It abstracts away the complex Node.js streaming logic and provides custom React hooks like &lt;code&gt;useChat&lt;/code&gt; and &lt;code&gt;useCompletion&lt;/code&gt;.&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="n"&gt;useChat&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'ai/react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;AIHelper&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="kd"&gt;const&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="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;handleInputChange&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;handleSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useChat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/api/chat'&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"flex flex-col gap-4"&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;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;role&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'text-blue-500'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'text-gray-800'&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;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt; &lt;span class="n"&gt;onSubmit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;handleSubmit&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;handleInputChange&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;placeholder&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Ask anything..."&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"submit"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Send&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;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;h3&gt;
  
  
  The Next Level: Generative UI
&lt;/h3&gt;

&lt;p&gt;Instead of just streaming text back, modern apps stream &lt;strong&gt;structured JSON&lt;/strong&gt; that React uses to dynamically mount UI components.&lt;/p&gt;

&lt;p&gt;Imagine a user types: &lt;em&gt;"Show me my sales data for Q3."&lt;/em&gt;&lt;br&gt;
Instead of the AI replying with a text summary, the server streams down a payload that tells the React client to instantly mount a &lt;code&gt;BarChart&lt;/code&gt; component with the parsed data injected into the props.&lt;/p&gt;

&lt;p&gt;This is achieved using tools like &lt;code&gt;ai/rsc&lt;/code&gt; (React Server Components with AI). The AI decides &lt;em&gt;which&lt;/em&gt; component to render based on the user's intent.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Future of Frontend
&lt;/h3&gt;

&lt;p&gt;Frontend development is shifting from "wiring up static endpoints" to "building dynamic component registries" that AI can orchestrate on the fly. &lt;/p&gt;

&lt;p&gt;If you want to be a top-tier Full Stack developer today, master the art of streaming, structured AI outputs, and Server Components. The future of UI is generative.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Rahul, an AI engineer in Bengaluru who builds tools that ship. More of my work is at &lt;a href="https://www.rahul-agarwal.in" rel="noopener noreferrer"&gt;rahul-agarwal.in&lt;/a&gt;, and the code is on &lt;a href="https://github.com/rahulagarwal18" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>react</category>
      <category>webdev</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
