FIKR.SPACE LIVE · Q3 2026 LAUNCH
FOUNDING / 200 JOIN FOUNDING
Home/Blog/AI Software Development/Edge SSR vs Next.js: Why We Chose Cloudf…
AI Software Development

Edge SSR vs Next.js: Why We Chose Cloudflare Workers for SEO

How we achieved sub-50ms response times and saved 95% on infrastructure costs by choosing Cloudflare Workers over Next.js for server-side rendering.

How we achieved sub-50ms response times and saved 95% on infrastructure costs while keeping our existing React + Vite setup

The Problem: React + Vite Without Framework Lock-In

When we started building FIKR's web platform, we made a deliberate choice to use React with Vite as our build tool. The decision was driven by a desire for maximum development velocity and complete control over our architecture. Vite's lightning-fast hot module replacement and minimal configuration made our development experience incredibly smooth. We could ship features fast, iterate quickly, and maintain a codebase that our team understood deeply.

But there was one massive problem we couldn't ignore: search engines saw nothing but blank HTML pages.

Every page in our application loaded as an empty shell with a single div element. The actual content was rendered client-side through JavaScript after the page loaded. For human users with modern browsers, this worked perfectly fine. They'd see a brief loading state, then the full application would appear. But for search engine crawlers, especially Google's bot, our pages were effectively invisible. No content meant no indexing. No indexing meant no organic traffic. No organic traffic meant we were leaving a massive growth channel completely untapped.

We knew we needed server-side rendering, but we faced a difficult decision about how to implement it. The most obvious path was migrating our entire codebase to Next.js, the de facto standard for React applications that need SSR. Next.js is an incredible framework with excellent documentation, a massive community, and battle-tested solutions for almost every common problem. But migration would mean 4-6 weeks of pure infrastructure work with zero new features shipped.

The second option was building a custom server-side rendering solution with traditional Node.js servers. We could keep our existing React + Vite setup for development and add a Node.js server that would render pages on demand. This would give us complete control, but it came with its own set of challenges. We'd need to provision servers, configure load balancers, handle scaling, manage deployments, and deal with the operational complexity of running stateful services.

Then we discovered a third option that changed everything: Edge Server-Side Rendering with Cloudflare Workers. It promised fast response times, minimal infrastructure costs, and zero migration work on our existing codebase.

THE COMPLETE SYSTEM TO SCALE YOUR STARTUP

From strategic planning to execution, FIKR gives you every tool needed to grow from idea to exit.

START FOR FREE →

No credit card required • Setup in 5 minutes

Understanding Edge SSR

Edge Server-Side Rendering fundamentally changes where your rendering logic runs. Instead of having a centralized server farm in one region that handles all rendering requests, your code runs at Cloudflare's 300+ edge locations distributed around the world. When someone requests a page from your application, that request is automatically routed to the nearest edge location, typically within 50 miles of the user.

Here's what happens when Googlebot crawls one of our pages:

  1. Request hits nearest Cloudflare edge (typically <5ms latency)
  2. Edge Worker detects bot/crawler via User-Agent header
  3. Worker fetches our React app bundle and renders HTML server-side
  4. Fully-rendered HTML returned to bot in <50ms total
  5. Humans get the normal client-side React app (instant, cached)

But here's the elegant part: when a human user requests that same page, the worker serves them our normal client-side React application. They get the fast, interactive single-page application experience we originally built, with instant navigation and smooth transitions. We're effectively serving two different versions of our application based on who's requesting it, but maintaining only one codebase.

This approach gave us the best of both worlds. Search engines get server-rendered HTML that they can crawl and index properly. Human users get the snappy, app-like experience of a client-side rendered application. And we don't have to maintain two separate codebases or deal with the complexity of universal rendering frameworks.

Why We Didn't Choose Next.js

Next.js is phenomenal, and we want to be clear about that upfront. It's the right choice for many projects, and we seriously considered migrating to it. The framework has solved countless problems around server-side rendering, has excellent developer experience, and benefits from a massive ecosystem of plugins and community support. If we were starting from scratch today, Next.js would absolutely be on the short list of frameworks to evaluate.

But we weren't starting from scratch. We had an existing React + Vite application that was working well for our team. Migration to Next.js would mean fundamentally restructuring how our application works. Our current routing system would need to be rewritten to use Next.js's file-based routing. Our data fetching logic, which uses React Query and custom hooks, would need to be adapted to work with Next.js's data fetching methods like getServerSideProps and getStaticProps.

Here are the key factors that made us hesitant about Next.js:

  • Migration Time: 4-6 weeks of pure infrastructure work with zero new features
  • Framework Lock-in: Complete dependency on Next.js conventions and patterns
  • Infrastructure Costs: $100/month for Pro team, potentially $1000s/month at Enterprise scale
  • Build Complexity: 85,000+ pages to regenerate with each content change
  • Multi-tenant Challenges: Complex caching and invalidation for 1000+ organizations

Edge SSR with Cloudflare Workers offered a fundamentally different approach. Every page renders on demand at the edge, so there are no builds to manage. Content updates are instant. Organizations can change their pages and see those changes reflected immediately in search results. And because rendering happens at the edge rather than on centralized servers, we get fast response times globally without needing to think about regional deployments or caching strategies.

