DEV Community

Cover image for Next.js Hosting for Headless CMS
Kevinleary.net
Kevinleary.net

Posted on Originally published at kevinleary.net

Next.js Hosting for Headless CMS

If you want to use Next.js as the frontend for a headless CMS, this covers where to host it and what each option costs you in money and DevOps effort.

On paper, Next.js runs anywhere Node.js runs, especially with the official Deployment Adapters API introduced in Next.js 16.2. In production it's a different story. A headless CMS frontend depends on multi-layered caching, webhook-driven revalidation, image optimization and isolated preview environments, and the caching features (ISR, tag-based revalidation, App Router data caches and next/image) behave very differently depending on where you host.

Put a Next.js build on the wrong setup without shared cache handlers and an edge CDN, and server instances fall out of sync, background revalidations stall, or the cloud bill explodes during a traffic spike.

For headless CMS websites, Next.js hosting breaks down into two tiers: managed and edge platforms (Vercel, Netlify, Kinsta and Cloudflare Workers) and direct enterprise cloud infrastructure (Microsoft Azure, AWS and Google Compute Engine).

Managed & Edge Platforms

Managed and serverless edge platforms take care of virtual machine patching, load balancers and CDN routing. You connect a GitHub repository and get live PR preview URLs right away.

Vercel

Vercel created and maintains Next.js, so it's the reference implementation. Every Next.js feature, from React Server Components and Skew Protection to sub-300ms global tag revalidation, works on Vercel on release day with no infrastructure glue code.

  • Why developers love it: iteration speed. Per-branch preview URLs, inline visual commenting for stakeholders and Fluid Compute serverless execution make prototyping and multi-developer workflows easy.
  • The catch: cost predictability and procurement. Per-seat developer licensing, steep jumps to enterprise contracts, and overages on bandwidth, image optimization and serverless compute add up on high-traffic media websites. Large organizations routinely get "Vercel bill shock" once traffic scales.

Netlify

Netlify pioneered the decoupled CMS movement, and it's still one of the most widely used hosts for content-driven headless builds, particularly with marketing organizations and multi-site monorepos.

  • How it runs Next.js: Netlify maintains a dedicated OpenNext adapter that maps the App Router, ISR and revalidateTag calls onto Netlify's fine-grained CDN cache and Edge Functions.
  • Where it beats Vercel: seat-friendly team pricing (unlimited reviewer and developer seats on the credit-based Pro tiers), cleaner monorepo controls for organizations running multiple regional brands out of one repo, built-in observability, and support for self-hosted Git or Azure DevOps repositories without an immediate jump to an enterprise tier.

Kinsta Application Hosting

Almost nobody in React forums talks about Kinsta's Application Hosting for Next.js, mostly because Kinsta built its reputation as a managed WordPress host. Overlooking it is a mistake, especially for headless WordPress migrations or lean teams that want persistent Node.js containers without DevOps overhead.

  • Under the hood: persistent containerized Node.js applications (built with Nixpacks, Buildpacks or a custom Dockerfile) on Google Cloud compute-optimized VMs, with a Cloudflare Enterprise CDN included in front for DDoS protection, HTTP/3 and global edge caching.
  • No cold starts or seat taxes: serverless functions spin down and bill per invocation or per developer seat. Kinsta bills by container resources (RAM and CPU) with no per-seat developer fees.
  • One stack for headless WordPress: if your editors use WordPress as the headless CMS, you can host the locked-down WordPress backend and the Next.js container in the same MyKinsta dashboard, connected inside the same data center region and shielded by Cloudflare Enterprise. It's a clean, single-vendor architecture.

Cloudflare Workers

For high-bandwidth publishers who want global edge scale without managing virtual machines or paying Vercel's bandwidth markups, hosting Next.js directly on Cloudflare Workers has matured into a strong fourth option.

