route-shape
v0.0.3
Published
Automatically generates type-safe routing objects from your file-based route structure Next.js. Scans your project files and creates TypeScript route definitions with full autocomplete support.
Downloads
81
Readme
Route Shape
Automatically generates type-safe routing objects from your file-based route structure Next.js. Scans your project files and creates TypeScript route definitions with full autocomplete support.
Installation
npm install route-shapeUsage
# Initialize configuration
npx route-shape init
# Generate routes
npx route-shape generateExample Output
From this file structure:
app/
page.tsx
products/page.tsx
auth/
sign-in/page.tsx
dashboard/
page.tsx
users/[userId]/page.tsxGenerates:
export const routes = {
Home: '/',
Products: '/products',
Auth: {
SignIn: '/auth/sign-in',
},
Dashboard: {
Home: '/dashboard',
Users: {
View: (userId: string) => `/dashboard/users/${userId}`,
},
},
};License
MIT
