Getting started
Core concepts
Build and deploy
Advanced
Best practices
Appendix
Reference
- @sveltejs/kit
- @sveltejs/kit/hooks
- @sveltejs/kit/node/polyfills
- @sveltejs/kit/node
- @sveltejs/kit/vite
- $app/environment
- $app/forms
- $app/navigation
- $app/paths
- $app/server
- $app/state
- $app/stores
- $env/dynamic/private
- $env/dynamic/public
- $env/static/private
- $env/static/public
- $lib
- $service-worker
- Configuration
- Command Line Interface
- Types
Adapters
Before you can deploy your SvelteKit app, you need toadapt it for your deployment target. Adapters are small plugins that take the built app as input and generate output for deployment.
Official adapters exist for a variety of platforms — these are documented on the following pages:
@sveltejs/adapter-cloudflare
for Cloudflare Pages@sveltejs/adapter-cloudflare-workers
for Cloudflare Workers@sveltejs/adapter-netlify
for Netlify@sveltejs/adapter-node
for Node servers@sveltejs/adapter-static
for static site generation (SSG)@sveltejs/adapter-vercel
for Vercel
Additionalcommunity-provided adapters exist for other platforms.
Using adapters
Your adapter is specified insvelte.config.js
:
importconstadapter:(opts:any)=>import("@sveltejs/kit").Adapter
adapterfrom'svelte-adapter-foo';/**@type{import('@sveltejs/kit').Config}*/constconstconfig:Config
@type{import('@sveltejs/kit').Config}config={Config.kit?:KitConfig|undefined
SvelteKit options
kit:{KitConfig.adapter?:Adapter|undefined
Youradapter is run when executingvite build
. It determines how the output is converted for different platforms.
@defaultundefinedadapter:functionadapter(opts:any):import("@sveltejs/kit").Adapter
adapter({// adapter options go here})}};exportdefaultconstconfig:Config
@type{import('@sveltejs/kit').Config}config;
Platform-specific context
Some adapters may have access to additional information about the request. For example, Cloudflare Workers can access anenv
object containing KV namespaces etc. This can be passed to theRequestEvent
used inhooks andserver routes as theplatform
property — consult each adapter’s documentation to learn more.