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

@matserdam/prisma-neighborhood

v0.4.0

Published

CLI tool that generates ERD diagrams from Prisma schemas with configurable depth traversal

Readme

prisma-neighbourhood

Generate focused ERD diagrams from a Prisma schema by starting from any entity (model, view, or enum) and traversing relationships up to a configurable depth.

The npm package is @matserdam/prisma-neighborhood and it exposes two CLI commands:

  • prisma-hood (short alias)
  • prisma-neighborhood (full name)

Run with Bun (recommended)

# Mermaid ERD to stdout
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m User

Common examples

# Limit to direct relationships only (depth 1)
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m User -d 1

# Start from a view (shows view + related enums/models)
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m UserSummary -d 2

# Start from an enum (shows enum + all models/views using it)
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m UserRole -d 2

# Write Mermaid to a file (use .mmd or .md)
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m User -o erd.mmd

# Export to PNG
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m User -o erd.png

# Export to SVG (recommended for very large diagrams)
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m User -o erd.svg

# Export to PDF
bunx @matserdam/prisma-neighborhood -s ./prisma/schema.prisma -m User -o erd.pdf

# List renderers (and see which ones support PNG/PDF export)
bunx @matserdam/prisma-neighborhood --list-renderers

Install globally (optional)

npm install -g @matserdam/prisma-neighborhood

# Then you can run:
prisma-hood -s ./prisma/schema.prisma -m User

CLI options

| Option | Alias | Description | Default | |--------|-------|-------------|---------| | --schema <path> | -s | Path to the Prisma schema file | required | | --model <name> | -m | Entity to start traversal from (model, view, or enum) | required | | --depth <n> | -d | Relationship levels to traverse | 3 | | --renderer <name> | -r | Renderer to use | vector | | --output <file> | -o | Write to a file instead of stdout | stdout | | --list-renderers | | Show available renderers | | | --help | -h | Show help | | | --version | -V | Show version | |

Output formats

The output format is determined by the file extension:

| Extension | Output | |-----------|--------| | .mmd / .md | Mermaid ERD text | | .svg | SVG | | .png | PNG image | | .pdf | PDF |

Entity types

Models

Standard Prisma models are rendered as plain ERD entities.

Views

Views (requires previewFeatures = ["views"]) are rendered with a [view] prefix:

"[view] UserSummary" {
  Int id UK
  String email
}

Enums

Enums are rendered with an [enum] prefix, with the enum name as the type for each value:

"[enum] UserRole" {
  UserRole ADMIN
  UserRole USER
  UserRole GUEST
}

Traversal behavior

  • From a model: Traverses relations to other models/views, and enum fields to enums
  • From a view: Traverses relations to models/views, and enum fields to enums
  • From an enum: Finds all models/views using this enum, then traverses their relations