Full-stack frameworks
Deploy a SvelteKit app on Enzonic
SvelteKit picks its deployment target through an adapter. Deploy runs adapter-node builds as a Node.js server (node build/index.js) and serves adapter-static builds as plain files. adapter-auto has no Enzonic target, so choose one of the two.
At a glance
What Enzonic Deploy does with a SvelteKit project when you connect it. You can override any of it in the project settings.
- Language
- JavaScript / TypeScript
- Detected from
- @sveltejs/kit in dependencies; @sveltejs/adapter-node means server, @sveltejs/adapter-static means static
- Build command
- vite build (or your build script)
- Output
- build
- Runs as
- Server or Static
Dependencies install with the package manager your lockfile names: npm ci, pnpm install --frozen-lockfile, yarn install --immutable (Berry) or --frozen-lockfile, or bun install --frozen-lockfile. Node.js 18, 20, 22 and 24 are available. Deploy reads engines.node in package.json, then .nvmrc or .node-version, and uses Node.js 22 when nothing pins a version.
How it runs
Server
With @sveltejs/adapter-node: build/index.js and build/handler.js are started with node build/index.js.
Static
With @sveltejs/adapter-static: the build folder is served as files, with your fallback page if you set one.
Deploy SvelteKit step by step
- 1Install the adapter you want: npm i -D @sveltejs/adapter-node (server) or @sveltejs/adapter-static (static).
- 2Set it in svelte.config.js and commit.
- 3Create the project on deploy.enzonic.com from the repository and deploy.
import adapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
export default {
preprocess: vitePreprocess(),
kit: { adapter: adapter() },
};Connect a database to SvelteKit
Create a database on Enzonic Databases (or from the project's settings) and its connection string is added to the project's environment variables. This example uses PostgreSQL.
import postgres from 'postgres';
import { env } from '$env/dynamic/private';
const sql = postgres(env.DATABASE_URL);
export async function load() {
const posts = await sql`select id, title from posts order by id desc limit 20`;
return { posts };
}Postgres projects get two variables: DATABASE_URL through the connection pooler for the app, and DATABASE_URL_UNPOOLED for migrations.
PostgreSQL on Enzonic DatabasesEvery database engineThings to know
- With adapter-auto the build still runs, but Deploy reports that it has no Enzonic target and asks you to pick adapter-node or adapter-static.
- $env/static/private inlines values at build time: changing a variable then needs a new deployment. Prefer $env/dynamic/private for secrets.
Plan limits that matter here
From the live plan data. Every plan includes previews for each branch, instant rollback, environment variables and logs.
| Limit | Free | Pro |
|---|---|---|
| Build minutes | 3,000/mo, 1 concurrent | 10,000/mo, 3 concurrent |
| Servers | 1 instance, 512 MB, sleeps after 15 min idle | 3 always-on, 2 GB |
| Bandwidth | 150 GB/mo | 2 TB/mo |
Related guides
- Deploy a Astro siteStatic Astro sites by default, server output with @astrojs/node.
- Deploy a Next.js appApp Router and Pages Router apps as a Node.js server, or a static export.
- Deploy a Vite siteVite single-page apps with React, Vue, Svelte, Solid, Preact or Lit.
Ship your SvelteKit project tonight
Connect the repository and the build settings fill themselves in. Free plan, no card.