drizzle-gen (v1.0.3) is a code-generation tool that automatically derives Drizzle ORM relations from your schema definitions. It parses your PostgreSQL or MySQL Drizzle schema files and generates a `.gen.ts` file with the correct `relations()` calls, saving you from manually writing and maintaining them. Key differentiators: zero runtime dependencies, runs as a one-off CLI or in watch mode, supports npx/pnpx/bunx/yarn dlx, and auto-updates on schema changes. However, it requires a single schema file path in `drizzle.config.ts` (list format not supported) and currently only works with PostgreSQL and MySQL. Ideal for Drizzle projects that want to avoid boilerplate relation code.
npm install drizzle-genNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows a complete setup: install, run the generator, import both schema and relations, and use them in a drizzle query with relations.
Change schema config to a single string: schema: './schema.ts'
Use a supported database or wait for future updates.
Re-run npx drizzle-gen after renaming the schema file.
Set schema to a single string: schema: './schema.ts'
Switch to PostgreSQL or MySQL, or wait for future support.
Navigate to your project root where drizzle.config.ts is located, or create one.
No dependency data recorded yet.