Skip to content

Free MIT template · Day 6 of 365

You're looking at a demo. Download the built static files (drop on any host) or grab the full source to customize.

↓ Download static ↓ Source (Astro) All 365 →Build with me →

# Installation

## Requirements

routekit requires Node 18+ for development and a browser that supports the History API (every browser since 2014). It works with any frontend renderer — React, Preact, Solid, Vue, or vanilla.

## Install

- npm
- pnpm
- bun
- yarn

Terminal window

    npm install routekit

Terminal window

    pnpm add routekit

Terminal window

    bun add routekit

Terminal window

    yarn add routekit

routekit ships ESM and CJS bundles plus full TypeScript declarations. There is no peer dependency on a UI framework.

Tip

All routekit functions are tree-shakable. Importing only `createRouter` and `useRoute` lands at roughly 1.8 KB post-minification + gzip in a real production bundle.

## Verify the install

Create a tiny test file in your project:

scripts/check-routekit.ts

    import { createRouter } from 'routekit';
    const r = createRouter([{ path: '/', handler: () => 'ok' }]);console.log(r.match('/')); // → { handler: …, params: {} }

Run it with your runner of choice. If you see `{ handler: ..., params: {} }`, the install is good.

Don't import from a deep path

Always import from the top-level package: `import { createRouter } from 'routekit'`. Deep imports like `routekit/internal/match` are not part of the public API and may be renamed without warning.

## Next steps

Continue to the quickstart for a working router in 10 lines, or jump to your first route for a deeper walkthrough.