The Cloudflare Workers Economics

One of the most surprising aspects of our Edge SSR implementation was how inexpensive it turned out to be. Cloudflare Workers operates on a generous free tier that includes 100,000 requests per day. For most applications, that free tier is enough to get started. Once you exceed the free tier, pricing is straightforward: $5 per month for the Workers Paid plan, which includes 10 million requests per month.

Let's break down what you get for $5/month:

  • 10M requests/month included (~330,000 requests/day)
  • Workers KV caching: 1GB storage + 10M reads/month
  • Edge rendering: 300+ locations worldwide automatically
  • No egress fees: Unlimited bandwidth included
  • No cold starts: Workers stay warm globally

Compare this to running a similar setup on AWS. You'd need Lambda functions for your rendering logic, which start at $0.20 per million requests but quickly add up with the GB-seconds pricing model. You'd need API Gateway in front of your Lambda functions, adding another $3.50 per million requests. You'd probably want CloudFront as a CDN, which adds bandwidth costs. And you'd need S3 for storing static assets. For equivalent traffic to what we're handling, a conservative estimate would be $100-500 per month in AWS costs.

The economics become even more compelling when you consider performance. Our edge workers typically respond in 35-50 milliseconds at the 95th percentile. This includes the time to detect whether the request is from a bot, fetch necessary data, render the React component tree, and return the HTML. Next.js on Vercel, in our testing, typically takes 200-500 milliseconds for dynamic SSR. Traditional Node.js servers, especially if they're not geographically close to the user, can take 300-800 milliseconds or more.

That performance difference matters for SEO. Google's Core Web Vitals include metrics like Largest Contentful Paint and First Contentful Paint, which directly measure how quickly users see content. Faster server response times translate to better scores on these metrics, which can influence rankings. We've seen our Lighthouse SEO scores jump from 45/100 (when we had no SSR) to 98/100 after implementing Edge SSR.

THE COMPLETE SYSTEM TO SCALE YOUR STARTUP

From strategic planning to execution, FIKR gives you every tool needed to grow from idea to exit.

START FOR FREE →

No credit card required • Setup in 5 minutes

Implementation Architecture

Our implementation stack is deliberately simple. On the frontend, we kept our existing React 18 application built with Vite. Nothing changed here - same component structure, same routing logic, same state management. Cloudflare Workers handles the edge rendering layer. When a bot requests a page, the worker imports our React components, executes them server-side, and generates HTML. Workers KV provides a caching layer for metadata, dramatically reducing how often we need to query our database.

The request flow is straightforward but powerful. When a user or bot requests a page, their request hits Cloudflare's edge network. A worker intercepts the request and checks the User-Agent header using a simple regex pattern that identifies common bots. If it's a bot, the worker follows the SSR path. If it's a human user, the worker simply serves our cached React bundle and lets the application render client-side as normal.

Bot Detection Pattern:

const isBot = /googlebot|bingbot|slurp|duckduckbot|baiduspider|yandexbot|facebookexternalhit|twitterbot|linkedinbot/i.test(userAgent);

This pattern covers the vast majority of crawlers that matter for SEO and social media previews. It's simple, fast, and effective.

Server-Side Rendering Implementation:

import { renderToString } from 'react-dom/server';
import App from './App';

// Fetch page data from Workers KV or Supabase
const pageData = await getPageData(slug);

// Render React component to HTML string
const html = renderToString(<App data={pageData} />);

// Inject into full HTML document
const fullHtml = `
<!DOCTYPE html>
<html>
  <head>
    <title>${pageData.title}</title>
    <meta name="description" content="${pageData.description}" />
    <meta property="og:title" content="${pageData.title}" />
    <meta property="og:image" content="${pageData.image}" />
  </head>
  <body>
    <div id="root">${html}</div>
    <script>window.__INITIAL_DATA__ = ${JSON.stringify(pageData)}</script>
  </body>
</html>
`;

return new Response(fullHtml, {
  headers: { 'Content-Type': 'text/html' }
});

We also inject structured data using JSON-LD format. Every blog post, product page, and organizational profile includes appropriate Schema.org markup. This helps search engines understand the content and potentially display it in rich results. The structured data is rendered server-side, so bots see it immediately without needing to execute JavaScript.

Real Results After 30 Days

The impact of Edge SSR on our SEO was dramatic and measurable. Before implementation, Google had indexed exactly zero of our pages. When Googlebot crawled our site, it saw empty shells with no content, so there was nothing to index. Our search traffic was zero. Our Lighthouse SEO score was 45 out of 100, primarily because we had proper meta tags but no content for crawlers to find.

Thirty days after deploying Edge SSR, the transformation was complete:

Before Edge SSR:

  • Google indexed: 0 pages
  • Search traffic: 0 impressions, 0 clicks
  • Lighthouse SEO score: 45/100
  • Average TTFB: N/A (pages were blank)

