Build & Deploy with SvelteKit Adapters
In Next.js you control the output format with output in next.config.js ('export' for static, default for Node server) and choose a deployment platform by following its docs. SvelteKit takes a more explicit approach: you install an adapter package and reference it in svelte.config.js. The adapter determines what npm run build produces — a static site, a Node.js server, a Vercel edge function bundle, and so on.
Config file comparison
Section titled “Config file comparison”// next.config.js/** @type {import('next').NextConfig} */const nextConfig = { output: 'export', // static export};module.exports = nextConfig;// svelte.config.jsimport adapter from '@sveltejs/adapter-static';import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */const config = { preprocess: vitePreprocess(), kit: { adapter: adapter({ fallback: '404.html', }), },};
export default config;Available adapters
Section titled “Available adapters”| Adapter | Equivalent | Use case |
|---|---|---|
@sveltejs/adapter-static | Next.js output: 'export' | Fully static — deploy to any CDN (Netlify, GitHub Pages, S3) |
@sveltejs/adapter-auto | — | Auto-detects Vercel, Netlify, Cloudflare automatically |
@sveltejs/adapter-node | Next.js standalone server | Node.js server (Dockerfile, VPS, Railway) |
@sveltejs/adapter-vercel | Vercel-specific Next.js deploy | Explicit Vercel deployment with edge/serverless config |
Build and preview commands
Section titled “Build and preview commands”# Build for production (output depends on adapter)npm run build
# Preview the production build locallynpm run previewThese map directly to next build and next start / vite preview.
GitHub Actions CI
Section titled “GitHub Actions CI”React/Vite project:
name: CIon: [push, pull_request]jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: npm ci - run: npm run build - run: npm test -- --watchAll=falseSvelteKit project:
name: CIon: [push, pull_request]jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: npm ci - run: npm run check - run: npm run build - run: npm run testThe key additions in the SvelteKit workflow are npm run check (runs svelte-check for type errors before building) and npm run test (runs Vitest).
Installing an adapter
Section titled “Installing an adapter”# Staticnpm install --save-dev @sveltejs/adapter-static
# Auto (recommended for most deployments)npm install --save-dev @sveltejs/adapter-auto
# Node servernpm install --save-dev @sveltejs/adapter-node
# Vercelnpm install --save-dev @sveltejs/adapter-vercel