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

mongo-erd-generator

v1.0.1

Published

Interactive CLI tool to generate Entity Relationship Diagrams (ERD) from MongoDB databases

Readme

🍃 Mongo ERD Generator

Instantly visualize your MongoDB schema relations with zero configuration.

npm version License: ISC PRs Welcome

Mongo ERD Generator is a CLI tool that reverse-engineers your MongoDB database to create beautiful, interactive Entity Relationship Diagrams (ERDs). It uses advanced schema analysis to deduce relationships between collections without requiring any manual schema definition.

✨ Features

  • 🔮 Automatic Relationship Detection: Intelligent analysis of ObjectId references to infer relations.
  • 🖼️ Interactive Visualization: Powered by Mermaid.js and ELK layout engine for clean diagrams.
  • 🚀 Zero Config: Just connect and go. No schema files needed.
  • 🔍 Deep Inspection: Detects field types, embedded documents, and junction tables.
  • 🌐 Web-Based Viewer: Zooms, pans, and exports to PNG directly from your browser.
  • 🖥️ Cross-Platform: Works seamlessly on macOS, Windows, and Linux.

📦 Installation

Install globally via npm:

npm install -g mongo-erd-generator

🚀 Usage

Simply run the command in your terminal:

mongo-erd

Interactive Mode (Recommended)

  1. Enter your MongoDB connection string (default: mongodb://localhost:27017)
  2. Select the database you want to visualize from the list.
  3. The tool will generate the ERD and open it in your default browser.

Non-Interactive Options

You can also pass arguments directly for CI/CD or quick access:

mongo-erd --url "mongodb://localhost:27017" --db "my_database" --port 8080

🛠️ How it Works

  1. Connects to your MongoDB instance using the provided credentials.
  2. Samples documents from each collection to infer schema structure and types.
  3. Indexes all ObjectId fields to cross-reference collections.
  4. Deduces relationships (1:1, 1:Many, Many:Many) based on reference matching.
  5. Generates a Mermaid.js diagram and serves it locally.

🤝 Contributing

We love contributions! This is a passion project aimed at making MongoDB visualization accessible to everyone.

See CONTRIBUTING.md for how to get started.

📝 License

This project is licensed under the ISC License.