<?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: Xodia AI</title>
    <description>The latest articles on DEV Community by Xodia AI (@xodiaai).</description>
    <link>https://dev.to/xodiaai</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%2F4240105%2F38e53ee7-fd71-4239-bb64-e156b45c5e64.png</url>
      <title>DEV Community: Xodia AI</title>
      <link>https://dev.to/xodiaai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xodiaai"/>
    <language>en</language>
    <item>
      <title>Your AI never sees your API keys: server code for websites, the safe way</title>
      <dc:creator>Xodia AI</dc:creator>
      <pubDate>Thu, 26 Nov 2026 12:32:00 +0000</pubDate>
      <link>https://dev.to/xodiaai/your-ai-never-sees-your-api-keys-server-code-for-websites-the-safe-way-2mfm</link>
      <guid>https://dev.to/xodiaai/your-ai-never-sees-your-api-keys-server-code-for-websites-the-safe-way-2mfm</guid>
      <description>&lt;p&gt;Most websites need a little bit of backend sooner or later. Not a whole server. One form that emails you. One checkout button. One job that runs every morning.&lt;/p&gt;

&lt;p&gt;Each of those needs a secret key, and that is where it gets awkward. The key can't go in the page, because anyone can read the page. So you set up a function somewhere, paste the key into its settings, and wire the form to it.&lt;/p&gt;

&lt;p&gt;Now add an AI assistant to that picture. If it writes your function, it's easy for the key to end up in a chat, in a file, or in a log on its way past. We wanted the code, and the AI writing it, to never hold the real key at all.&lt;/p&gt;

&lt;p&gt;This week we shipped that in Xodia as server tasks, together with a built-in database and visitor sign-in. Here's how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  A task is one file
&lt;/h2&gt;

&lt;p&gt;A server task is a file in your site's &lt;code&gt;api&lt;/code&gt; folder. Each file answers one address: &lt;code&gt;api/contact.ts&lt;/code&gt; answers &lt;code&gt;/api/contact&lt;/code&gt;. You export a function per HTTP method and return a standard &lt;code&gt;Response&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here's a trimmed version of the contact form task we ship ready-made:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt; &lt;span class="o"&gt;=&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="nc"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&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="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="nc"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&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="no"&gt;EMAIL_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;EMAIL_API_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;EMAIL_FROM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;EMAIL_TO&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&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="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="no"&gt;EMAIL_KEY&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;EMAIL_API_URL&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;EMAIL_FROM&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;EMAIL_TO&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&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="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"not_set_up"&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;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;503&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;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&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;website&lt;/span&gt; &lt;span class="p"&gt;}&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;request&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="c1"&gt;// A hidden field people never fill. Text in it means a bot.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;website&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&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="n"&gt;sent&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="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;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&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="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Add your name."&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;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;400&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;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&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="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Write a message."&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;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;400&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;// Always to EMAIL_TO, never to an address the visitor sends.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;EMAIL_API_URL&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="n"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Bearer ${EMAIL_KEY}`&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="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;EMAIL_FROM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;EMAIL_TO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`New message from ${name}`&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="sb"&gt;`${message}\n\nFrom: ${name} &amp;lt;${email}&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;reply_to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;email&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&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="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Your message couldn't be sent."&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;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;502&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="nc"&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="n"&gt;sent&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="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;The full version also checks lengths, strips line breaks from the name so nobody can sneak in mail headers, and logs only a short, key-free line when the email service says no.&lt;/p&gt;

&lt;p&gt;And from the page it's a plain &lt;code&gt;fetch("/api/contact", ...)&lt;/code&gt;. No SDK.&lt;/p&gt;

&lt;h2&gt;
  
  
  The key in your code is a stand-in
&lt;/h2&gt;

&lt;p&gt;Look at &lt;code&gt;EMAIL_KEY&lt;/code&gt; above. It looks like a normal environment variable, but the value your code gets is a stand-in, something like &lt;code&gt;xodia-key.EMAIL_KEY....&lt;/code&gt;. It's useless on its own.&lt;/p&gt;

&lt;p&gt;When you save a secret in Project settings, Keys and secrets, you also name the service it's for, like &lt;code&gt;api.your-email-service.example&lt;/code&gt;. When your task makes a request to that host, Xodia swaps the stand-in for the real key on the way out. A request to any other address goes out with the stand-in.&lt;/p&gt;

