SvelteKit leaves hosting to adapters, and @sveltejs/adapter-node turns a project into a standalone Node server: npm run build then node build, listening on port 3000. That is a perfect fit for Dokploy, with one proxy-specific detail that catches most first deploys: behind Traefik, SvelteKit needs the ORIGIN variable to know its public URL, or form actions fail with a cross-site error. This guide deploys a SvelteKit app with PostgreSQL on a MassiveGRID server from the Dokploy hosting page.

Install adapter-node

npm i -D @sveltejs/adapter-node
// svelte.config.js
import adapter from '@sveltejs/adapter-node';
export default { kit: { adapter: adapter() } };

npm run build writes the server to build/; node build starts it. The server reads PORT (default 3000), HOST (default 0.0.0.0, which is why SvelteKit rarely has the localhost problem other frameworks have), ORIGIN, and BODY_SIZE_LIMIT for uploads. If your site is fully prerendered, use adapter-static and Dokploy's Static build type on port 80 instead; the rest of this guide is for the Node server.

The ORIGIN variable

Traefik terminates TLS and forwards plain HTTP, so SvelteKit cannot see the public scheme and host on its own. Without ORIGIN, form actions return a 403 cross-site POST error and url.origin is wrong. Set it to the exact public URL in Dokploy's Environment tab:

ORIGIN=https://app.example.com
PORT=3000
BODY_SIZE_LIMIT=10M

The alternative is PROTOCOL_HEADER=x-forwarded-proto and HOST_HEADER=x-forwarded-host, which trust Traefik's forwarded headers; ORIGIN is simpler when the app has one domain. For preview deployments, whose domain is generated, use the header pair so each preview derives its own origin.

Deploy with Nixpacks, then harden with a Dockerfile

For the first deploy, Nixpacks works with no configuration: it runs npm ci and npm run build; set NIXPACKS_START_CMD=node build and the domain on port 3000. For production use this Dockerfile with the Dockerfile build type:

FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --omit=dev

FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production PORT=3000
COPY --from=build /app/build ./build
COPY --from=build /app/node_modules ./node_modules
COPY package.json ./
EXPOSE 3000
CMD ["node", "build"]

Build-time public variables (PUBLIC_ prefix in SvelteKit's $env/static/public) must be set before the build; $env/dynamic/private values are read at runtime from the Environment tab.

Database and sessions

Create a PostgreSQL service in the same Dokploy project and read its internal hostname into DATABASE_URL; Drizzle or Prisma migrations can run as a pre-start step (npx drizzle-kit migrate && node build as the start command) or as a Dokploy scheduled one-off. Keep sessions in the database or in a Redis service rather than in memory, so a redeploy or a second replica does not log users out. Schedule S3 backups on the database service.

Previews, health and rollbacks

Preview Deployments give every pull request a running copy on a generated domain, with the header-based origin settings above. Add a cheap /healthz endpoint as a +server.js route and set it as the container health check so Dokploy's rolling update only switches traffic when the new build answers. Rollbacks are one click in the Deployments tab.

Common problems and their fixes

Sizing and cost

A SvelteKit Node server idles at 60 to 120 MB and builds in under a minute on two cores.

A SvelteKit app with PostgreSQL fits the MassiveGRID Starter preset (2 vCPU, 4 GB RAM, 64 GB NVMe) at $9.58 a month on shared cores, or $19.80 on dedicated cores when build times and response latency must stay steady; the Growth preset (4 vCPU, 8 GB) at $19.16 or $39.60 adds room for previews, a worker and a second project. Dokploy is free, MassiveGRID installs it on request after you order from the Dokploy hosting page, and the server runs on a Proxmox HA cluster with Ceph storage and a 15-day money-back guarantee.

The same app on Vercel Pro is $20 per developer seat plus metered usage; the Vercel alternative page has the mapping.

Frequently Asked Questions

Why do SvelteKit form actions fail with a cross-site error on Dokploy?

Because the server does not know its public origin behind Traefik. Set ORIGIN=https://your-domain in the Environment tab, or set PROTOCOL_HEADER=x-forwarded-proto and HOST_HEADER=x-forwarded-host so SvelteKit trusts the proxy headers, then redeploy.

Which port does a SvelteKit adapter-node server use?

Port 3000 by default, bound to 0.0.0.0, both overridable with the PORT and HOST variables. Set the Dokploy domain to the same port and keep the Advanced Ports setting off.

Can I deploy a prerendered SvelteKit site on Dokploy without Node?

Yes. Use adapter-static, let the build write the site to build/, and choose Dokploy’s Static build type with that publish directory and the domain on port 80. It serves from Nginx with no Node process and uses almost no memory.

Dokploy hosting from $9.58 a month

A MassiveGRID VPS preset for Dokploy: 2 vCPU, 4 GB RAM and 64 GB NVMe for $9.58 a month on shared cores or $19.80 on dedicated cores, in New York, London, Frankfurt or Singapore, on a Proxmox HA cluster with Ceph storage, a 100% uptime SLA and a 15-day money-back guarantee. Run the one-line installer yourself or open a ticket and we install Dokploy for you.

Configure a Dokploy server

Further Reading