After Edge SSR (30 days):

  • Google indexed: 85 pages
  • Search impressions: 12,400/month
  • Search clicks: 340/month (2.7% CTR)
  • Lighthouse SEO score: 98/100
  • Average TTFB: 42ms globally
  • Infrastructure cost: $5/month

The infrastructure cost for all of this? Five dollars per month. That's not a typo. We're serving fully rendered pages to search engines, processing hundreds of thousands of requests per month, and maintaining sub-50ms response times globally, all for the price of a fancy coffee.

If we had gone with Next.js on Vercel for a team of five developers, we'd be paying $100 per month on the Pro plan. Over a year, that's $1,200 compared to $60 for Cloudflare Workers. The savings are $1,140 per year, or about 95% cost reduction. And that's assuming we stayed on the Pro plan - if we hit Enterprise tier as we scale, the savings would be even more dramatic.

Challenges We Had to Overcome

Implementing Edge SSR wasn't without challenges. The first major hurdle was bundle size. Cloudflare Workers have a 1MB limit for the total script size after compression. Our full React application bundle was 2.3MB, which was more than double the limit. We couldn't just upload our entire application to run on the edge.

The solution required careful dependency analysis and code splitting:

  • Stripped client-only dependencies (analytics, form validation, UI helpers)
  • Lazy-loaded heavy components (rich text editor, data visualizations)
  • Tree-shook unused code paths from SSR bundle
  • Used dynamic imports for route-specific components
  • Final SSR bundle: 850KB (comfortably under 1MB limit)

The second challenge was database latency. Our Supabase instance is hosted in us-east-1 (US East Coast). When an edge worker in Europe needs to query the database to render a page, that query crosses the Atlantic Ocean, resulting in 80-100 milliseconds of latency. This wasn't terrible, but it was the single biggest contributor to our response times.

We addressed this through aggressive caching in Workers KV:

  • Page metadata: Cached at edge with 1-hour TTL
  • Organization data: Cached with 6-hour TTL (rarely changes)
  • Blog post content: Cached with 30-minute TTL
  • Result: 90% reduction in database queries

The third challenge was React hydration mismatches. When you render HTML on the server and then try to "hydrate" it on the client (attach event listeners and make it interactive), React expects the server-rendered HTML to match exactly what the client would render. Any differences cause warnings or errors.

We fixed these by ensuring deterministic rendering:

  • Server serializes all data into window.__INITIAL_DATA__
  • Client reads that data for hydration (ensures identical renders)
  • Timestamps passed as formatted strings (not formatted separately)
  • Random IDs use seeded generator (same sequence on server and client)
  • localStorage checks skip during SSR (server doesn't have localStorage)

When Edge SSR Makes Sense vs Next.js

Edge SSR with Cloudflare Workers isn't the right solution for every project, and it's important to be honest about when it makes sense and when other approaches might be better.

Choose Edge SSR (Cloudflare Workers) if:

  • You already have React/Vue/Svelte + Vite (no migration cost)
  • You're building multi-tenant SaaS with dynamic content
  • You need sub-50ms response times globally
  • You want $5/month infrastructure costs
  • You prioritize zero build times (instant content updates)
  • You want to avoid framework lock-in

Choose Next.js if:

  • You're starting a new project from scratch
  • You want full-stack framework with conventions (routing, API routes)
  • Your content is mostly static (blogs, marketing sites)
  • You have budget for Vercel/AWS ($100-500/month)
  • You value mature ecosystem with plugins and community support
  • You need ISR (Incremental Static Regeneration)

Final Thoughts

Building our Edge SSR solution with Cloudflare Workers turned out to be one of the best architectural decisions we made for FIKR. We achieved Next.js-level SEO performance without migrating our framework, at 5% of the infrastructure cost, with response times 10x better than traditional SSR approaches. We went from zero search visibility to having 85 pages indexed and generating meaningful organic traffic, all while keeping our development velocity high.

The best part is the complete lack of framework lock-in. We kept our existing React + Vite setup that our team knows well. If Cloudflare Workers stopped meeting our needs tomorrow, we could switch to a different edge provider or even go back to traditional servers without rewriting our core application. The edge rendering layer is completely separate from our application code.

Implementation took three days from initial prototype to production deployment. The first day was spent understanding Cloudflare Workers and figuring out how to render React components at the edge. The second day was optimizing bundle size and implementing caching strategies. The third day was testing, fixing hydration issues, and deploying to production.

Every organization on our platform now gets SEO-optimized pages automatically, rendered in under 50 milliseconds anywhere in the world, for a total infrastructure cost of five dollars per month. If you're building a modern web application with React or another component framework, and you need SEO without sacrificing performance or taking on framework lock-in, Edge SSR is absolutely worth considering.

THE COMPLETE SYSTEM TO SCALE YOUR STARTUP

From strategic planning to execution, FIKR gives you every tool needed to grow from idea to exit.

START FOR FREE →

No credit card required • Setup in 5 minutes

LG

Luis Goncalves

// Founder & CEO at FIKR Space

Three-time founder. Built and exited Evolution4All before this. Now building FIKR Space — the operating infrastructure underneath every innovation ecosystem (startups, accelerators, governments, investors). Lisbon-based, works global.