Documentation menu

Deploy SvelteKit on Light Cloud - detected from svelte.config, built with the Node adapter into a container behind the edge CDN.

Deploy SvelteKit

SvelteKit is detected from its dependency and svelte.config.js, and runs as a Node.js container on port 3000. Use @sveltejs/adapter-node (or leave adapter-auto, which picks it in a Node environment); the generated image runs the built server on Node 22.

How it runs#

SvelteKit is a server-rendered frontend, so it runs under the SSR policy: pinned to the Micro size, scaling 0-3, in a tier-1 region, always behind the edge CDN.

  • Build. npm run build writes the server to build/; the container starts it with Node.
  • Port. The Node adapter reads PORT, which is set for you.
  • Prerendered pages inside the app are served by the same server - nothing extra to configure.

Configuration#

  • Server code (+page.server.ts, hooks, endpoints) reads environment variables at runtime via $env/dynamic/private.
  • Prefer $env/dynamic/* over $env/static/* on the container: static values are inlined at image build, which runs without your runtime variables.

Static instead?#

A fully prerendered site (adapter-static) is a plain Svelte static build - CDN, free bandwidth, no server. Pick it when nothing renders per request.

Database#

Provision managed PostgreSQL or MySQL and read DATABASE_URL with $env/dynamic/private. See Connect an app.