Skip to content

For SvelteKit

SvelteKit, served from a real VM

adapter-node, one small VM and a CDN across 988 locations. The plainest production recipe for SvelteKit: no platform-specific build, no cold starts and no egress fees.

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

Why SvelteKit on Edge

Tiny apps, real CPU, predictable bills

SvelteKit ships very little and needs very little. A small VM and a CDN are all it takes to run it well.
  • adapter-node, nothing else

    Build with adapter-node and run node build on any Edge VM. Plain Linux, a small memory footprint and no platform-specific step.
  • Real CPU, no cold starts

    One long-running Node process on a real VM. Load functions answer in the same time on the first request as on the millionth.
  • Images at build time or on request

    Keep enhanced:img for bundled assets. Send uploads and CMS images through the CDN for resizing and AVIF/WebP on the fly.
  • Uploads through any AWS SDK client

    Any AWS SDK client pushes uploads and serves downloads through Edge Storage. The same code runs in dev and production.
  • Immutable assets cached, the VM for the rest

    _app/immutable assets cache in 988 locations. Your VM only sees the requests that actually need it.
  • Push from your CI

    GitHub Actions, GitLab CI or a single rsync. The Edge CLI scripts everything else, end to end.

Reference architecture

adapter-node on a VM, the CDN in front

adapter-node, a VM and a CDN. Boring on purpose, and easy to move if you ever need to.
  • Compute

    Runs node build, the adapter-node output, as a systemd service.

  • Storage

    Holds uploads, downloads and overflow assets. Any S3 client works.

  • CDN

    Caches _app/, static/ and prerendered pages in every location.

  • Image optimisation

    Resize, crop and AVIF/WebP from the URL, for images the build never sees.

  • DNS

    Anycast DNS for production, staging and preview subdomains.

  • Shield

    Scores form actions server-side with one call. No CAPTCHA widget.

  • Assist

    One script tag in app.html adds answers grounded in your content.

Deploy

Build with adapter-node, live in four steps

Everything here is standard SvelteKit and standard Linux. Script it in CI once it works by hand.
  1. 01

    Switch to adapter-node

    Install @sveltejs/adapter-node as a dev dependency and swap it in. npm run build now writes a standalone Node app to build/.

    svelte.config.js
    import adapter from '@sveltejs/adapter-node'
    
    /** @type {import('@sveltejs/kit').Config} */
    export default {
      kit: { adapter: adapter() },
    }
  2. 02

    Create a VM and copy the build

    The nodejs library script installs Node 22 and an Nginx reverse proxy on first boot. Install production dependencies on the VM.

    shell
    $ edge compute create --name svelte --size s-2vcpu-4gb \
        --image ubuntu-24 --region london --script nodejs
    
    $ npm run build
    $ rsync -a build package.json package-lock.json root@<vm-ip>:/srv/app/
    $ ssh root@<vm-ip> "cd /srv/app && npm ci --omit=dev"
  3. 03

    Run it as a service

    systemd keeps the process up and restarts it on failure. Set ORIGIN so form actions pass SvelteKit's CSRF check behind the proxy.

    /etc/systemd/system/svelte.service
    [Unit]
    Description=SvelteKit app
    After=network.target
    
    [Service]
    WorkingDirectory=/srv/app
    ExecStart=/usr/bin/node build
    Environment=PORT=3000 NODE_ENV=production
    Environment=ORIGIN=https://app.acme.dev
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
  4. 04

    Front it with the CDN

    SSL is issued automatically. Hashed _app/immutable files are cached for as long as their headers allow.

    shell
    $ edge cdn create --name acme-app
    $ edge cdn domains add cdn-5d1f08 \
        --domain app.acme.dev \
        --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

A small app deserves a small bill

A Standard VM runs a typical SvelteKit app with room to spare, and the CDN keeps most requests off it entirely.
  • No per-invocation or per-GB-second pricing
  • Image transforms included with the CDN
  • adapter-node output runs anywhere Node does
See compute pricing

Estimated monthly bill on Edge

~300k page views, 2.5M requests, 15 GB of uploads

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

FAQ

Adapters, form actions and prerendering

Something else? Ask an engineer.
Which adapter should I use?
adapter-node. It produces a self-contained Node app that runs anywhere Node runs, including Edge VMs. We recommend it over platform-specific adapters precisely because it keeps you portable.
Do form actions and server-only modules work?
Yes, exactly as documented. SvelteKit runs as a normal Node process. Behind a proxy, set ORIGIN (or PROTOCOL_HEADER and HOST_HEADER) so form actions pass the CSRF check.
What happens to prerendered pages?
Routes with export const prerender = true are written to build/prerendered and served straight from disk by the Node server. The CDN then caches them like any other static file.
How do I run it as a service?
Wrap node build in a systemd unit, as in step three, or use PM2 from the nodejs library script. Either way it restarts on failure and survives reboots.
Can I get a preview per pull request?
Yes. Create a VM from CI, point a test.network subdomain at it and delete it when the pull request closes. VMs bill by the hour, so short-lived previews cost cents.

Put your SvelteKit app on one VM and a CDN

Bring your repo. adapter-node, one VM and one CDN deployment, live in minutes.

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