@keenmate/svelte-spa-router

A powerful dual-mode router for Svelte 5 applications built with the new runes system. Supports both hash (#/path) and history API (/path) routing with advanced features like navigation guards, named routes, and flexible querystring handling.

Svelte 5 Native

Built with Svelte 5 runes ($state, $derived, $effect) for optimal performance

🔀
Dual-mode Routing

Supports both hash (#/path) and history API (/path) routing modes

🛡️
Navigation Guards

Prevent navigation with beforeLeave callbacks, permission-based and resource-based route protection

🔗
Named Routes

Navigate by route name instead of path with parameter substitution

📊
Querystring & Filters

Query strings with auto-parsing, flexible filter aggregation, and navigation context for passing data

📜
Scroll Restoration

Remember scroll position on back navigation for better UX

Quick Installation

Get started in seconds

Install
npm
 
Configure
main.js
 
Use
App.svelte
 

Key Features

Route Parameters

Named & wildcard parameters
 

Navigation Guards

Prevent navigation