<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ryuya Ikeda</title>
    <description>The latest articles on DEV Community by Ryuya Ikeda (@rikeda71).</description>
    <link>https://dev.to/rikeda71</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3711140%2F59e54cf9-23f0-4a46-ac3e-763a035bc656.jpeg</url>
      <title>DEV Community: Ryuya Ikeda</title>
      <link>https://dev.to/rikeda71</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rikeda71"/>
    <language>en</language>
    <item>
      <title>Stop Manual Documentation: Auto-generate Markdown &amp; DBML from Drizzle ORM</title>
      <dc:creator>Ryuya Ikeda</dc:creator>
      <pubDate>Wed, 14 Jan 2026 14:35:44 +0000</pubDate>
      <link>https://dev.to/rikeda71/stop-manual-documentation-auto-generate-markdown-dbml-from-drizzle-orm-46f1</link>
      <guid>https://dev.to/rikeda71/stop-manual-documentation-auto-generate-markdown-dbml-from-drizzle-orm-46f1</guid>
      <description>&lt;p&gt;&lt;a href="https://orm.drizzle.team/" rel="noopener noreferrer"&gt;Drizzle ORM&lt;/a&gt; is gaining massive traction in the TypeScript ecosystem for being lightweight and type-safe. With v1.0 currently in beta, it is becoming a go-to choice for modern web applications.&lt;/p&gt;

&lt;p&gt;However, as your project grows, you might face a familiar challenge: The gap between your schema code and your documentation.&lt;/p&gt;

&lt;p&gt;To solve this, I built drizzle-docs-generator—a CLI tool that automatically generates Markdown documentation and DBML files directly from your Drizzle schema definitions.&lt;/p&gt;

&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/rikeda71" rel="noopener noreferrer"&gt;
        rikeda71
      &lt;/a&gt; / &lt;a href="https://github.com/rikeda71/drizzle-docs-generator" rel="noopener noreferrer"&gt;
        drizzle-docs-generator
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      CLI tool to generate DBML or markdown document from Drizzle ORM schemas.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;drizzle-docs-generator&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://www.npmjs.com/package/drizzle-docs-generator" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/0d685a5e0dcb725dbbbdc6b1c16734705675a6e949ca28e6db8ed3861b6f7db9/68747470733a2f2f6e6f6465692e636f2f6e706d2f6472697a7a6c652d646f63732d67656e657261746f722e7376673f7374796c653d736869656c647326646174613d762c6426636f6c6f723d627269676874677265656e" alt="NPM"&gt;&lt;/a&gt;
&lt;a href="https://codecov.io/gh/rikeda71/drizzle-docs-generator" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/dabf9d0f5e90a9bfc8f02e27563cda580ac859148ba16f320f906d689436b8a8/68747470733a2f2f636f6465636f762e696f2f67682f72696b65646137312f6472697a7a6c652d646f63732d67656e657261746f722f6272616e63682f6d61696e2f67726170682f62616467652e737667" alt="codecov"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;CLI tool to generate DBML and Markdown documentation from Drizzle ORM schemas. Extracts JSDoc comments and outputs them as Note clauses.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Directory Import Support&lt;/strong&gt;: Import all schema files from a directory&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No File Extension Required&lt;/strong&gt;: Works with extensionless imports (e.g., &lt;code&gt;import { users } from './users'&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JSDoc Comments&lt;/strong&gt;: Automatically extracts and converts to DBML Notes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relations Support&lt;/strong&gt;: Generate refs from &lt;code&gt;relations()&lt;/code&gt; or &lt;code&gt;defineRelations()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch Mode&lt;/strong&gt;: Auto-regenerate on file changes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple Output Formats&lt;/strong&gt;: Markdown (default) and DBML with ER diagrams&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://github.com/rikeda71/drizzle-docs-generator/./README.ja.md" rel="noopener noreferrer"&gt;日本語版READMEはこちら&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Install&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Local Install (recommended)&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; As a dev dependency&lt;/span&gt;
npm install --save-dev drizzle-docs-generator
&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; or&lt;/span&gt;
pnpm add -D drizzle-docs-generator

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; Then use with npx&lt;/span&gt;
npx drizzle-docs generate ./src/db/schema.ts -d postgresql&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Global Install&lt;/h3&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;npm install -g drizzle-docs-generator
&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; or&lt;/span&gt;
pnpm add -g drizzle-docs-generator

drizzle-docs generate ./src/db/schema.ts -d postgresql&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Basic Usage&lt;/h3&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; Markdown output (default)&lt;/span&gt;
drizzle-docs generate ./src/db/schema.ts -d postgresql -o ./docs
&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/rikeda71/drizzle-docs-generator" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;