&lt;p&gt;So:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your AI can write, read and change the task all day. It only ever sees the key's name.&lt;/li&gt;
&lt;li&gt;A bug or a bad line of code that sends the key somewhere else sends a string that doesn't work.&lt;/li&gt;
&lt;li&gt;Once saved, a secret is hidden from everyone, in Studio too. To change it you replace it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some keys can't work this way, like a webhook signing secret your code has to check itself. For those you turn on "The code reads this key itself", and then every change to the tasks needs a manager's OK before it can use that key. If the change came from your AI or from autosave, Studio shows a line asking you to read it and approve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checked before it goes live
&lt;/h2&gt;

&lt;p&gt;Each new version of your server code is checked when you go live. Ready-made tasks you haven't changed go straight through. If something in your own code looks unsafe, that version is held until our team looks at it. Your preview keeps working, and the live site keeps its last checked version meanwhile.&lt;/p&gt;

&lt;p&gt;The preview runs your tasks for real, a few seconds after you change a file in &lt;code&gt;api&lt;/code&gt;. Recent calls shows each call's status, how long it took, which services it reached and what the task logged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automations: run it on a schedule
&lt;/h2&gt;

&lt;p&gt;A task can also run without a visitor. Pick Run on a schedule and choose every hour (or every 15 or 5 minutes on bigger plans), every day at a time, certain days of the week, or a day of the month. Each run is a POST with no body.&lt;/p&gt;

