Code Generation
void gen model
void gen model <name> [columns...]Scaffold a Drizzle table, list and create routes, and a route to fetch one row by ID.
void gen model posts title:string body:text published:booleanCreates:
db/schema/posts.ts: a table withid,createdAt,updatedAt, and your columns- An export from
db/schema.ts routes/api/posts/index.ts:GETfor list andPOSTfor insert with validationroutes/api/posts/[id].ts:GETby id with404handling- Regenerated
.void/db.d.ts
The generated routes automatically detect your validation library from package.json (valibot, zod, or arktype). If none is found, you will be prompted to choose one or skip validation. Run void db push to apply the schema locally, or void db generate to create migrations before deploying.
Column format: name:type or name:type? (nullable). Types: string, text, datetime, integer, boolean, real, blob.
Model names must be lowercase alphanumeric with underscores (e.g. posts, user_roles). Existing files are never overwritten.
void gen migration
void gen migration <name>Create an empty migration file with a timestamp prefix (YYYYMMDDHHMMSS).
void gen migration add_avatar_to_users
# → db/migrations/20260410161500_add_avatar_to_users.sqlExisting projects using the old numeric prefix (0001_, 0002_, ...) can rename with void db rename-migrations.
void gen route
void gen route <path> [--methods get,post,...]Create a route file with defineHandler exports. Defaults to GET.
void gen route api/health
void gen route api/users --methods get,post,deleteCreates routes/<path>.ts with an exported handler for each method. Supported methods: get, post, put, patch, delete.
void gen middleware
void gen middleware <name>Create a numbered middleware file with defineMiddleware default export.
void gen middleware auth
# → middleware/01.auth.ts (or 02, 03, etc.)The prefix is auto-detected from existing middleware files.
void gen ssr
void gen ssr [--react | --vue | --svelte | --solid]Scaffold SSR entry points and a minimal App component for your framework.
Creates three files:
src/main.ssr.{tsx,ts}: server entry withdefineRendersrc/main.client.{tsx,ts}: client entry with hydrationsrc/App.{tsx,vue,svelte}: minimal interactive component
If no flag is provided, the framework is auto-detected from package.json dependencies.
void gen cron
void gen cron <name>Create a cron job file in crons/ with defineScheduled and a placeholder cron expression.
void gen cron hourly-syncvoid gen queue
void gen queue <name>Create a queue consumer file in queues/ with defineQueue, a Message interface, and commented-out batch options.
void gen queue emails