Build Process
The Build Process
Dex's build process transforms your source files into a deployable application. This guide covers what happens and when.
Development Mode
Run with bun run dev:
bun run devWhat happens:
- Watches
web/pages/andweb/layouts/for changes - Generates routes on file changes
- Starts dev server with hot reload
- Serves from
core/router/.generated/
Output:
- Routes generated in
core/router/.generated/routes.ts - Server runs at
http://localhost:7990 - Hot reload on page edits
Production Build
Run with bun run build:
bun run buildWhat happens:
- Generate routes — scans pages, creates
routes.ts - Bundle client — compiles React to static JS
- Build server — creates deployable Node binary
- Copy assets — moves
public/tobuild/
Output structure:
build/
├─ server # Node.js binary
├─ index.html # Entry HTML
├─ assets/
│ ├─ client.js # Client router bundle
│ └─ styles.css # CSS (if any)
└─ core/
└─ router/
└─ .generated/
├─ routes.ts
└─ layouts.tsBuild Commands
| Command | Purpose |
|---|---|
bun run dev | Start dev server with hot reload |
bun run build | Create production build |
bun run start | Run production server |
bun run generate | Regenerate routes only |
Generated Files
routes.ts
Maps routes to components:
export const routes = [
{ path: '/', component: () => import('../pages/index.tsx') },
{ path: '/about', component: () => import('../pages/about.tsx') },
]layouts.ts
Maps layouts to pages:
export const layouts = {
'/': () => import('../layouts/global.tsx'),
'/blog': () => import('../layouts/blog.tsx'),
}Never edit these files — they're auto-generated.
Customization
Override output locations in dex.config.ts:
export default {
outDir: 'src/.generated', // Generated files
distDir: 'build', // Production output
}See Also
- How Dex Works — Mental model
- Configuration — Customize paths
- Production Server — Running in prod