Getting Started
Start a New Project
To kickstart a new project with sv-router, run the following command using your preferred package manager:
sh
npm create sv-router@latestsh
pnpm create sv-routersh
yarn create sv-routersh
bun create sv-routersh
deno run -A npm:create-sv-router@latestAfter setting up your project, you can use the sv CLI to automatically configure tools like ESLint and Prettier.
Then, dive into the routing concepts:
Install on an Existing Project
IMPORTANT
sv-router requires Svelte 5 to function properly.
Install the package using your preferred package manager:
sh
npm install sv-routersh
pnpm add sv-routersh
yarn add sv-routersh
bun add sv-routersh
deno add npm:sv-routerThen, choose between two routing approaches:
- Code-based routing: Offers greater control over your file architecture but requires manual route definition. Set up code-based routing here.
- File-based routing: Automatically generates route mappings based on a specific file structure. Set up file-based routing here.