Example Applications

The example app ships in both routing modes β€” same source, mode picked by the VITE_ROUTING_MODE environment variable. Two live deploys are kept current with main:

πŸš€ History Mode

Clean URLs via the History API. Requires server fallback to index.html in production (nginx, Apache, etc.).

Locally: make dev β†’ localhost:5050

πŸ”— Hash Mode

Hash-based #/path routing. No server config needed β€” works on static hosting, file://, anywhere.

Locally: make dev-hash β†’ localhost:5051

Demos by Category

Every demo below links to the history-mode deploy. For hash mode, swap https://history… for https://hash.svelte-spa-router.keenmate.dev/# and prepend # to the path.

  • /authorization-demo β€” async authorizationCallback for per-resource checks
  • /admin β€” permission-protected route (toggle user in the header to test)
  • /settings β€” protected route requiring settings:manage

Tip: the example header has a Toggle πŸ‘€ button to switch between users with different permission sets.

Running Examples Locally

One example app, two modes. Mode is picked via the VITE_ROUTING_MODE env var (cross-env handles cross-platform).

Using Make (Recommended)
# History mode (port 5050)
make dev

# Hash mode (port 5051)
make dev-hash
Using npm
cd example
npm install

# History mode
npm run dev:history

# Hash mode
npm run dev:hash

Source Code

The example app source lives in the main router repository under example/. Both routing modes share the same source β€” the mode is selected at build time.

Example app

Full demo source β€” every feature shown above.

View example/ on GitHub
E2E test fixtures

Minimal Playwright fixtures kept separate from the user-facing demos. Useful when reading the spec suite.

View fixtures on GitHub

Quick Tips

πŸ”
Explore Features

Open every demo at least once β€” many have multiple sections covering edge cases

πŸ’»
View Source

The example/ files are the canonical reference β€” feature pages are written from them

πŸ› οΈ
Experiment

Run locally with make dev and edit example/src/routes/ to test changes

πŸ“–
Read Docs

Each Features page on the left has a deep-link to its matching demo