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@latest
sh
pnpm create sv-router
sh
yarn create sv-router
sh
bun create sv-router
sh
deno run -A npm:create-sv-router@latest
After 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-router
sh
pnpm add sv-router
sh
yarn add sv-router
sh
bun add sv-router
sh
deno add npm:sv-router
Then, 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.