Dev Server
The velox dev command starts your application with hot module replacement, so code changes take effect in sub-second reloads instead of full process restarts. It reports precise timing metrics, classifies errors with actionable suggestions, and supports both API-only and full-stack (API + web) development.
Basic Usage
Section titled “Basic Usage”velox devServer starts at http://localhost:3030.
Options
Section titled “Options”| Option | Short | Default | Description |
|---|---|---|---|
--port <port> | -p | 3030 | Port to listen on |
--host <host> | -H | localhost | Host to bind to |
--entry <file> | -e | (auto-detected) | Entry point file |
--verbose | -v | false | Show detailed timing and reload information |
--debug | -d | false | Enable debug logging and request tracing |
--no-hmr | Disable HMR and use legacy tsx watch mode | ||
--no-clear | Disable console clearing on restart | ||
--all | false | Start both API and Web dev servers (workspace monorepos) |
Examples
Section titled “Examples”velox dev # Default: HMR on localhost:3030velox dev -p 4000 # Custom portvelox dev -H 0.0.0.0 # Bind to all interfacesvelox dev -e src/server.ts # Custom entry pointvelox dev --verbose # Detailed timing metricsvelox dev --debug # Debug logging + request tracingvelox dev --no-hmr # Legacy tsx watch modevelox dev --all # API + Web servers in parallelEntry Point Detection
Section titled “Entry Point Detection”The dev server auto-detects your entry point by looking for common patterns (src/index.ts, src/server.ts, etc.). In a workspace monorepo, it searches inside apps/api/.
If multiple entry points are found, you’ll be prompted to choose. To skip detection, specify one directly:
velox dev --entry src/server.tsProject Type Detection
Section titled “Project Type Detection”The dev server automatically detects your project type:
- Vite projects — Starts with HMR (or tsx watch with
--no-hmr) - RSC/Vinxi projects — Delegates to Vinxi’s dev server with file-based routing
Workspace Monorepo Support
Section titled “Workspace Monorepo Support”In a workspace monorepo with apps/api/ and apps/web/, use --all to start both servers:
velox dev --allThis starts the API server (with HMR) and the web dev server (pnpm dev in apps/web/) in parallel. Both are shut down together on Ctrl+C.
Hot Module Replacement
Section titled “Hot Module Replacement”HMR provides fast reloads when files change:
- Sub-second restart times
- Preserves server state
- Automatic
velox:readysignal for accurate timing
Configure HMR Boundaries
Section titled “Configure HMR Boundaries”In package.json:
{ "hotHook": { "boundaries": [ "src/procedures/**/*.ts", "src/schemas/**/*.ts" ] }}Server Ready Signal
Section titled “Server Ready Signal”For accurate timing metrics, add to your entry point:
await app.start();
if (process.send) { process.send({ type: 'velox:ready' });}Debug Mode
Section titled “Debug Mode”The --debug flag enables debug logging and request tracing by setting LOG_LEVEL=debug and VELOX_REQUEST_LOGGING=true:
velox dev --debugUseful for diagnosing request handling, middleware execution, and route matching.
Graceful Shutdown
Section titled “Graceful Shutdown”Add shutdown handlers to prevent connection leaks:
const shutdown = async () => { await prisma.$disconnect(); process.exit(0);};
process.on('SIGTERM', shutdown);process.on('SIGINT', shutdown);Related Content
Section titled “Related Content”- Schema Sync - Generate schemas + procedures for all models
- Generators - Code scaffolding
- Configuration - Server config