# 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](/platform/deployments/builds#dockerfiles-generated-or-your-own) runs the built server on Node 22.

## How it runs

SvelteKit is a server-rendered frontend, so it runs under [the SSR policy](/create/scaling#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](/platform/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](/platform/deployments/builds#environment-variables-at-build-time).

## Static instead?

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

## Database

Provision [managed PostgreSQL or MySQL](/platform/databases) and read `DATABASE_URL` with `$env/dynamic/private`. See [Connect an app](/platform/databases/connect).

## Related

- [Frameworks](/platform/frameworks): Everything supported and how detection works.
- [Scaling](/create/scaling): The SSR policy and scale to zero.
- [Svelte](/platform/frameworks/svelte): The static path for prerendered sites.
