---
title: "Node.js hosting on Edge | Express, Fastify, Hono on VMs"
description: "Run any Node.js app on Edge: Express, Fastify, Hono or NestJS on real VMs, S3-compatible storage and a global CDN. No cold starts, no egress fees."
url: https://edge.network/solutions/nodejs
---

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.

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

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

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.
    
-   ### Any S3 client, in dev and production
    
    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.
    
-   ### Static and GET routes off your process
    
    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

## A Node process, its state on the side, blobs in S3

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

-   [Compute](/compute)
    
    Runs your Node process under PM2, systemd or Docker.
    
-   [Storage](/storage)
    
    Holds uploads, exports and backups behind the S3 API.
    
-   [CDN](/cdn)
    
    Caches static files and GET responses that send cacheable headers.
    
-   [Image optimisation](/docs/cdn/image-optimization)
    
    Resize, crop and AVIF/WebP conversion from the URL.
    
-   [DNS](/dns)
    
    Anycast DNS for production, staging and preview hostnames.
    
-   [Shield](/shield)
    
    Scores any POST with one fetch from your middleware.
    
-   [Assist](/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](/solutions/agentic-development) or [have our engineers do it](/solutions/expert-services).

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

[See compute pricing](/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

## Frameworks, runtimes and scaling out

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

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.

Drop-in services

## One middleware, one script tag

-   [
    
    Edge ShieldBot protection`POST /siteverify → score: 94`
    
    Score any POST with one fetch from Express, Fastify or Hono middleware. Free, with unlimited verifications.
    
    Free forever, with unlimited widgets. No puzzles for visitors.Explore
    
    ](/shield)
-   [
    
    Edge AssistAI answers`<script src="…/assist.js">`
    
    Serve the widget from your layout, and answers come from your site's own pages.
    
    Free tier: 250 answered questions a monthExplore
    
    ](/assist)

Related stacks

## Pairs well with Node.js

[All 38 stacks](/solutions/stacks)

-   [Next.jsSelf-host Next.js without the lock-in](/solutions/nextjs)
-   [DockerRun any container on global VMs](/solutions/docker)
-   [PostgreSQLSelf-hosted Postgres on dedicated NVMe](/solutions/postgresql)
-   [RedisIn-memory cache and queue, your way](/solutions/redis)

## Give your Node app a real server

Any framework, any runtime, any deploy strategy.

[Deploy a VM](/console/access/new?product=compute)[Talk to an engineer](/contact)

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