SvelteKit uses adapters to transform your app for different deployment targets. You pick an adapter, run npm run build, and get output tailored for that platform.
How Adapters Work
The build process has two steps:
- Svelte compiles components to JavaScript
- The adapter transforms the output for the target platform
npm run build
↓
SvelteKit build
↓
Adapter transform
↓
Platform-specific outputVercel (Recommended for Most Projects)
npm install -D @sveltejs/adapter-vercelPush to GitHub and connect the repo on vercel.com. Zero additional configuration needed — Vercel detects SvelteKit automatically.
Node.js Server
For self-hosted deployments:
npm install -D @sveltejs/adapter-nodeBuild and run:
npm run build
node build/index.js # starts an Express-like server on PORT (default 3000)Set the PORT environment variable to change the port.
Cloudflare Pages / Workers
npm install -D @sveltejs/adapter-cloudflareYour app runs at the edge in Cloudflare's global network. Use platform.env to access KV, D1, R2, and other Cloudflare bindings from your load functions and API routes.
Static Site (No Server)
For fully static sites (no server-side rendering):
npm install -D @sveltejs/adapter-staticEvery page must be prerenderable — no server-only code, no +page.server.js with dynamic logic.
Mark pages for prerendering:
// +page.js or +layout.js
export const prerender = true;Or enable it globally in svelte.config.js:
Environment Variables
SvelteKit splits env vars into public and private:
# .env
SECRET_DB_URL=postgres://... # server only
PUBLIC_API_URL=https://api.mysite.com # safe to expose
Using $env/static/* gives you build-time type checking — typos in env var names are caught before deployment.
Deployment Checklist
Adapter Comparison
| Adapter | Best for | Runtime |
|---|---|---|
adapter-vercel | Most projects | Node or Edge |
adapter-cloudflare | Global edge, low latency | Cloudflare Workers |
adapter-node | Self-hosted, Docker | Node.js |
adapter-static | Blogs, docs, no SSR | CDN / static host |
adapter-netlify | Netlify teams | Node or Edge |