Story

Show HN: Drizzle ORM schema to DBML/Markdown/Mermaid documentation generator

rikeda71 Tuesday, January 13, 2026

Hi HN,

I built a CLI tool that generates documentation from Drizzle ORM schema definitions.

The problem: Drizzle ORM doesn't have built-in schema documentation or ER diagram generation. While drizzle-dbml-generator exists for DBML output, I needed something that could also extract JSDoc comments and generate human-readable documentation.

What it does: - Extracts JSDoc comments from your schema and includes them in the output - Generates DBML (compatible with dbdocs.io and dbdiagram.io) - Generates Markdown documentation with Mermaid ER diagrams - Supports PostgreSQL, MySQL, and SQLite - Works with both Drizzle v0 (relations()) and v1 beta (defineRelations()) APIs - Watch mode for development

Example: drizzle-docs ./src/db/schema.ts -o schema.dbml drizzle-docs ./src/db/schema.ts -f markdown -o ./docs

The key differentiator is JSDoc extraction. If you document your schema like this:

  /** User account information */
  export const users = pgTable("users", {
    /** Unique identifier */
    id: serial("id").primaryKey(),
    /** User's email address */
    email: varchar("email", { length: 255 }).notNull(),
  });
These comments become Notes in DBML or descriptions in Markdown output.

Built with TypeScript, uses the TS Compiler API for comment extraction. MIT licensed.

Would love feedback on what output formats or features would be most useful.

Summary
The article provides instructions for generating documentation for the Drizzle database system using a custom generator. It covers the process of setting up the generator, configuring the documentation, and generating the final output.
2 0
Summary
github.com
Visit article Read on Hacker News