Introducing sv-router, a modern SPA router with type-safe navigation, file-based routing, and more

[self-promotion]

I wasn't satisfied with the current routing solutions for Svelte apps because many of the unofficial ones are unmaintained and don’t support Svelte 5. SvelteKit feels a bit overkill for a simple SPA, and I’m not a fan of its file-based routing structure. Inspired by TanStack Router, I decided to build my own router with these features in mind:

  • Type-safe: autocomplete and type-checking for navigation
  • File-based routing with a vite plugin (code-based is also supported if you prefer)
  • Layouts like in SvelteKit
  • Hooks/Route guards
  • Reactive search params for simpler state management in the URL
  • Code-splitting and preloading

Documentation website: https://sv-router.vercel.app

Repository: https://github.com/colinlienard/sv-router

The npm package version is currently low because I would like to gather feedback and make improvements before releasing the v1. I also have multiple other ideas of features that would complement this router well.

Hope you like it!