For Next.js
Self-host Next.js without the lock-in
Free to sign up. No egress fees on any product.
Why Next.js on Edge
The Next.js you know, on infrastructure you control
Standalone or next start
Build with next build and run the output on any Edge VM. No proprietary runtime, no adapter, no vendor wrapper.next/image without the meter
A four-line custom loader points next/image at the CDN. AVIF and WebP on the fly, with no per-image fees.S3-compatible storage
Uploads, ISR snapshots and static overflow live in an Edge Storage bucket. The AWS SDK works unchanged.Global CDN, zero egress
_next/static and public assets cache in 988 locations. Launch day never shows up as a bandwidth line.Your CI, your way
Deploy from GitHub Actions, GitLab CI or one SSH command. The Edge CLI and API script everything else.Agent-deployable
Tell your coding agent to deploy to example.com. The agent API provisions the VM, DNS, CDN and SSL, then reports the cost.
Reference architecture
How Next.js maps to Edge
Browsers
resolved by Edge DNS
app.acme.com
caches _next/static + public/
?width=640&format=auto
next/image, transformed at the edge
next start :3000
s-2vcpu-4gb with PM2 and Nginx
acme-uploads
user uploads, ISR cache
- Compute
Runs next start (or your standalone server) on a VM near your users.
- Storage
Holds uploads, ISR snapshots and anything too big for the build.
- CDN
Caches _next/static, public assets and cacheable route handlers worldwide.
- Image optimisation
Backs next/image through a custom loader: resize, AVIF/WebP, fit modes.
- DNS
Anycast DNS for the apex, www and preview subdomains.
- Shield
Scores signups and form posts from a route handler. No CAPTCHA widget.
- Assist
One script tag in the root layout adds answers grounded in your pages.
Deploy
From next build to live in four steps
- 01
Build a standalone output
The standalone build ships its own minimal server, so the VM needs nothing but Node.
next.config.jsmodule.exports = { output: 'standalone', images: { loader: 'custom', loaderFile: './edge-loader.js', }, } - 02
Point next/image at the CDN
Keep the <Image /> component. The CDN resizes and converts on request, then caches every variant.
edge-loader.jsexport default function edgeLoader({ src, width, quality }) { const q = quality || 75 return `https://app.acme.com${src}?width=${width}&quality=${q}&format=auto` } - 03
Create a VM and start the server
The nodejs library script installs Node 22, PM2 and an Nginx reverse proxy on first boot.
shell$ edge compute create --name web --size s-2vcpu-4gb \ --image ubuntu-24 --region london --script nodejs $ rsync -a .next/standalone/ root@<vm-ip>:/srv/web/ $ rsync -a .next/static/ root@<vm-ip>:/srv/web/.next/static/ $ ssh root@<vm-ip> "cd /srv/web && pm2 start server.js" - 04
Front it with the CDN
One deployment, one domain. SSL is issued in under a minute; --jit-image turns on image transforms.
shell$ edge cdn create --name acme-web $ edge cdn domains add cdn-a1b2c3 \ --domain app.acme.com \ --origin https://<vm-ip> \ --jit-image
Prefer to hand it off? Give the job to your AI agent or have our engineers do it.
What it costs
The Vercel maths, without the surprises
- No per-invocation, per-transform or per-seat lines
- Image optimisation included with the CDN
- Billed hourly from a prepaid balance, with optional hard caps
- Vanilla Node and S3: move providers whenever you like
Estimated monthly bill on Edge
About 3M page views and 500 GB of images a month, with ISR
- Compute$38.47Performance VM: 4 vCPU, 8 GiB RAM, 160 GB NVMe
- CDN$0.633M requests, first 500k free, then $0.25 per million
- Storage$0.7550 GB of uploads and ISR cache at $0.015/GB
- DNS$0.00Zone, records and preview subdomains
- Egress$0.00
Indicative monthly cost for a medium-traffic Next.js app
- Vercel Pro + overages~$300–800
- AWS (EC2 + CloudFront + S3)~$120–250
- Edge (VM + CDN + Storage)~$30–60
Indicative figures based on public pricing. Run your own numbers on the free tier.
FAQ
Next.js on Edge, answered
Do server components and server actions work?
What about ISR and on-demand revalidation?
Can I use next/image without paying per transform?
How do preview deployments work?
Can I move from Vercel without downtime?
Drop-in services
Add these without touching the stack
- Edge ShieldBot protection
POST /siteverify → score: 94Score signups and API-route submissions with one fetch from a route handler. No CAPTCHA widget to ship or style.
Free for most sites. No puzzles, no widget to style.Explore - Edge AssistAI answers
<script src="…/assist.js">One script tag in the root layout gives every page an answer box grounded in your rendered content.
Free tier: 250 answered questions a monthExplore
Ship Next.js on your terms
Bring an existing app or start from scratch. Keep the framework, lose the per-invocation bill.
Free tiers hard-cap. Nothing bills until you add a card.