Skip to content

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.

next.config.js
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export', // static export
};
module.exports = nextConfig;
svelte.config.js
// svelte.config.js
import 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;
AdapterEquivalentUse case
@sveltejs/adapter-staticNext.js output: 'export'Fully static — deploy to any CDN (Netlify, GitHub Pages, S3)
@sveltejs/adapter-autoAuto-detects Vercel, Netlify, Cloudflare automatically
@sveltejs/adapter-nodeNext.js standalone serverNode.js server (Dockerfile, VPS, Railway)
@sveltejs/adapter-vercelVercel-specific Next.js deployExplicit Vercel deployment with edge/serverless config
Terminal window
# Build for production (output depends on adapter)
npm run build
# Preview the production build locally
npm run preview

These map directly to next build and next start / vite preview.

React/Vite project:

name: CI
on: [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=false

SvelteKit project:

name: CI
on: [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 test

The key additions in the SvelteKit workflow are npm run check (runs svelte-check for type errors before building) and npm run test (runs Vitest).

Terminal window
# Static
npm install --save-dev @sveltejs/adapter-static
# Auto (recommended for most deployments)
npm install --save-dev @sveltejs/adapter-auto
# Node server
npm install --save-dev @sveltejs/adapter-node
# Vercel
npm install --save-dev @sveltejs/adapter-vercel
Where do you configure the SvelteKit adapter?
Which SvelteKit adapter is equivalent to Next.js output: "export"?
What extra CI step does a SvelteKit workflow add compared to a React Vite workflow?