Dev Vs Prod
Development vs Production
Dex behaves differently in development and production modes. This guide explains the differences between dex start and dex start -p.
Development Mode
Run with the native Go CLI:
dex startThis invokes core/bootstrap/dev.ts, which spawns the parallel dev watchers and runs core/runtime/app/index.ts.
Characteristics:
- Watches
web/pages/andweb/layouts/and regeneratescore/router/.generated/ - Compiles Tailwind CSS and ESM client bundles in watch mode to
web/public/assets/ - Live-reloads connected browsers via SSE (
/__dev/reload) - Disables asset caching (
Cache-Control: no-store) - Pretty colored request logging (ignoring
/__dev/reloadnoise)
Environment:
NODE_ENV=development(unset or development)PORT=7990(orportfromdex.config.ts; automatically falls back viafindAvailablePortif busy)
Production Mode
Build once and run the Standalone Bun server executable (build/server):
dex build
dex start -pOr run the binary directly without the CLI:
NODE_ENV=production PORT=7990 ./build/serverCharacteristics:
- Serves ESM code-split bundles (
client.js,chunks/[name]-[hash].js) and minifiedstyles.cssfrombuild/assets/ - Sets immutable cache headers (
public, max-age=31536000, immutable) on/assets/*alongside?v=<hash>cache-busted HTML references - Serves prerendered static HTML from
build/__ssg/before falling back tobuild/index.html - Disables
/__dev/reload(returns404) - Plain-text request logs (colors disabled when
NODE_ENV=productionorNO_COLORis set)
Environment:
NODE_ENV=productionPORTfrom environment ordex.config.ts(default:7990)
Key Differences
| Feature | Development (dex start) | Production (dex start -p) |
|---|---|---|
Live Reload (/__dev/reload) | Enabled (SSE) | Disabled (404) |
| Asset Cache-Control | no-store | public, max-age=31536000, immutable |
| Client Bundle | Unminified ESM watch build | Minified ESM + content-hashed chunks + ?v=<hash> |
| SSG Prerendering | Client-rendered on demand | Serves build/__ssg/ HTML when prerendered |
| Logging | Colored TTY output | Plain timestamped output |
| Server Process | bun --watch core/runtime/app/index.ts | Standalone Bun server executable (./build/server) |
API-Only Mode
Run the compiled production server without serving frontend assets or SPA HTML:
NODE_ENV=production DEX_API_ONLY=1 ./build/serverUseful for:
- API gateway setups
- Separate CDN/static frontend deployments
- Backend-only microservices
Environment Variables
| Variable | Development | Production |
|---|---|---|
PORT | 7990 (or dex.config.ts) | 7990 (or dex.config.ts) |
NODE_ENV | development | production |
DEX_API_ONLY | N/A | 1 or true for API-only mode |
NO_COLOR | Disable colored logs | Always plain in prod |
DEX_DEV_RAW | 1 to bypass [task] line prefixing | N/A |
PUBLIC_* / NEXT_PUBLIC_* / VITE_* | Injected at client build time | Injected at client build time |
Best Practices
- Develop locally with
dex start— watches routes, CSS, client bundles, and server together - Test production builds locally — run
dex build && dex start -pbefore deploying - Use
DEX_API_ONLY=1— when deploying API routes independently from static assets - Never commit
build/orcore/router/.generated/— generate them in CI/CD or during release builds
See Also
- Build Process — How builds and SSG prerendering work
- Production Server — Production server details
- Watch Process — Dev supervisor internals