---
title: "Deploy Next.js on Edge | A self-hosted Next.js platform"
description: "Run Next.js on Edge — production VMs, S3-compatible storage, global CDN with zero egress fees. The self-hosted alternative to Vercel."
url: https://edge.network/solutions/nextjs/
---

# Deploy Next.js on Edge | A self-hosted Next.js platform

For Next.js

# Self-host Next.js without the lock-in

Run Next.js on production VMs with global CDN, zero egress fees,
S3-compatible storage and on-the-fly image optimisation.
Everything you'd want from Vercel — without the bill or the lock-in.

[Start free](https://edge.network/account) [Read the deploy guide](https://edge.network/docs/compute/getting-started)

# Build a standalone Next.js app

$ next build

# Spin up a VM with the Edge CLI

$ edge compute create \

--image ubuntu-24-04 --plan small \

--script ./bootstrap-nextjs.sh

# Front it with the CDN

$ edge cdn create app.example.com \

--origin https://<vm-ip>

✓ Live at https://app.example.com

✓ SSL provisioned, CDN warming

## Why developers move Next.js to Edge

Predictable VM pricing, real CPU and memory limits, and no surprise function invocations on your bill.

### Standalone or Node server

Build with `next build` (standalone or default) and run on any Edge VM. No proprietary runtime, no vendor wrappers.

### next/image without the bill

Point next/image at our URL-based image optimisation. Resize, crop, convert to AVIF/WebP on the fly with no per-image fees.

### S3-compatible storage

Use Edge Storage as the backing bucket for uploads, ISR cache, or static assets. AWS SDK works unchanged.

### Global CDN, zero egress

Front your app with a CDN spread across thousands of edge locations. Stop worrying about bandwidth bills on launch day.

### Your CI, your way

Deploy with GitHub Actions, GitLab CI, or a single SSH command. Use the Edge CLI to script everything.

### Agent-deployable

Tell an AI agent "deploy my Next.js app to example.com" — the agentic API provisions the VM, DNS, CDN and SSL for you.

Reference architecture

## How Next.js maps to Edge

A typical Next.js app maps cleanly onto our four core products. No glue services,
no proprietary primitives — just standard infrastructure you can move at any time.

Compute Runs `next start` (or your standalone build) on a VM near your users

Storage S3-compatible bucket for uploads, ISR snapshots, and static asset overflow

CDN Caches `_next/static`, public assets, and edge-cacheable API routes globally

Image Optimization Drop-in loader for next/image — resize, AVIF/WebP, smart cropping

DNS Anycast DNS with instant propagation for your apex and previews

Shield Free bot protection for forms and API routes, with a 1–100 humanity score

# next.config.js — image loader

module.exports = {

images: {

loader: 'custom' ,

loaderFile: './edge-loader.js' ,

},

}

# edge-loader.js

export default function loader({ src, width, quality }) {

return `https://cdn.example.com/$&#123;src&#125;?w=$&#123;width&#125;&q=$&#123;quality||75&#125;`

}

## The Vercel maths, without the surprises

A medium-traffic Next.js app on Vercel routinely runs into four-figure monthly bills
once you cross a million page views. The same app on Edge runs from a small VM and a CDN
deployment — fixed costs, no per-invocation fees, no per-image transforms.

Predictable VM pricing — no per-invocation surprises
Zero egress fees for CDN traffic
Image optimisation included with the CDN
Move providers any time — vanilla Node, vanilla S3

Indicative monthly cost

### Medium-traffic Next.js app

~3M page views, 500GB image bandwidth, ISR

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 in the trial.

## Common questions

### Do server components and server actions work?

Yes. Next.js runs as a normal Node process on an Edge VM, so the full feature set — server components, server actions, middleware, route handlers — works exactly as documented.

### What about ISR and on-demand revalidation?

Built-in ISR works out of the box. For multi-VM setups you can persist the cache to Edge Storage with a custom cache handler, or call your `/revalidate` endpoint from any CI step.

### Can I use next/image without paying per-transform?

Yes — configure a custom loader pointing at Edge Image Optimization. You get the same `<Image />` component with on-the-fly resizing and modern format conversion at CDN prices.

### How do previews / branch deploys work?

Spin up a small VM per branch from your CI, point a `*.test.network` subdomain at it, tear it down on PR close. The Edge CLI and agentic API both make this a few lines of YAML.

By Stack

## Other stacks on Edge

[View all stacks →](https://edge.network/solutions/stacks)
[Nuxt Vue-powered SSR on global VMs](https://edge.network/solutions/nuxt)[SvelteKit Tiny, fast, and Node-friendly](https://edge.network/solutions/sveltekit)[Astro Content-first sites at the edge](https://edge.network/solutions/astro)[Static Sites Hugo, Eleventy, Jekyll — straight to the CDN](https://edge.network/solutions/static-sites)

## Ship Next.js on your terms

Free to sign up — full platform access. Bring an existing app or start from scratch —
we'll match your current performance and slash your bill.

[Start free](https://edge.network/account) [Talk to an engineer](https://edge.network/contact)
