https://github.com/rorz/drizzle-erd
https://github.com/rorz/drizzle-erd
drizzle drizzle-orm erd
Last synced: 30 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rorz/drizzle-erd
- Owner: rorz
- Created: 2024-05-29T14:43:21.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-11T22:47:13.000Z (almost 2 years ago)
- Last Synced: 2026-04-16T17:11:21.675Z (about 2 months ago)
- Topics: drizzle, drizzle-orm, erd
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/drizzle-erd
- Size: 428 KB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Drizzle ERD
> A super-simple way to generate Entity-Relationship Diagrams (ERDs) from your Drizzle schema. Use case (CLI or in-code) and dialect (PG, MySQL, SQLite) agnostic!
[](https://github.com/rorz/drizzle-erd/actions/workflows/tests.yaml)
[](https://www.npmjs.com/package/drizzle-erd)
> [!IMPORTANT]
> Drizzle ERD is in **pre-release** and is not ready for production-reliant use cases.
## Alpha usage
If you'd like to use this package right now, in lieu of any proper documentation, here's how to get started.
### CLI
Call `drizzle-erd` directly from `npm` or `pnpm` from a script in your `package.json` like so:
```jsonc
{
//...Rest of package.json
"scripts": {
//...Other scripts
"db:generate-erd": "drizzle-erd --in ./src/or/path/to/schema.ts --out erd.svg"
}
}
```
### Options
The following CLI flags are available to be used with `drizzle-erd`.
| Name | Flag | Description |
| ------------------------------- | ----------- | ---------------------------------------------------------------------------------------- |
| [Required]
Schema source | `--in` | The path to your Drizzle `schema.ts` file. |
| [Required]
SVG output | `--out` | The destination path (and filename) of the output SVG. (Overwrites if already exists) |
| Debug logs | `--verbose` | Provide this flag to print the status of the schema generation with debug-level logging. |
### Add your ERD to your README
Add your ERD to your readme like this:
```md
```

### Make it all automatic
Call the `db:generate-erd` script you defined earlier from a Git `pre-commit` hook to make sure your generated ERD is always up-to-date (especially if you're printing it out to your README as above).