Skip to content

Dev Server

The velox dev command starts a development server with HMR.

Terminal window
velox dev

Server starts at http://localhost:3030.

Terminal window
velox dev --port 4000 # Custom port
velox dev --no-hmr # Disable HMR (use tsx watch)
velox dev --verbose # Detailed output

HMR provides fast reloads when files change:

  • Sub-second restart times
  • Preserves server state
  • Automatic velox:ready signal for accurate timing

In package.json:

{
"hotHook": {
"boundaries": [
"src/procedures/**/*.ts",
"src/schemas/**/*.ts"
]
}
}

For accurate timing metrics, add to your entry point:

await app.start({ port: 3030 });
if (process.send) {
process.send({ type: 'velox:ready' });
}

Add shutdown handlers to prevent connection leaks:

const shutdown = async () => {
await prisma.$disconnect();
process.exit(0);
};
process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown);