Summary
Add Drizzle ORM as an optional database layer on top of any SQL database module.
Unlike raw driver modules, Drizzle is a schema-first ORM with full type inference — it deserves its own module category (orm) rather than fitting under database.
Why
Drizzle has rapidly become the preferred ORM in the TypeScript ecosystem, especially for projects using serverless databases.
It's driver-agnostic (works with pg, mysql2, @neondatabase/serverless, etc.) — making it a cross-cutting module that augments existing database modules rather than replacing them.
Design consideration
This is the first orm category module.
Before implementing, consider:
- Whether
orm should be a new category in the prompt graph (a separate question after database)
- OR whether it should be an add-on (
foundation add drizzle)
Discussion welcome in comments.
Files to generate
src/db/schema.ts — typed table definitions using drizzle-orm
src/db/index.ts — db instance wired to the selected driver
drizzle.config.ts
- Updated
.env.example with DATABASE_URL
Implementation hints
-
Add packages/modules/src/orm/drizzle.ts
-
Key dependencies (conditional on selected database):
drizzle-orm
drizzle-kit
- adapter:
drizzle-orm/node-postgres
drizzle-orm/mysql2
drizzle-orm/neon-serverless
-
compatibility.requires should reference the database module
→ Drizzle cannot be selected without a SQL database
-
configPatches should add:
db:push script to package.json
Contributor guidance
Refer to CONTRIBUTING.md → "Adding a New Module"
Acceptance criteria
Summary
Add Drizzle ORM as an optional database layer on top of any SQL database module.
Unlike raw driver modules, Drizzle is a schema-first ORM with full type inference — it deserves its own module category (
orm) rather than fitting underdatabase.Why
Drizzle has rapidly become the preferred ORM in the TypeScript ecosystem, especially for projects using serverless databases.
It's driver-agnostic (works with
pg,mysql2,@neondatabase/serverless, etc.) — making it a cross-cutting module that augments existing database modules rather than replacing them.Design consideration
This is the first
ormcategory module.Before implementing, consider:
ormshould be a new category in the prompt graph (a separate question afterdatabase)foundation add drizzle)Discussion welcome in comments.
Files to generate
src/db/schema.ts— typed table definitions usingdrizzle-ormsrc/db/index.ts— db instance wired to the selected driverdrizzle.config.ts.env.examplewithDATABASE_URLImplementation hints
Add
packages/modules/src/orm/drizzle.tsKey dependencies (conditional on selected database):
drizzle-ormdrizzle-kitdrizzle-orm/node-postgresdrizzle-orm/mysql2drizzle-orm/neon-serverlesscompatibility.requiresshould reference the database module→ Drizzle cannot be selected without a SQL database
configPatchesshould add:db:pushscript topackage.jsonContributor guidance
Refer to CONTRIBUTING.md → "Adding a New Module"
Acceptance criteria
foundation add drizzle)schema.tsanddrizzle.config.tstype-check with zero errorsnpm run db:pushis wired in the generatedpackage.json