My App

Custom Structure

Custom Project Structure

Use dex.config.ts to customize your folder structure.

Default Structure

web/
├─ pages/
├─ layouts/
└─ public/

Custom Structure

Create dex.config.ts:

export default {
  pagesDir: 'src/routes',
  layoutsDir: 'src/layouts',
  outRoutesTs: 'src/.generated/routes.ts',
  outRoutesJson: 'src/.generated/manifest.json',
  outLayoutsTs: 'src/.generated/layouts.ts',
}

Now your structure becomes:

src/
├─ routes/           # Pages
├─ layouts/         # Layouts
└─ static/          # Assets

CLI Override

Override config on the command line:

bun run dev --pagesDir src/views

Programmatic Usage

import { generateFsRoutes } from '@dex/router'

await generateFsRoutes({
  pagesDir: 'app/routes',
  outTs: 'app/.generated/routes.ts',
})

See Also

On this page