DocsSvelteKit

SvelteKit

Deploy a SvelteKit app on Ruust with @sveltejs/adapter-node: built to build/ and served as a long-running Node server on HTTPS.

SvelteKit runs on Ruust as a long-running Node server. Use @sveltejs/adapter-node, which compiles your app to a plain server in the build/ folder that you start with node build. Ruust builds the repo with Nixpacks (it detects Node from your package.json), so there is nothing to configure unless you want to. Because an Egg is always on, server-side rendering, form actions, +server.js endpoints, background work and websockets all work, with no cold starts.

The default @sveltejs/adapter-auto guesses a target from the host and will not produce a server for Ruust. Install @sveltejs/adapter-node with npm install -D @sveltejs/adapter-node, then point svelte.config.js at it so the build emits a runnable server.

javascript
import adapter from '@sveltejs/adapter-node';

export default {
  kit: {
    adapter: adapter(),
  },
};
svelte.config.js: use adapter-node.

Deploy it

  1. Switch to @sveltejs/adapter-node in svelte.config.js and commit it.
  2. Push your app to a Git repo.
  3. In the dashboard, choose New Egg and connect the repo.
  4. Pick a size and a region (London or Virginia), then lay the Egg.
  5. Ruust runs Nixpacks, which detects your adapter-node output and produces a runnable server (Ruust pins neither the build nor the start command), and the Egg hatches on its <name>.<region>.ruust.run URL.

The port

This is the one thing to get right. Ruust sets a PORT env var and the app must listen on it and bind to 0.0.0.0, not localhost. The adapter-node server reads PORT automatically, but it defaults HOST to 127.0.0.1, so you must set HOST=0.0.0.0 on the Egg. Set ORIGIN to your public URL too, so form actions and cookies work behind Ruust TLS. Binding to the wrong host is the top reason an Egg builds but never hatches.

bash
# Set on the Egg (Environment tab). PORT is provided by Ruust.
HOST=0.0.0.0
ORIGIN=https://your-app.eu-west.ruust.run
adapter-node reads PORT, HOST and ORIGIN from the environment.

Start command and environment variables

On the Nixpacks path the adapter-node output starts with node build by default. To set it yourself, add a Procfile at the repo root with the line web: node build: the web: line is honoured by the Nixpacks build, not by Ruust itself, and is ignored when you supply your own Dockerfile. Set env vars on the Egg: they are available at build and run time, encrypted at rest and never printed in logs. Read server-only secrets through $env/static/private. Anything you want in the browser must use the PUBLIC_ prefix (for example PUBLIC_API_URL), exposed through $env/static/public. Public vars are baked in at build time, so change one and lay a fresh Egg to pick it up.