&lt;h2&gt;
  
  
  The Problem: The Documentation Drift
&lt;/h2&gt;

&lt;p&gt;If you use Drizzle to manage your database, you’ve likely experienced these frustrations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Forgotten Updates: You modified the schema but forgot to update the Notion or Confluence wiki.&lt;/li&gt;
&lt;li&gt;Redundant Work: You’re writing JSDoc comments in your code, then manually re-typing them into a separate document.&lt;/li&gt;
&lt;li&gt;Black Box Columns: Without documentation, teammates have to dig through .ts files to understand what a specific column does.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Drizzle does not currently have a built-in documentation generator. While drizzle-kit handles migrations beautifully, its DDL generation doesn't fully support comment clauses yet.&lt;/p&gt;

&lt;p&gt;Note: There is an open issue for comment support (#886), but it is not yet finalized in the v1 roadmap as of early 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing drizzle-docs-generator
&lt;/h2&gt;

&lt;p&gt;drizzle-docs-generator solves these issues by acting as a single source of truth. By integrating this tool into your CI/CD pipeline, your documentation remains in lockstep with your code changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-D&lt;/span&gt; drizzle-docs-generator
&lt;span class="c"&gt;# or using pnpm&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;pnpm add &lt;span class="nt"&gt;-D&lt;/span&gt; drizzle-docs-generator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Markdown Documentation with Mermaid ER Diagrams
&lt;/h3&gt;

&lt;p&gt;Generate comprehensive documentation including table lists, column details, and visual diagrams.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;drizzle-docs generate ./src/db/schema.ts &lt;span class="nt"&gt;-d&lt;/span&gt; mysql &lt;span class="nt"&gt;-f&lt;/span&gt; markdown &lt;span class="nt"&gt;-o&lt;/span&gt; ./docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tool creates a README.md with a Mermaid-based ER diagram (which renders automatically on GitHub/GitLab) and separate table-specific .md files. These files detail constraints, indexes, and relations.&lt;/p&gt;

&lt;p&gt;The generator pulls directly from your JSDoc comments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;mysqlTable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/** User's display name */&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;notNull&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. DBML Support for Visual Tools
&lt;/h3&gt;

&lt;p&gt;DBML (Database Markup Language) is a standard for defining database schemas. You can export your Drizzle schema to DBML and import it into tools like dbdiagram.io or dbdocs.io.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;drizzle-docs generate ./src/db/schema.ts &lt;span class="nt"&gt;-d&lt;/span&gt; mysql &lt;span class="nt"&gt;-f&lt;/span&gt; dbml &lt;span class="nt"&gt;-o&lt;/span&gt; schema.dbml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Multi-Dialect Support
&lt;/h3&gt;

&lt;p&gt;The tool supports MySQL, PostgreSQL, and SQLite. Specify your database using the -d flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* -d mysql
* -d postgresql
* -d sqlite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Drizzle v1 (Beta) Compatibility
&lt;/h3&gt;

&lt;p&gt;Drizzle v1 introduced a new way to define relations. drizzle-docs-generator supports both the legacy (v0) and the new v1/v2 relation syntax.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works under the hood
&lt;/h2&gt;

&lt;p&gt;The tool leverages the TypeScript Compiler API to parse your schema files without actually running the code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AST Analysis: It converts your schema files into an Abstract Syntax Tree (AST).&lt;/li&gt;
&lt;li&gt;Schema Extraction: It identifies Drizzle-specific functions like mysqlTable and parses their arguments.&lt;/li&gt;
&lt;li&gt;JSDoc Mapping: It captures the JSDoc nodes associated with each table and column to use as descriptions.&lt;/li&gt;
&lt;li&gt;Relation Mapping: It parses the relations() function calls to understand how your tables are linked.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Automating your documentation saves time and reduces the risk of human error. If you are using Drizzle ORM, I hope drizzle-docs-generator helps your team keep your database architecture clear and accessible.&lt;/p&gt;

&lt;p&gt;I’d love to get your feedback! Feel free to leave a star, open an issue, or submit a PR on GitHub.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/rikeda71/drizzle-docs-generator" rel="noopener noreferrer"&gt;https://github.com/rikeda71/drizzle-docs-generator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NPM Package: &lt;a href="https://www.npmjs.com/package/drizzle-docs-generator" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/drizzle-docs-generator&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy coding! 🌧️&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>database</category>
      <category>drizzle</category>
      <category>documentation</category>
    </item>
  </channel>
</rss>
