Blazing fast, zero-dependency, TypeScript-native router for any environment.
Reminist is a high-performance routing library built with TypeScript. It uses an optimized Radix Tree structure where lookup speed is proportional to the length of the route path, not the total number of routes. This makes route resolution incredibly fast and scalable, especially for high-throughput environments where every microsecond counts.
You can install reminist using your preferred package manager:
bun add reminist
(Works with npm, yarn, or pnpm as well)
Here's a quick example to get you up and running:
import { Reminist } from 'reminist'
const router = new Reminist({ keys: ['GET'] })
.add('GET', '/users/:id', { handler: (userId: string) => console.log(`User fetched: ${userId}`) })
const result = router.find('GET', '/users/10')
if (result.node) {
console.log('User Id:', result.params) // { id: '10' }
result.node.store.handler(result.params.id) // User fetched: 10
}
The following benchmarks compare Reminist against other high-performance routers like Memoirist and Rou3.
You can find the detailed benchmark results and performance analysis in the BENCHMARK.md file.
Reminist supports several common routing patterns.
| Type | Syntax | Example | Description |
|---|---|---|---|
| Static | /path/to/page |
/about/contact |
Matches the exact path. The fastest type of route. |
| Dynamic | /:param |
/users/:id |
Matches any segment and captures its value in params. |
| Wildcard | * |
/assets/* |
A standalone * consumes the rest of the URL. The captured value is available in params['*']. |
| Catch-All | /[...param] |
/files/[...filePath] |
Captures all remaining segments as a single value in params. |
| Optional Catch-All | /[[...param]] |
/docs/[[...slug]] |
Behaves like a catch-all but also matches the route if no further segments are provided. |
Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you want to contribute code, please open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.