Deploy SvelteKit
Stackpad auto-detects SvelteKit applications and deploys them as Node.js servers.
Quick deploy
- Push your SvelteKit project to GitHub
- Create a new project on Stackpad and select your repo
- Stackpad detects
@sveltejs/kitin your dependencies - Your app is live at
your-project.your-org.stackpad.eu
Configuration
Node adapter
SvelteKit needs the Node.js adapter for server deployment. Install it:
npm install -D @sveltejs/adapter-nodeUpdate svelte.config.js:
import adapter from '@sveltejs/adapter-node';
/** @type {import('@sveltejs/kit').Config} */const config = { kit: { adapter: adapter(), },};
export default config;The default port is 3000. Stackpad runs the built server from the build directory.
Environment variables
SvelteKit uses the $env modules:
// Server-side only (never exposed to client)import { DATABASE_URL } from '$env/static/private';
// Available in client-side codeimport { PUBLIC_API_URL } from '$env/static/public';PUBLIC_* variables are embedded at build time (like Next.js NEXT_PUBLIC_*). Set them in the Stackpad dashboard before deploying.
Database
Add PostgreSQL and redeploy:
import { DATABASE_URL } from '$env/static/private';import { Pool } from 'pg';
export const pool = new Pool({ connectionString: DATABASE_URL });What’s next?
- Environment variables — manage configuration
- Custom domains — add your own domain