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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@power-maverick/tool-erd-generator

v1.0.4

Published

Generate Entity Relationship Diagrams (ERD) for Dataverse solutions - React-based tool for PowerPlatform ToolBox

Readme

Dataverse ERD Generator

A PowerPlatform ToolBox tool for generating Entity Relationship Diagrams (ERD) from Dataverse solutions using React and Vite.

Features

  • ✅ React 18 with TypeScript
  • ✅ Vite for fast development and building
  • ✅ Access to ToolBox API via window.toolboxAPI
  • ✅ Dataverse connection and authentication
  • ✅ Multiple ERD formats: Mermaid, PlantUML, Graphviz, Draw.io
  • ✅ Visual diagram rendering (Mermaid, PlantUML, Draw.io)
  • ✅ Configurable output (attributes, relationships, table limits)
  • ✅ Export diagrams (download source files or copy to clipboard)
  • ✅ Interactive UI with solution selection

Structure

erd-generator/
├── src/
│   ├── App.tsx               # Main React component
│   ├── main.tsx              # Entry point
│   ├── styles.css            # Global styles
│   ├── components/
│   │   └── ERDGenerator.ts   # ERD generation logic
│   ├── models/
│   │   └── interfaces.ts     # TypeScript interfaces
│   └── utils/
│       └── DataverseClient.ts # Dataverse API client
├── index.html                # HTML template
├── vite.config.ts            # Vite configuration
├── package.json
├── tsconfig.json
└── README.md

Installation

Install dependencies:

npm install

Development

Run development server:

npm run dev

Build for production:

npm run build

Preview production build:

npm run preview

Usage in ToolBox

  1. Build the tool:

    npm run build
  2. The built files will be in the dist/ directory:

    • index.html - Main entry point
    • index.js - Bundled application
    • index.css - Compiled styles
  3. Install the tool in PowerPlatform ToolBox through the UI or programmatically

Key Concepts

ToolBox API Integration

The tool integrates with PowerPlatform ToolBox via window.toolboxAPI:

// Get connection context
const context = await window.toolboxAPI.getToolContext();

// Show notification
await window.toolboxAPI.showNotification({
  title: "Success",
  body: "ERD generated successfully",
  type: "success"
});

// Save file
await window.toolboxAPI.saveFile(fileName, content);

// Copy to clipboard
await window.toolboxAPI.copyToClipboard(text);

Important: The tool must listen for TOOLBOX_CONTEXT via postMessage from the parent window. This provides connection information when the tool is loaded in a webview.

React Hooks

The tool demonstrates:

  • useState for managing component state
  • useEffect for initialization and side effects
  • Type-safe event handling with TypeScript
  • Dataverse API integration

ERD Generation

Supports four formats:

  1. Mermaid - Visual diagrams with interactive rendering
  2. PlantUML - Text-based UML diagrams
  3. Graphviz - DOT language for graph visualization
  4. Draw.io - XML format for diagrams.net/draw.io

Configuration options:

  • Include/exclude attributes
  • Include/exclude relationships
  • Limit maximum attributes per table

Styling

Uses CSS with modern features:

  • CSS Grid for layouts
  • Flexbox for alignment
  • Gradient backgrounds
  • Responsive design
  • Clean, professional UI

TypeScript

Full TypeScript support with:

  • Type declarations for ToolBox API
  • Strict type checking
  • Modern ES2020 features
  • React JSX types
  • Dataverse API types

Building Diagrams

The tool:

  1. Connects to Dataverse using provided credentials
  2. Lists available solutions
  3. Fetches solution metadata (tables, attributes, relationships)
  4. Generates diagram in selected format
  5. Renders visual preview (Mermaid, PlantUML, Draw.io) or shows source code
  6. Allows export via download or clipboard

Configuration Options

The tool provides several configuration options:

  • Output Format: Choose between Mermaid, PlantUML, Graphviz, or Draw.io
  • Include Attributes: Show/hide table columns in the diagram
  • Include Relationships: Show/hide relationships between tables
  • Max Attributes: Limit the number of attributes shown per table (0 = show all)

Output Formats

Mermaid

  • Modern, declarative diagram syntax
  • Visual preview available in the tool
  • Great for documentation and GitHub

PlantUML

  • Widely supported UML format
  • Can be rendered by many tools
  • Standard UML notation

Graphviz DOT

  • Graph description language
  • Powerful layout engines
  • Flexible customization options

Draw.io

  • Native diagrams.net/draw.io XML format
  • Visual preview using embedded draw.io viewer
  • Can be opened directly in draw.io web or desktop app
  • mxGraph-based format with entity-relationship notation
  • Tables displayed with attributes and relationships
  • Entities positioned in an organized grid layout

Troubleshooting

Build Issues

If builds fail, try:

# Clean build artifacts
rm -rf dist node_modules
npm install
npm run build

ToolBox Integration Issues

Check:

  1. window.toolboxAPI is available
  2. Console logs for TOOLBOX_CONTEXT messages
  3. Connection context is being received
  4. Network requests are successful

Contributing

Contributions are welcome! When contributing:

  1. Maintain PPTB integration patterns
  2. Keep webview bundle browser-only (no Node.js dependencies)
  3. Test in PowerPlatform ToolBox
  4. Update documentation as needed
  5. Follow existing code style

License

This project is licensed under the GPL-2.0 License - see the LICENSE file for details.

Support