Cloudflare supports Next.js on Workers with native Node.js compatibility through two toolchains: vinext (Cloudflare's Vite-powered Next.js implementation, recommended for new Workers projects) and the @opennextjs/cloudflare adapter (which transforms standard next build standalone output for existing Next.js 15 and 16 applications).

  • Edge-native caching and assets: static files are served from Workers Static Assets, next/image hands optimization to Cloudflare Images, and the ISR and tag caches bind to Cloudflare R2, KV and Durable Objects (or the Workers Response Store in vinext).
  • Zero egress: Cloudflare charges no egress bandwidth fees on Workers and R2. If your headless CMS powers a media property serving terabytes of HTML and JSON during viral traffic spikes, removing bandwidth overages alone can save tens of thousands of dollars a year.
  • The caveats: Workers run on lightweight V8 isolates, not full Linux VMs. You can't rely on traditional persistent TCP connection pools, heavy uncached React Server Component renders use up metered CPU milliseconds, and you need to verify adapter compatibility (npx vinext check or pinned @opennextjs/cloudflare versions) instead of upgrading Next.js on release day.

Enterprise Cloud Hosting: Azure, AWS & GCP

For mid-market and Fortune 500 CTOs, adding a new third-party hosting vendor often hits a wall in InfoSec and procurement. These organizations already have seven-figure committed spend agreements (MACCs and EDPs), strict single sign-on governance, private virtual networks (VNets and VPCs) and compliance mandates inside Microsoft Azure, AWS or Google Cloud.

Self-hosting Next.js on one of the big three clouds gives you complete infrastructure control and much lower unit costs at scale, as long as you configure Next.js with output: 'standalone' and solve distributed cache synchronization.

The golden rule of self-hosting Next.js: out of the box, a self-hosted Next.js server writes its ISR and fetch caches to local disk. As soon as your auto-scaler spins up 3 or 10 instances, an editorial revalidation webhook only updates the disk on instance 1, and instances 2 through 10 keep serving stale articles. Every multi-instance setup needs a custom Next.js cacheHandler backed by shared Redis (Azure Managed Redis, AWS ElastiCache or GCP Memorystore) so every node shares one source of truth.

Microsoft Azure

In corporate IT, healthcare, finance, manufacturing and higher education, Azure is often the non-negotiable cloud standard. CTOs who are invested in Microsoft Entra ID (Active Directory), Azure DevOps and Microsoft enterprise licensing strongly prefer to keep the headless CMS frontend inside their existing Azure tenant.

Microsoft markets Azure Static Web Apps for this, but its hybrid Next.js runtime has strict bundle size caps and lacks full caching parity for complex builds. For a serious production deployment, I'd recommend Azure Container Apps with Azure Front Door:

  • Build: GitHub Actions (or Azure DevOps) compiles Next.js in standalone mode into a lean Docker image and pushes it to Azure Container Registry (ACR).
  • Compute (Azure Container Apps): runs the Next.js containers without making your team manage raw Kubernetes (AKS). You get HTTP autoscaling, zero-downtime immutable revisions, traffic splitting and per-PR preview revisions out of the box.
  • Shared cache (Azure Managed Redis): plugged into next.config through a custom cacheHandler inside a private Azure VNet, so ISR and tag invalidations sync across all active replicas.
  • Edge and WAF (Azure Front Door): sits in front of Container Apps for global CDN caching, enterprise WAF and DDoS protection, SSL termination and static asset offloading (/_next/static/*).

The alternative: Azure App Service (Linux containers) or VM Scale Sets. If internal IT already standardizes on App Service Plans or Virtual Machine Scale Sets, standalone Next.js with Deployment Slots (for instant blue/green swaps and rollbacks) fits cleanly into existing runbooks.

Amazon Web Services (AWS)

For engineering-led enterprises standardized on AWS, two proven paths cover most production headless builds:

  • Containers or VMs (ECS Fargate or EC2 Auto Scaling + CloudFront + ElastiCache Redis): the cleanest, most predictable way to run Next.js on AWS. Standalone Node servers run on ECS Fargate tasks (or persistent EC2 instances for steady 24/7 traffic) behind an Application Load Balancer, share state through ElastiCache Redis, and sit behind CloudFront for global edge caching with S3 offloading the static assets. No Lambda cold starts, full Node.js runtime compatibility and stable under load.
  • Serverless (OpenNext or SST on Lambda + S3 + CloudFront + DynamoDB): OpenNext unpacks a Next.js build into native AWS serverless components. Static files go to S3, server rendering to Lambda, image optimization to dedicated functions, and tag revalidation tracking to DynamoDB and SQS.

Google Cloud: Compute Engine (GCE)

Google's developer tutorials usually push serverless Cloud Run for quick apps. Enterprise headless CMS frontends perform much better, and cost 40% to 60% less at sustained traffic, running directly on Google Compute Engine virtual machines.

Next.js behaves best as a persistent, long-lived Node.js server. Ephemeral containers suffer from cold starts, in-memory LRU caches that are wiped whenever instances recycle, and CPU throttling during background ISR revalidations. Compute Engine avoids all three, and it runs on Google's private global fiber network. I'd recommend Compute Engine Managed Instance Groups (MIGs) with Cloud CDN:

  • Compute (C3 or C4 VMs in a Managed Instance Group): package the standalone Next.js build into an immutable VM image (or a Container-Optimized OS image built by GitHub Actions) and deploy it across a regional MIG. MIGs give you self-healing health checks, rolling zero-downtime deployments and multi-zone high availability without the bloat of Kubernetes (GKE). Because the VMs stay warm 24/7, Node.js keeps HTTP keep-alive connections open to your headless CMS API, handles multi-core sharp image optimization easily, and has no cold-start latency.
  • Shared cache (Cloud Memorystore for Redis): connected over Google's internal VPC to your Next.js cacheHandler, so every VM in the group shares the same ISR data and gets webhook tag invalidations instantly.
  • Edge and security (Cloud Load Balancing + Cloud CDN + Cloud Armor): Google's global Anycast load balancer terminates SSL at the edge closest to the visitor, shields the VMs with Cloud Armor WAF and DDoS rules, and caches rendered HTML and /_next/static/* assets globally on Cloud CDN. It also pairs cleanly with Cloudflare in front.
  • Committed use pricing: pairing steady-state VMs with 1 or 3 year Committed Use Discounts (CUDs) cuts compute costs by 55% or more compared to pay-per-millisecond serverless containers. Hosting bills stay low and predictable even when crawlers and viral articles hammer the website. If you still want PR preview subdomains that cost nothing when idle overnight, run the previews on Cloud Run and keep production on Compute Engine.

Next.js Hosting Comparison

Host Architecture DevOps Effort Cost at Scale Best Fit
Vercel Proprietary serverless, Fluid Compute Near zero High (seat fees plus bandwidth and usage premiums) Fast-moving product teams that want day-one Next.js features
Netlify OpenNext serverless + Edge Functions Near zero Moderate (credit-based, unlimited seats on Pro) Multi-site CMS monorepos and marketing-led teams
Kinsta Managed GCP containers + Cloudflare CDN Very low Predictable resource tiers, no seat or bandwidth traps Headless WordPress shops and lean teams that want no DevOps
Cloudflare Workers V8 isolates (vinext or OpenNext) + R2 and KV Low to moderate Very low (zero egress, billed on CPU ms) Bandwidth-heavy publishers and edge-first architectures
Microsoft Azure Container Apps + Redis + Front Door Moderate Low to moderate (counts toward a Microsoft MACC commit) CTOs standardized on Entra ID, VNet and Azure governance
AWS ECS Fargate or EC2 + Redis + CloudFront Moderate to high Very low unit compute and bandwidth Engineering orgs with established AWS IaC pipelines
Google Cloud (GCE) Compute Engine MIGs + Memorystore + Cloud CDN Moderate Very low (40% to 60% cheaper at steady load with CUDs) High-traffic media and enterprises that want no cold starts on GCP

Which Host to Choose

There's no universal best Next.js host. The right one depends on your engineering capacity, your traffic and your corporate governance.

  • Vercel or Netlify: when fast developer iteration matters more than cloud unit costs, and your team has no appetite for managing Dockerfiles or Redis cache handlers.
  • Kinsta or Cloudflare Workers: Kinsta for managed simplicity on persistent Google Cloud hardware with Cloudflare Enterprise included. Cloudflare Workers when removing egress bandwidth bills at global edge scale is the top priority.
  • Azure, AWS or Google Compute Engine: when security compliance, private networking, committed cloud spend or sustained 24/7 traffic make third-party platform markups impossible to justify. With a clean GitHub Actions CI/CD pipeline, standalone builds and a shared Redis cache handler, you own both the performance and the cost.

If you haven't settled on Next.js yet, compare it against the other headless CMS frontend frameworks first.

Top comments (0)