npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

drizzle-docs-generator

v0.6.1

Published

A CLI tool that generates DBML files from Drizzle ORM schema definitions.

Readme

drizzle-docs-generator

NPM codecov

CLI tool to generate DBML and Markdown documentation from Drizzle ORM schemas. Extracts JSDoc comments and outputs them as Note clauses.

Features:

  • Directory Import Support: Import all schema files from a directory
  • No File Extension Required: Works with extensionless imports (e.g., import { users } from './users')
  • JSDoc Comments: Automatically extracts and converts to DBML Notes
  • Relations Support: Generate refs from relations() or defineRelations()
  • Watch Mode: Auto-regenerate on file changes
  • Multiple Output Formats: Markdown (default) and DBML with ER diagrams

日本語版READMEはこちら

Install

Local Install (recommended)

# As a dev dependency
npm install --save-dev drizzle-docs-generator
# or
pnpm add -D drizzle-docs-generator

# Then use with npx
npx drizzle-docs generate ./src/db/schema.ts -d postgresql

Global Install

npm install -g drizzle-docs-generator
# or
pnpm add -g drizzle-docs-generator

drizzle-docs generate ./src/db/schema.ts -d postgresql

Usage

Basic Usage

# Markdown output (default)
drizzle-docs generate ./src/db/schema.ts -d postgresql -o ./docs

# DBML output
drizzle-docs generate ./src/db/schema.ts -d postgresql -f dbml -o schema.dbml

Output Format Options

Markdown Format (Default)

The default output format is Markdown, which generates multiple files with an ER diagram.

Options specific to Markdown format:

| Option | Description | | ----------------- | ------------------------------------------- | | --single-file | Output as a single file instead of multiple | | --no-er-diagram | Exclude ER diagram from output |

Examples:

# Multiple files with ER diagram (default)
drizzle-docs generate ./src/db/schema.ts -d postgresql -o ./docs

# Single file Markdown
drizzle-docs generate ./src/db/schema.ts -d postgresql --single-file -o schema.md

# Multiple files without ER diagram
drizzle-docs generate ./src/db/schema.ts -d postgresql --no-er-diagram -o ./docs

DBML Format

Use the -f dbml or --format dbml option to generate DBML format.

Examples:

# Output to file
drizzle-docs generate ./src/db/schema.ts -d postgresql -f dbml -o schema.dbml

# Directory - import all schema files from directory
drizzle-docs generate ./src/db/schema/ -d postgresql -f dbml -o schema.dbml

# Watch mode
drizzle-docs generate ./src/db/schema.ts -d postgresql -f dbml -w

Common Options

| Option | Description | | ------------------------- | --------------------------------------------------- | | -o, --output <path> | Output file or directory path | | -d, --dialect <dialect> | Database: postgresql (default), mysql, sqlite | | -f, --format <format> | Output format: markdown (default), dbml | | -w, --watch | Regenerate on file changes | | --force | Overwrite existing files without confirmation |

Relation Detection

Relations are automatically detected from your schema:

  • v1 API (defineRelations()): Detected from schema objects at runtime
  • v0 API (relations()): Detected by parsing source files

No configuration needed - the tool will use relation definitions when present, or fall back to foreign key constraints.

Example

/** Users table */
export const users = pgTable("users", {
  /** User ID */
  id: serial("id").primaryKey(),
  /** User name */
  name: text("name").notNull(),
});

DBML Output

Table users {
  id serial [pk, increment, note: 'User ID']
  name text [not null, note: 'User name']

  Note: 'Users table'
}

Markdown Output

# users

Users table

## Columns

| Name | Type   | Nullable | Default | Comment   |
| ---- | ------ | -------- | ------- | --------- |
| id   | serial | No       |         | User ID   |
| name | text   | No       |         | User name |

See examples/ for more detailed output samples.

License

MIT