Skip to content
By stack3 min read

SvelteKit hosting: adapter-static or adapter-node

Short answer

SvelteKit hosting starts with choosing the adapter. With adapter-static the site becomes static files in the build folder that you upload to any plan. With adapter-node it produces a Node.js server at build/index.js that runs on the AI and developer plans through Passenger, and it needs the ORIGIN variable for forms to work. The default adapter-auto is meant for specific platforms, so replace it.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Choose the adapter
  2. adapter-static on any plan
  3. adapter-node on the AI and developer plans
  4. What SvelteKit needs in production
  5. Limits to know
  6. On ArabyHost

SvelteKit does not produce one shape for deployment. It builds your app for the target set by the adapter in svelte.config.js. The default adapter-auto recognises particular cloud platforms; on ordinary hosting you choose one of two.

Choose the adapter

Adapter Output Suits Plan
@sveltejs/adapter-static Static files in build/ Informational site, blog, single-page app Any plan
@sveltejs/adapter-node A Node.js server at build/index.js Form actions, server routes, per-visitor pages AI and developer plans

adapter-static on any plan

  1. Install the adapter: npm i -D @sveltejs/adapter-static, and use it in svelte.config.js.
  2. Turn on prerendering by adding export const prerender = true; to src/routes/+layout.js.
  3. Run npm run build, and upload the contents of build/ to public_html.

If your app is a single-page app, set a fallback page with fallback: "index.html" in the adapter options, and add the rewrite rule in .htaccess so you do not get a 404 on page refresh.

adapter-node on the AI and developer plans

  1. Install the adapter and build on your computer: npm i -D @sveltejs/adapter-node, then npm run build.
  2. Upload the build/ folder with package.json and the lock file to a folder outside public_html, such as /home/USER/svelteapp.
  3. Add a startup file called app.cjs containing:
import("./build/index.js");
  1. Create the app from Setup Node.js App in cPanel: Node.js 24, Application root set to svelteapp, and Application startup file set to app.cjs.
  2. Add the variables under Environment variables, most importantly:
ORIGIN=https://example.com
  1. Click Run NPM Install, then Restart.

ORIGIN is the one most often forgotten: without it the page refuses to submit forms. Secret variables are read from $env/dynamic/private at run time, so they go into cPanel, not into the code. General details are in the Node.js app guide and the environment variables guide.

What SvelteKit needs in production

  • A recent Node.js for adapter-node: we offer 20 and 24.
  • Database: MySQL/MariaDB on the account, or an external service reached over HTTPS.
  • Static files: in static mode LiteSpeed serves them directly.

Limits to know

  • A build on the server can stop at the memory limit, so build on your computer.
  • Outgoing connections are HTTPS only, so a direct connection to an external PostgreSQL or Redis port does not work.
  • Passenger may stop the app when idle, so do not rely on timers inside the server. Use Cron Jobs.
  • No Docker, no root, and no serverless or edge functions.

If an error page appears after creating the app, read the log as described in Passenger app error.

On ArabyHost

Static output runs on every plan, served by LiteSpeed with a free automatic SSL certificate and daily backups. The adapter-node server runs on the AI and developer plans through Passenger with Node.js 20 or 24, with SSH, Git and deploys from GitHub. The Araby AI assistant reads the error log and explains the cause.

Prices are shown in your currency on the pricing page, and the renewal price is the price you signed up at. For comparison see Nuxt hosting and Vite hosting.

FAQ

Does SvelteKit run on shared hosting?

It does with adapter-static if every page can be prerendered, since the output is static files. Form actions, server routes and pages rendered per request need adapter-node and a plan that runs Node.js.

Why do I get Cross-site POST form submissions are forbidden?

Because the server does not know your site's address, so it rejects forms as protection against CSRF. Add the ORIGIN environment variable with your full site address including https, then restart the app.

What do I upload with adapter-node?

The build folder, package.json and the lock file. Then install the production packages on the server with the Run NPM Install button, because the build folder does not contain every package.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.