Skip to content

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

  1. 1Install the adapter you want: npm i -D @sveltejs/adapter-node (server) or @sveltejs/adapter-static (static).
  2. 2Set it in svelte.config.js and commit.
  3. 3Create the project on deploy.enzonic.com from the repository and deploy.
svelte.config.js
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.

src/routes/+page.server.ts
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 };
}
$env/dynamic/private reads the value at runtime, so the same build works for previews and production.

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 engine

Things 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.

Plan limits that matter for SvelteKit
LimitFreePro
Build minutes3,000/mo, 1 concurrent10,000/mo, 3 concurrent
Servers1 instance, 512 MB, sleeps after 15 min idle3 always-on, 2 GB
Bandwidth150 GB/mo2 TB/mo

Compare every plan

Related guides

Ship your SvelteKit project tonight

Connect the repository and the build settings fill themselves in. Free plan, no card.

Start free