Skip to content

For Node.js

Node.js apps, properly hosted

Express, Fastify, Hono or NestJS as one long-running process on a real VM, with a CDN across 988 locations in front. No cold starts, no per-invocation pricing, no platform build step.

Free to sign up. No egress fees on any product.

Why Node.js on Edge

A long-running process is still the best default

For most apps, one Node process on a real VM is the fastest, simplest and cheapest way to run in production.
  • Any framework, any runtime

    Express, Fastify, Hono, NestJS, Koa, AdonisJS or plain http. If it runs on Node it runs here, and Bun and Deno work too.
  • No cold starts

    A real process on a real VM. Latency stays consistent, and there's no per-invocation meter running in the background.
  • S3-compatible storage

    Use the AWS SDK or any S3 client for uploads and downloads. The same code runs against Edge Storage in dev and production.
  • Image transforms via URL

    Hand resizing, cropping and format conversion to the CDN. Your Node process stays small and never touches sharp.
  • Global CDN, zero egress

    Static files and cacheable GET routes are served from 988 locations. Your app only sees the dynamic traffic.
  • Plain Linux deploys

    systemd, PM2, Docker or Kamal: your choice. The Edge CLI provisions the VM and you decide how to ship to it.

Reference architecture

How a Node app maps to Edge

A Node process on a VM, state in Postgres or Redis, blobs in S3 and the CDN in front of anything cacheable.
  • Compute

    Runs your Node process under PM2, systemd or Docker.

  • Storage

    Holds uploads, exports and backups behind the S3 API.

  • CDN

    Caches static files and GET responses that send cacheable headers.

  • Image optimisation

    Resize, crop and AVIF/WebP conversion from the URL.

  • DNS

    Anycast DNS for production, staging and preview hostnames.

  • Shield

    Scores any POST with one fetch from your middleware.

  • Assist

    An answer box grounded in your pages, from one script tag in the layout.

Deploy

From npm run build to live in four steps

Nothing Node-specific to learn. A VM, a process manager and a CDN deployment.
  1. 01

    Create a VM with Node

    The nodejs library script installs Node 22 LTS, PM2 and an Nginx reverse proxy on first boot.

    shell
    $ edge compute create --name api --size s-2vcpu-4gb \
        --image ubuntu-24 --region london --script nodejs \
        --script-param node_version=22
  2. 02

    Connect to Edge Storage

    The official AWS SDK works unchanged. Only the endpoint and path-style addressing differ.

    src/storage.ts
    import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'
    
    export const s3 = new S3Client({
      endpoint: 'https://storage.edge.network',
      region: 'us-east-1',
      forcePathStyle: true,
      credentials: {
        accessKeyId: process.env.EDGE_ACCESS_KEY!,
        secretAccessKey: process.env.EDGE_SECRET_KEY!,
      },
    })
    
    export const upload = (Key: string, Body: Buffer) =>
      s3.send(new PutObjectCommand({ Bucket: 'acme-files', Key, Body }))
  3. 03

    Keep it running with PM2

    pm2 reload gives zero-downtime restarts across both instances. Run pm2 startup once so it survives reboots.

    ecosystem.config.cjs
    module.exports = {
      apps: [{
        name: 'api',
        script: 'dist/server.js',
        instances: 2,
        exec_mode: 'cluster',
        env: { NODE_ENV: 'production', PORT: 3000 },
      }],
    }
  4. 04

    Front it with the CDN

    Only GET responses with a cacheable Cache-Control header are cached. POSTs, errors and anything with Set-Cookie go straight to your process.

    shell
    $ edge cdn create --name acme-api
    $ edge cdn domains add cdn-72e9b3 \
        --domain api.acme.dev \
        --origin https://<vm-ip>

Prefer to hand it off? Give the job to your AI agent or have our engineers do it.

What it costs

Priced by the server, not the invocation

The VM costs the same at ten requests or ten million. Only CDN requests beyond the free tier scale, at $0.25 per million.
  • No per-invocation or per-GB-second pricing
  • No egress fees on responses or downloads
  • Resize the VM with one command as traffic grows
  • Billed hourly from a prepaid balance, with optional hard caps
See compute pricing

Estimated monthly bill on Edge

API and web app · 10.5M requests a month · 25 GB of files

USD
  • Compute$19.24Standard VM · 2 vCPU · 4 GiB · 80 GB NVMe
  • CDN$2.5010.5M requests: first 500k free, 10M × $0.25 per million
  • Storage$0.3025 GB of files: first 5 GB free, 20 GB × $0.015
  • DNS$0.00Production, staging and preview records
  • Egress$0.00
Total$22.04

FAQ

Node.js on Edge, answered

Something else? Ask an engineer.
Express, Fastify, Hono or NestJS: which works best?
All of them. The deployment is identical because each is a Node process behind a reverse proxy on a VM. Pick the framework you like.
Can I use TypeScript?
Yes. Compile in CI and run the JavaScript output on the VM, or run tsx directly if you'd accept the slower start-up.
What about Bun or Deno?
Both work. Install the runtime in a startup script, point your systemd unit or PM2 config at it and deploy as normal. Storage, CDN and DNS don't care which runtime you use.
Will the CDN cache my API?
Only what you allow. GET and HEAD responses with a cacheable Cache-Control header are cached. POST requests, errors, private responses and anything that sets a cookie always reach your app.
How do I scale horizontally?
Keep the app stateless, with state in Postgres, Redis or Storage. Then add VMs and put them behind the CDN or a small Nginx or Caddy load balancer on its own VM.

Ship your Node app on Edge

Any framework, any runtime, any deploy strategy.

Free tiers hard-cap. Nothing bills until you add a card.