Deploy, Convert & Scale
SEO for AI-Built React SPAs: Prerendering vs. SSR
Most AI app builders generate client-rendered React single-page apps, which serve an almost empty HTML shell until JavaScript runs. Google can render JavaScript, but indexing is slower, social previews and many AI crawlers see little, and every route shares the same metadata by default. The fix is per-route metadata plus either prerendering public routes, moving to server-side rendering, or separating the marketing site from the app.
Why SPAs struggle with SEO
A client-rendered SPA returns the same nearly empty index.html for every URL, so crawlers that do not execute JavaScript see no content and identical titles.
Google renders JavaScript in a second step, which works but can delay indexing and fails if scripts error or data loads slowly. Link preview bots on social and messaging platforms usually do not run JavaScript, and many AI assistants' crawlers rely heavily on the raw HTML. If you want to appear in AI answers, the content must be in the HTML.
Check what crawlers actually receive: fetch a page with JavaScript disabled or with a simple command-line request and look at the HTML. If the title, headings and main text are missing, so is your content for many bots.
Baseline fixes every SPA needs
Even before prerendering, give every route its own metadata, crawlable links and correct status codes.
These steps are quick to implement with any AI coding tool and remove the most common problems.
- Unique title, meta description and canonical URL per route (for example with react-helmet-async).
- Real anchor links with href, not click handlers, for navigation.
- sitemap.xml listing public routes and a robots.txt that references it.
- Open Graph and Twitter card tags for sharing.
- Proper 404 handling, ideally with a real 404 status from the host for unknown paths.
- Structured data (JSON-LD) for organization, products, articles or FAQs where relevant.
Option 1: Prerender public routes at build time
Prerendering generates static HTML for known public routes during the build, keeping your Vite SPA architecture intact.
This is often the best fit for Lovable, Bolt.new or AI Studio apps: marketing pages, pricing, feature pages and blog posts become full HTML files that hydrate into the React app. Use a Vite prerender plugin or a static-site-generation tool for React, list the routes to render, and make sure those pages do not depend on logged-in data. Pages that need fresh data at request time are better served with SSR.
Option 2: Server-side rendering with a framework
SSR renders HTML on each request (or from a cache), which suits large or frequently changing content such as listings, marketplaces or user-generated pages.
Moving a Vite SPA to Next.js, Remix-style React Router framework mode or Astro with React islands is a real migration, but AI coding agents handle much of the mechanical work well. v0 apps built on Next.js already have this capability; make sure content pages are server components and use the framework's metadata features.
Option 3: Split the marketing site from the app
Often the simplest strategy is to host public content on a static or SSR site at the main domain and run the SPA at app.yourdomain.com.
The app behind login does not need SEO at all, while the marketing site gets a framework built for search. This avoids retrofitting SSR into a codebase that an AI builder keeps regenerating, and lets marketing ship content independently. Dynamic rendering (serving bots a different prerendered version) still exists but Google describes it as a workaround rather than a long-term solution, so prefer the options above.
- List which routes must rank and which are app-only.
- Choose prerendering, SSR or a split site per route group.
- Implement metadata, sitemap and structured data.
- Verify with Search Console URL inspection and a no-JavaScript fetch.
- Monitor indexing and Core Web Vitals after launch.
Performance is part of SEO
Core Web Vitals matter for rankings and conversions, and SPAs often ship too much JavaScript.
Code-split by route, lazy-load heavy libraries, compress images and preload critical fonts. Measure on a mid-range phone profile, because the developer laptop hides the problems your users experience.
Frequently asked questions
Can Google index a React SPA?
Yes, Google renders JavaScript, but indexing can be slower and less reliable than with server-rendered HTML. Other crawlers, including many social and AI bots, see much less.
Is prerendering or SSR better?
Prerendering suits a limited set of public pages that change occasionally. SSR suits large or frequently changing content. Many AI-built apps get the best result from prerendering or a separate marketing site.
Does a Lovable app need SSR for SEO?
Not necessarily. Per-route metadata plus prerendering of public pages, or a separate marketing site, usually solves SEO without migrating the whole app to SSR.
Do AI assistants like ChatGPT or Perplexity read JavaScript apps?
Their crawlers vary, and many rely mainly on the HTML they receive. Server-rendered or prerendered content with clear structure gives you the best chance of being understood and cited.
