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:

import { defineConfig } from 'dex/config'

export default defineConfig({
  pagesDir: 'src/routes',
  layoutsDir: 'src/layouts',
  publicDir: 'static',
  outDir: 'src/.generated',
})

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