My App

Router

Router

Dex's file-based router handles routing, layouts, and client-side navigation.

Topics

How It Works

  1. Generate — Scans web/pages/ and creates routes.ts
  2. Serve — Server uses generated routes
  3. Navigate — Client router handles SPA navigation

Quick Example

web/pages/
├─ index.tsx         # /
├─ about.tsx         # /about
└─ users/[id].tsx    # /users/:id

CLI Commands

# Generate routes
bun run generate

# Dev with watch
bun run dev

# Build for production
bun run build

See Also

On this page