&lt;p&gt;The ready-made Daily check task uses this to open your pages every day and tell you when one breaks. The others are Send an email, AI answer (answer visitors' questions with your AI service), Stripe checkout, and Call a service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the data goes
&lt;/h2&gt;

&lt;p&gt;Server tasks cover the "talk to another service" part. For the "keep entries" part there is now a database built in.&lt;/p&gt;

&lt;p&gt;You turn it on, pick where most of your visitors are, and add tables. Each table gets one rule in plain words, such as "Each person sees only their own" or "Everyone sees, only you change". There are separate test and live copies, so trying things on the canvas never touches real entries, and you can bring the data back to any point in the last 30 days or download it as an SQL file.&lt;/p&gt;

&lt;p&gt;Visitor sign-in comes with it: email and password, or a code by email, with roles for people like staff.&lt;/p&gt;

&lt;p&gt;If you already use Supabase, you can connect your own project instead, and your entries stay in your account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your AI can build all of it
&lt;/h2&gt;

&lt;p&gt;Everything above works through the same MCP tools your own AI already uses to edit the site. It can add tables and fields, write and update tasks, and call a task in the preview to test it. It can't delete tables or entries, and it never sees a key's value: it tells you which key names to add, and you paste the values in yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why we built it this way
&lt;/h2&gt;

&lt;p&gt;Xodia sites are real code you own, so a backend that only lives inside our UI would break that promise. A task is a normal TypeScript file in your repo. On Pro and Agency you can download your tasks to run on your own Cloudflare account.&lt;/p&gt;

&lt;p&gt;The stand-in key was the part we cared about most. With AI writing more of the code, "never paste a key into the chat" is advice people forget. We'd rather make it impossible for the code to leak the real key in the first place.&lt;/p&gt;

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

&lt;p&gt;Server tasks are on every plan, Free included, within its limits (schedules start on Starter). The guide walks through the first task: &lt;a href="https://docs.xodia.ai/server-tasks?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=post-0004" rel="noopener noreferrer"&gt;https://docs.xodia.ai/server-tasks?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=post-0004&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The whole Apps release, with six app templates to start from: &lt;a href="https://xodia.ai/product/apps?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=post-0004" rel="noopener noreferrer"&gt;https://xodia.ai/product/apps?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=post-0004&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How do you keep API keys away from your AI assistant today: environment files, a secrets manager, or just being careful?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>security</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Is React bad for SEO? What crawlers actually get from your app</title>
      <dc:creator>Xodia AI</dc:creator>
      <pubDate>Wed, 25 Nov 2026 14:00:00 +0000</pubDate>
      <link>https://dev.to/xodiaai/is-react-bad-for-seo-what-crawlers-actually-get-from-your-app-23e7</link>
      <guid>https://dev.to/xodiaai/is-react-bad-for-seo-what-crawlers-actually-get-from-your-app-23e7</guid>
      <description>&lt;p&gt;Every few months someone on a team asks it: "Is React bad for SEO?" The short answer is no. React isn't the problem. Empty HTML is.&lt;/p&gt;

&lt;p&gt;This post shows how to check what crawlers actually get from your React app, why it matters beyond Google, and how to fix it with a small pre-render step on a Vite site. We also cover the trade-offs, because the fix isn't free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the myth comes from
&lt;/h2&gt;

&lt;p&gt;A new React app on Vite renders in the browser. The server sends one small HTML file, and a script draws the page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!doctype html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Acme&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/assets/index-a1b2c3.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;People never notice, because the browser runs the script in a blink. But anything that reads only the HTML gets a title and an empty &lt;code&gt;div&lt;/code&gt;. No headings, no text, no links to your other pages.&lt;/p&gt;

&lt;p&gt;So the honest version of the question is: does your page's content arrive in the HTML, or only after JavaScript runs?&lt;/p&gt;

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

&lt;p&gt;Google can read a client-rendered page. It just takes longer. Google's own JavaScript SEO docs describe three phases: crawl, render, index.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Googlebot fetches the HTML and queues the links it finds there.&lt;/li&gt;
&lt;li&gt;Pages that answer 200 wait in a render queue. Google says that can be a few seconds, but it can take longer.&lt;/li&gt;
&lt;li&gt;When resources allow, an up-to-date Chromium runs your JavaScript, and Google indexes the rendered page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A few things can stop a page before it renders. A &lt;code&gt;noindex&lt;/code&gt; in the first HTML may mean Google skips rendering, so a tag your JavaScript removes later may never be removed for Google. An error status can skip rendering too. And Google won't run JavaScript from files that robots.txt blocks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Google is the patient reader
&lt;/h2&gt;

&lt;p&gt;Google's docs also say server-side rendering or pre-rendering is still a great idea, because not all bots can run JavaScript.&lt;/p&gt;

&lt;p&gt;That's the part people miss. Many search engine crawlers, AI tools that read pages to answer questions, and the apps that draw link previews in chats read the HTML and stop. For a client-only app, they get the empty &lt;code&gt;div&lt;/code&gt; above. Your share tags often arrive late too, so the link preview comes out blank.&lt;/p&gt;

&lt;p&gt;Speed is the other half. With the content in the HTML, the browser can paint the page before the JavaScript loads, which helps on slow phones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check your own site in one minute
&lt;/h2&gt;

&lt;p&gt;You don't need any tools for the first check.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the page and view its source (Ctrl+U on Windows and Linux, Option+Command+U in Chrome on a Mac). Search for a sentence you can see on the page. If it isn't in the source, readers that don't run JavaScript don't see it either.&lt;/li&gt;
&lt;li&gt;Or from a terminal:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://example.com/ &lt;span class="o"&gt;|&lt;/span&gt; head -n 40
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;For Google's own answer, use URL Inspection in Search Console: Test live URL, then View tested page. It shows the HTML after Google rendered it, plus a screenshot.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Check the home page, one key page and one blog post. Client-only rendering usually affects every page the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: pre-render your routes at build time
&lt;/h2&gt;

&lt;p&gt;If your pages are known when you build (a business site, a portfolio, docs, a blog), you don't need a server. Render each route to an HTML file during the build, then let React take over in the browser.&lt;/p&gt;

&lt;p&gt;Vite's SSR guide covers the pattern. Here's a minimal version for a Vite app whose &lt;code&gt;App&lt;/code&gt; declares its pages with React Router's &lt;code&gt;&amp;lt;Routes&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;Route&amp;gt;&lt;/code&gt;. First, a server entry that renders one URL to a string:&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="c1"&gt;// src/entry-server.jsx&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;renderToString&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-dom/server"&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;StaticRouter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-router"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./App"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&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="nf"&gt;renderToString&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;StaticRouter&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;url&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="nc"&gt;App&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="nc"&gt;StaticRouter&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;In &lt;code&gt;index.html&lt;/code&gt;, add two placeholders, one in the head and one inside the root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!--app-head--&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/src/main.jsx"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&lt;span class="c"&gt;&amp;lt;!--app-html--&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then a small script writes one HTML file per route, each with its own title and description:&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;// prerender.js (run with "type": "module" in package.json)&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:fs"&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;path&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:path"&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;render&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./dist/server/entry-server.js"&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;template&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"dist/client/index.html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"utf-8"&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;pages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s2"&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;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Handmade lamps"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Lamps made to order."&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"/about"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"About us"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Who makes the lamps."&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"/pricing"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Pricing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"How we price a lamp."&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="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;url&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="k"&gt;of&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pages&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;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`&amp;lt;title&amp;gt;${meta.title}&amp;lt;/title&amp;gt;
    &amp;lt;meta name="description" content="${meta.description}" /&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;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;!--app-head--&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;!--app-html--&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&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;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"/"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"index.html"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`${url.slice(1)}/index.html`&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;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"dist/client"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdirSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dirname&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&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;recursive&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;html&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;The build becomes three steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vite build --outDir dist/client
vite build --ssr src/entry-server.jsx --outDir dist/server
node prerender.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the client, swap &lt;code&gt;createRoot&lt;/code&gt; for &lt;code&gt;hydrateRoot&lt;/code&gt; and wrap &lt;code&gt;App&lt;/code&gt; in &lt;code&gt;BrowserRouter&lt;/code&gt;, so React picks up the HTML that's already there instead of drawing it again:&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="c1"&gt;// src/main.jsx&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;hydrateRoot&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-dom/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="nc"&gt;BrowserRouter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-router"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./App"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;hydrateRoot&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;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"root"&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="nc"&gt;BrowserRouter&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="nc"&gt;App&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="nc"&gt;BrowserRouter&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;Run the curl check again. Each route's title, heading and text are in the source now, on any static host that serves &lt;code&gt;about/index.html&lt;/code&gt; for &lt;code&gt;/about&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two things to add before you ship it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Canonical and share tags.&lt;/strong&gt; Put them in the same head string as the title. Google can read a canonical set by JavaScript, but says HTML is the best place for it, and link previews only read the HTML.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A real page list.&lt;/strong&gt; A hard-coded map goes stale. Generate it from your router config or your content folder, and write sitemap.xml from the same list. If your titles or descriptions can contain quotes or &lt;code&gt;&amp;lt;&lt;/code&gt;, escape them first.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you'd rather not wire this by hand, React Router's framework mode can pre-render the paths you list, and React has a &lt;code&gt;prerender&lt;/code&gt; API in &lt;code&gt;react-dom/static&lt;/code&gt; for the same job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trade-offs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pre-rendering&lt;/strong&gt; gives every reader the full page from cheap static hosting. The cost is a rebuild whenever content changes. That's fine for content that changes a few times a day. It's wrong for prices or stock that change by the minute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server rendering&lt;/strong&gt; builds the HTML on each request. It suits pages that differ per visitor or change constantly. The cost is a server to run, and code that has to work without &lt;code&gt;window&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hydration bugs&lt;/strong&gt; come with both. Anything that reads the browser at render time (&lt;code&gt;window&lt;/code&gt;, &lt;code&gt;localStorage&lt;/code&gt;, the current time) can render differently on the server and the client. Move it into an effect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Serving bots a separate rendered copy&lt;/strong&gt; is called dynamic rendering. Google calls it a workaround and not a recommended solution. Pre-rendering sends the same HTML to everyone, so it isn't cloaking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Leaving it client-only&lt;/strong&gt; is fine for an app behind a login. Nobody needs to find your settings page in search.&lt;/p&gt;

&lt;p&gt;And whatever you pick, the basics still apply: real &lt;code&gt;&amp;lt;a href&amp;gt;&lt;/code&gt; links, one address per view with the History API (not &lt;code&gt;#&lt;/code&gt; fragments), a real 404 status for missing pages, and main text in the first render, not behind a click or a scroll. Google doesn't click or scroll.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where we landed
&lt;/h2&gt;

&lt;p&gt;We build Xodia, a visual website builder for real React code on Vite, so we had to answer this for the sites it builds. Sites from our templates are pre-rendered: each page is an HTML file with its title, description, headings, text and links, on any static host. xodia.ai itself is built the same way.&lt;/p&gt;

&lt;p&gt;We wrote the longer version, with the checks step by step, the full list of fixes and an FAQ, here: &lt;a href="https://xodia.ai/guides/react-seo?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=post-0003" rel="noopener noreferrer"&gt;Is React bad for SEO? How to make a React site search engines can read&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;How do you ship your React sites today: client-only, pre-rendered or server-rendered?&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>seo</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Edit a Claude Code site visually without spending tokens on padding</title>
      <dc:creator>Xodia AI</dc:creator>
      <pubDate>Mon, 16 Nov 2026 03:51:44 +0000</pubDate>
      <link>https://dev.to/xodiaai/edit-a-claude-code-site-visually-without-spending-tokens-on-padding-9cj</link>
      <guid>https://dev.to/xodiaai/edit-a-claude-code-site-visually-without-spending-tokens-on-padding-9cj</guid>
      <description>&lt;p&gt;Claude Code can build a whole site in an afternoon. The part nobody warns you about is the week after, when every change is small.&lt;/p&gt;

&lt;p&gt;"Make the gap under the hero a bit smaller."&lt;br&gt;
"Same heading, but smaller on phones."&lt;br&gt;
"Swap that photo."&lt;/p&gt;

&lt;p&gt;Each one is a full round trip. The agent reads the files again, decides what you meant, edits, and sometimes tidies up a section you didn't ask it to touch. For a change you could describe with one class name, that's a lot of tokens and a lot of reviewing.&lt;/p&gt;

&lt;p&gt;This post shows how we split that work: the agent keeps the big jobs, and the small visual ones get done by hand, on the same code, without a prompt.&lt;/p&gt;
&lt;h2&gt;
  
  
  Which edits to keep away from the agent
&lt;/h2&gt;

&lt;p&gt;A rough rule we use: if you can point at it, don't describe it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Send to the agent&lt;/th&gt;
&lt;th&gt;Do it by hand&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A new page or section&lt;/td&gt;
&lt;td&gt;Spacing, padding, gaps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New behaviour (a form, a filter, a search)&lt;/td&gt;
&lt;td&gt;One colour or font size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Refactors and data changes&lt;/td&gt;
&lt;td&gt;A line of copy, a typo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Make this page work like that one"&lt;/td&gt;
&lt;td&gt;A different photo or link&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;The same thing, but only on phones&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The right column is where prompts get expensive for what they are. The change is tiny, but explaining it precisely takes longer than doing it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Option 1: stay in your editor
&lt;/h2&gt;

&lt;p&gt;You don't need a tool for this. Two habits make hand edits on agent-written code a lot faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Find the element by its classes, not its file.&lt;/strong&gt; Open the page in the browser, inspect the element, copy a class that looks unique, and search for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -rn &lt;span class="s2"&gt;"py-24"&lt;/span&gt; src/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Agents tend to repeat the same class strings, so if you get several hits, add a second class from the same element to the search.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Change one breakpoint at a time.&lt;/strong&gt; Tailwind is mobile first: an unprefixed class applies everywhere, and &lt;code&gt;md:&lt;/code&gt; and up only kick in on wider screens. So "smaller on phones only" means changing the unprefixed class and putting the old value back on &lt;code&gt;md:&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- before --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-6xl font-bold"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- after: smaller on phones, same on desktop --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-4xl md:text-6xl font-bold"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the whole trick, and it works fine for a handful of edits. It gets slow when you're making twenty of them while someone looks over your shoulder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 2: edit it visually, on the same code
&lt;/h2&gt;

&lt;p&gt;This is the part we build. Xodia opens your repo as it is, shows the site, and lets you click things and change them. The edits are written back into your files as normal code: Tailwind classes stay Tailwind classes, plain CSS stays plain CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Put the code on GitHub
&lt;/h3&gt;

&lt;p&gt;If Claude Code built the site in a local folder, push it to a repo first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
git add .
git commit -m &lt;span class="s2"&gt;"Site built with Claude Code"&lt;/span&gt;
git branch -M main
git remote add origin git@github.com:you/your-site.git
git push -u origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Import the repo
&lt;/h3&gt;

&lt;p&gt;In Xodia, connect GitHub under Connections, then New project, Import from GitHub, and pick the repo. Xodia detects the framework and styling and opens the site.&lt;/p&gt;

&lt;p&gt;It works with React or plain JavaScript on Vite (with or without React Router) and plain HTML sites, styled with Tailwind 4, plain CSS, CSS Modules or Sass. Next.js and Astro sites are refused at import, with the reason, rather than half working.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Click and change
&lt;/h3&gt;

&lt;p&gt;Click any element on the page. Double-click text to type. The Style panel on the right has spacing, size, colour and layout, and it changes the classes on that element only.&lt;/p&gt;

&lt;p&gt;For "only on phones", pick a phone width in the top bar and make the change there. It's written as a class for that screen size, so the desktop layout stays as it was.&lt;/p&gt;

&lt;p&gt;None of this uses AI credits. It's just editing.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Keep Claude Code on the same site
&lt;/h3&gt;

&lt;p&gt;Here's the part that makes the split work. Connect Claude Code to Xodia and it edits the same project you're looking at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude plugin marketplace add https://app.xodia.ai/plugin/marketplace.json
claude plugin install xodia@xodia
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart Claude Code, type &lt;code&gt;/mcp&lt;/code&gt;, pick &lt;code&gt;xodia&lt;/code&gt; and sign in.&lt;/p&gt;

&lt;p&gt;Now when something is too big to do by hand, select the element, type the request in the ask box, and run &lt;code&gt;/xodia:work&lt;/code&gt; in Claude Code. It picks up the request knowing exactly which element you meant, so you skip the "the second card in the pricing section, no, the other one" part.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Push like normal
&lt;/h3&gt;

&lt;p&gt;Your edits and Claude Code's land side by side. When you're happy, push them as a commit to your branch, open a PR if you review changes, and your host deploys as it does today. Pushing to your own GitHub is on the paid plans; on the free plan your edits stay saved in Xodia until you upgrade.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we'd still ask the agent for
&lt;/h2&gt;

&lt;p&gt;To be fair to the agent: anything that needs a decision. A new section that has to match the rest of the site, a form that sends somewhere, a page that pulls from a CMS. Those are worth the tokens, and the agent is good at them.&lt;/p&gt;

&lt;p&gt;The win is not paying for "4px less padding" at the same rate.&lt;/p&gt;

&lt;p&gt;If you want the longer version with every step, we wrote a guide: &lt;a href="https://xodia.ai/guides/edit-claude-code-site-visually?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=post-0002" rel="noopener noreferrer"&gt;Edit a site built with Claude Code, visually&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What's the smallest change you asked an agent for this month?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>claude</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Hi DEV, we build Xodia. Tell us about the last small edit that cost you a whole prompt</title>
      <dc:creator>Xodia AI</dc:creator>
      <pubDate>Thu, 12 Nov 2026 02:23:09 +0000</pubDate>
      <link>https://dev.to/xodiaai/hi-dev-we-build-xodia-tell-us-about-the-last-small-edit-that-cost-you-a-whole-prompt-19k</link>
      <guid>https://dev.to/xodiaai/hi-dev-we-build-xodia-tell-us-about-the-last-small-edit-that-cost-you-a-whole-prompt-19k</guid>
      <description>&lt;p&gt;Hi DEV!&lt;/p&gt;

&lt;p&gt;We're Zuzo Studio, a small team building &lt;a href="https://xodia.ai/" rel="noopener noreferrer"&gt;Xodia&lt;/a&gt;, a visual website builder for real code.&lt;/p&gt;

&lt;p&gt;Here's why we started. AI tools got really good at building a whole site in one go. Then you want the hero a bit tighter on mobile, or one button in a different colour, and suddenly you're writing a paragraph of instructions, spending credits, and hoping it doesn't break the footer.&lt;/p&gt;

&lt;p&gt;So we're building the other half: you click the thing and change it, on your own code, at every screen size. Your AI still does the big jobs.&lt;/p&gt;

&lt;p&gt;That's enough about us. We'd rather hear from you.&lt;/p&gt;

&lt;p&gt;Drop a comment with the last small edit that took you way longer than it should have. A spacing fix, a colour, one line of text, anything. We'll read every comment and reply to each one, with a fix if we know one.&lt;/p&gt;

&lt;p&gt;If you're new here too, say hi. This is our first post on DEV, so we're in the same boat.&lt;/p&gt;

&lt;p&gt;See you in the comments.&lt;/p&gt;

</description>
      <category>introduction</category>
      <category>webdev</category>
      <category>ai</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
