Deploy SvelteKit | Svelte 5 App on Current Versions
SvelteKit 2 and Svelte 5, server-rendered with an audited lockfile
Just deployed
Deploy and Host a SvelteKit App on Railway
SvelteKit 2 on Svelte 5, server-rendered by adapter-node.
About Hosting SvelteKit
The SvelteKit template on Railway builds from a repository last updated in November 2024. It pins Vite 5 and Tailwind 3, and it carries a full lint and format toolchain - ESLint, Prettier and three plugins - in a project whose job is to show you a working page. Around three deployments in ten do not come up, and on this platform a committed lockfile with a HIGH advisory is enough to stop a build outright.
This one tracks current versions, keeps the dependency list to what actually renders the page, and commits a lockfile that passes npm audit --audit-level=high.
Nothing is missing that you cannot add in a minute - npx sv add tailwindcss, npx sv add eslint. A starter should not be choosing your linter for you.
Common Use Cases
- A server-rendered site or app where the pages are the product
- A front end that also needs a few server routes, without running a separate API
- A starting point that will grow forms, load functions and endpoints
Dependencies for SvelteKit Hosting
- Nothing. One service, no database.
Deployment Dependencies
- SvelteKit: https://svelte.dev/docs/kit
- adapter-node: https://svelte.dev/docs/kit/adapter-node
- Source: https://github.com/ak40u/sveltekit-railway-starter
Implementation Details
adapter-node produces a plain Node server in build/ that reads PORT and HOST from the environment itself, so there is no wrapper script and no static-file server to configure - node build/index.js is the whole start command.
The health check at /health is a route rather than a file in static/, on purpose: a static file can be answered by something in front of the app, so a passing check would not prove the server itself is alive.
| Variable | Why |
|---|---|
| PORT | Read by adapter-node; Railway routes the public domain to it |
| HOST | 0.0.0.0, so the server is reachable from outside the container |
Why Deploy SvelteKit on Railway?
Push, and the build and the Node server are both handled - server-side rendering included, which a static host cannot give you. The health check tells you honestly whether the app came up.
Template Content