POC SvelteKit custom server

Implementation of a Custom Server for a SvelteKit 2 SSR project with Hydration.

Here's what this example project contains:

  • Integration of SQLite database.
  • At each server startup, the model migration scripts sqls/migrations/*.sql are automatically executed. This applies both in development mode (pnpm run dev) and in production mode (pnpm run build; pnpm run preview).
    This model migration system is powered by @beenotung/better-sqlite3-helper.
  • Integration of a scheduler based on "Cron for Node.js".
  • Seed data loading script.

Important information: This technique is no longer necessary since SvelteKit version 2.10 released in December 2024. I recommend using the Shared hooks init feature instead.

$ mise install
$ pnpm install
$ pnpm run load-seed-data

Launch the project in dev mode:

$ pnpm run dev
Server started on http://localhost:5173 in development mode

Launch the project in production mode:

$ pnpm run build
$ pnpm run preview
Server started on http://localhost:3000 in production mode

Top categories

Loading Svelte Themes