Skip to content

feat: add database-drizzle ORM module #10

@ronak-create

Description

@ronak-create

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

  • Drizzle appears as an option after database selection (or via foundation add drizzle)
  • Generated schema.ts and drizzle.config.ts type-check with zero errors
  • npm run db:push is wired in the generated package.json
  • Works with at least PostgreSQL and Neon database modules
  • Snapshot tests for at least 2 database combinations

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: databaseRelated to database systems, ORM integrations, or data modeling.new-modulebuild something here

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions