---
title: "Next.js hosting on Edge | Self-host without lock-in"
description: "Run Next.js on Edge: production VMs, S3-compatible storage and a global CDN with zero egress fees. The self-hosted alternative to Vercel, with a flat bill."
url: https://edge.network/solutions/nextjs
---

For Next.js

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

Run next start on a real VM, cache \_next/static across 988 locations and point next/image at on-the-fly optimisation. Everything you'd want from Vercel, minus the per-invocation bill.

[Deploy a VM](/console/access/new?product=compute)[Read the deploy guide](/docs/compute/getting-started)

The setup on this page costs $39.85 a month, with no egress line.

Why Next.js on Edge

## The Next.js you know, on infrastructure you control

Predictable VM pricing, real CPU and memory, and nothing on the invoice that scales with function calls.

-   ### 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.
    
-   ### Uploads and ISR snapshots in a bucket
    
    Uploads, ISR snapshots and static overflow live in an Edge Storage bucket. The AWS SDK works unchanged.
    
-   ### \_next/static from the nearest location
    
    \_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.
    
-   ### Your agent ships it and reports the cost
    
    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

## Four standard products and no glue services

Four standard products and no glue services. Everything is vanilla Node and vanilla S3, so you can move it any time.

-   [Compute](/compute)
    
    Runs next start (or your standalone server) on a VM near your users.
    
-   [Storage](/storage)
    
    Holds uploads, ISR snapshots and anything too big for the build.
    
-   [CDN](/cdn)
    
    Caches \_next/static, public assets and cacheable route handlers worldwide.
    
-   [Image optimisation](/docs/cdn/image-optimization)
    
    Backs next/image through a custom loader: resize, AVIF/WebP, fit modes.
    
-   [DNS](/dns)
    
    Anycast DNS for the apex, www and preview subdomains.
    
-   [Shield](/shield)
    
    Scores signups and form posts from a route handler. No CAPTCHA widget.
    
-   [Assist](/assist)
    
    One script tag in the root layout adds answers grounded in your pages.
    

Deploy

## From next build to live in four steps

Standard tooling throughout. Swap the rsync for your CI of choice once it works by hand.

1.  01
    
    ### Build a standalone output
    
    The standalone build ships its own minimal server, so the VM needs nothing but Node.
    
    next.config.js
    
    ```
    module.exports = {
      output: 'standalone',
      images: {
        loader: 'custom',
        loaderFile: './edge-loader.js',
      },
    }
    ```
    
2.  02
    
    ### Point next/image at the CDN
    
    Keep the <Image /> component. The CDN resizes and converts on request, then caches every variant.
    
    edge-loader.js
    
    ```
    export default function edgeLoader({ src, width, quality }) {
      const q = quality || 75
      const params = `width=${width}&quality=${q}&format=auto`
      return `https://app.acme.com${src}?${params}`
    }
    ```
    
3.  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"
    ```
    
4.  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](/solutions/agentic-development) or [have our engineers do it](/solutions/expert-services).

What it costs

## The Vercel maths, without the surprises

Once a Next.js app passes a million page views, usage-based platforms turn into four-figure invoices. Here it's a VM, a CDN deployment and a bucket.

-   No per-invocation, per-transform or per-seat lines
-   Image optimisation included with the CDN
-   Vanilla Node and S3: move providers whenever you like

[See compute pricing](/compute/pricing)

Estimated monthly bill on Edge

About 3M page views and 500 GB of images a month, with ISR

USD

-   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

Total$39.85

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

## Server components, ISR and leaving Vercel

Something else? [Ask an engineer](/contact).

Do server components and server actions work?

Yes. Next.js runs as a normal Node process on an Edge VM, so server components, server actions, middleware and route handlers behave exactly as documented.

What about ISR and on-demand revalidation?

Built-in ISR works out of the box on a single VM. Across several VMs, persist the cache to Edge Storage with a custom cache handler, or call your revalidate endpoint from a CI step.

Can I use next/image without paying per transform?

Yes. Configure a custom loader that points at the CDN. You keep the <Image /> component and get resizing and AVIF/WebP conversion at CDN prices, with no per-image fee.

How do preview deployments work?

Spin up a small VM per branch from CI, point a test.network subdomain at it and tear it down when the pull request closes. The Edge CLI and agent API make that a few lines of YAML.

Can I move from Vercel without downtime?

Yes. Run the app on Edge alongside Vercel, test it on a staging hostname, then switch the DNS record. Our Expert Services team can run the migration for you.

Drop-in services

## One fetch in a route handler, one tag in the layout

-   [
    
    Edge ShieldBot protection`POST /siteverify → score: 94`
    
    Score signups and API-route submissions with one fetch from a route handler. No CAPTCHA widget to ship or style.
    
    Free forever, with unlimited widgets. No puzzles for visitors.Explore
    
    ](/shield)
-   [
    
    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
    
    ](/assist)

Frontend & full-stack

## Other front-end frameworks

[All 38 stacks](/solutions/stacks)

-   [NuxtVue-powered SSR on global VMs](/solutions/nuxt)
-   [SvelteKitTiny, fast and Node-friendly](/solutions/sveltekit)
-   [AstroContent-first sites at the edge](/solutions/astro)
-   [Static sitesHugo, Eleventy or Jekyll, straight to the CDN](/solutions/static-sites)

## Ship Next.js on your terms

Bring an existing app or start from scratch. Keep the framework, lose the per-invocation bill.

[Deploy a VM](/console/access/new?product=compute)[Have us migrate it](/solutions/expert-services)

Billed hourly from a prepaid balance. Egress is free on every product.
