https://github.com/bearstudio/astro-typed-routes
Astro integration to build a typed routes object
https://github.com/bearstudio/astro-typed-routes
Last synced: 10 months ago
JSON representation
Astro integration to build a typed routes object
- Host: GitHub
- URL: https://github.com/bearstudio/astro-typed-routes
- Owner: BearStudio
- Created: 2025-09-05T08:54:20.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-05T22:42:11.000Z (10 months ago)
- Last Synced: 2025-09-06T00:22:48.965Z (10 months ago)
- Language: TypeScript
- Size: 264 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🚀 Astro Typed Routes
This Astro integration helps you generating a typed ROUTES object that you can
use with [lunalink](https://github.com/BearStudio/lunalink) so you can enjoy
fully typed routes in all your Astro project, avoiding wrong parameters and 404
pages.
## Installation
### Automatic Integration Setup
You can install the integration through `astro add` command so it automatically
install the package and configure your `astro.config.mjs` for you.
```sh
pnpm astro add @bearstudio/astro-typed-routes
```
### Manual Installation
```sh
pnpm add @bearstudio/astro-typed-routes
```
```diff
import { defineConfig } from 'astro/config';
+import typedRoutes from "@bearstudio/astro-typed-routes";
export default defineConfig({
integrations: [
+ typedRoutes(),
]
});
```
## Usage
This integration automatically generate a `./src/routes.gen.ts` file in your
project when you add or remove a file from the `./src/pages` folder.
Then, use the exported const `ROUTES` in your project with
[lunalink](https://github.com/BearStudio/lunalink) for path with params.
```index.astro
---
import {lunalink } from "@bearstudio/lunalink"
import { ROUTES } from "../routes.gen";
---
About
```