README.md

July 21, 2025 ยท View on GitHub


logo

Prisma Generate UML is a VSCode extension that quickly creates UML diagrams from Prisma schemas with a single click, offering easy visualization.

You can download final bundles from the Releases section.

TypeScript React Tailwind CSS Prisma ORM Vite esbuild Biome

Note

๐Ÿšง Prisma Generate UML is currently under development. Stay tuned for more updates!

Example

๐Ÿ—๏ธ Architecture

graph TB
    subgraph "Prisma Input"
        SCHEMA["๐Ÿ“ schema.prisma<br/>Prisma schema file<br/>Models, Enums, Relations"]
        FILE_WATCHER["๐Ÿ‘๏ธ File Watcher<br/>Detects .prisma changes"]
    end
    
    subgraph "VSCode Environment"
        EDITOR["๐Ÿ“ VSCode Editor<br/>Editor interface"]
        CMD["โšก Command Palette<br/>prisma-generate-uml.generateUML"]
        ICON["๐Ÿ”— UML Icon<br/>Toolbar button"]
    end
    
    subgraph "Extension Core"
        EXT_ENTRY["๐Ÿš€ extension.ts<br/>Entry point<br/>Command registration"]
        PARSER["โšก DMMF Parser<br/>@prisma/internals<br/>getDMMF() + getSchemaWithPath()"]
        RENDER["๐ŸŽจ Render Engine<br/>transformDmmfToModelsAndConnections()<br/>Generates Models, Connections, Enums"]
        PANEL_MGR["๐Ÿ“‹ PrismaUMLPanel<br/>Manages WebView lifecycle<br/>postMessage() communication"]
    end
    
    subgraph "WebView Container"
        WEBVIEW["๐ŸŒ VSCode WebView<br/>Isolated container<br/>HTML + CSS + JS"]
        CSP["๐Ÿ”’ Content Security Policy<br/>WebView security"]
    end
    
    subgraph "React Application"
        APP["โš›๏ธ App.tsx<br/>Root component<br/>Global state"]
        THEME["๐ŸŽจ Theme Provider<br/>VSCode theme handling"]
        VISUALIZER["๐Ÿ“Š SchemaVisualizer<br/>Main container"]
        FLOW_PROVIDER["๐Ÿ”„ ReactFlowProvider<br/>@xyflow/react context"]
    end
    
    subgraph "UML Components"
        FLOW["๐Ÿ“Š ReactFlow Canvas<br/>Rendering engine<br/>Drag & Drop, Zoom, Pan"]
        MODEL_NODE["๐Ÿ—๏ธ ModelNode<br/>Model component<br/>Fields, Types, Relations"]
        ENUM_NODE["๐Ÿ“ EnumNode<br/>Enum component<br/>Enumerated values"]
        CONNECTIONS["๐Ÿ”— Edges/Connections<br/>Model relationships"]
    end
    
    subgraph "Output Actions"
        SCREENSHOT["๐Ÿ“ธ Screenshot<br/>Export PNG/SVG"]
        DOWNLOAD["๐Ÿ’พ Download<br/>Save image"]
    end
    
    SCHEMA --> FILE_WATCHER
    FILE_WATCHER --> EXT_ENTRY
    EDITOR --> CMD
    EDITOR --> ICON
    CMD --> EXT_ENTRY
    ICON --> EXT_ENTRY
    
    EXT_ENTRY --> PARSER
    PARSER --> RENDER
    RENDER --> PANEL_MGR
    
    PANEL_MGR --> WEBVIEW
    WEBVIEW --> CSP
    CSP --> APP
    
    APP --> THEME
    APP --> VISUALIZER
    VISUALIZER --> FLOW_PROVIDER
    FLOW_PROVIDER --> FLOW
    
    FLOW --> MODEL_NODE
    FLOW --> ENUM_NODE
    FLOW --> CONNECTIONS
    
    MODEL_NODE --> SCREENSHOT
    ENUM_NODE --> SCREENSHOT
    SCREENSHOT --> DOWNLOAD
    
    DOWNLOAD -.-> PANEL_MGR
    PANEL_MGR -.-> EXT_ENTRY

๐Ÿ“ฆ Project Structure

prisma-generate-uml/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ prisma-generate-uml/     # VSCode Extension
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ extension.ts     # Entry point
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ panels/          # WebView management
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ core/            # Rendering logic
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ webview-ui/              # React Frontend
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx          # Main component
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ components/      # UML Components
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ lib/             # Utils and types
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ schema.prisma            # Example schema
โ”‚
โ”œโ”€โ”€ turbo.json                   # Turbo configuration
โ””โ”€โ”€ package.json                 # Root workspace

๐Ÿš€ Development

Prerequisites

  • Node.js 18+
  • npm

Installation

# Clone the repository
git clone https://github.com/AbianS/prisma-generate-uml.git
cd prisma-generate-uml

# Install dependencies
npm install

# Development
npm run dev

โœจ Features

  • ๐Ÿ”ฅ Instant UML Diagrams: Generate UML diagrams from Prisma schemas with a single click
  • ๐Ÿ–ผ Easy Visualization: Simplify data architecture visualization in an exciting way
  • ๐Ÿ›  Seamless Integration: Works seamlessly within VSCode, no extra configuration required
  • ๐Ÿ“‚ Multi-file Prisma Schema Support: Full support for Prisma's prismaSchemaFolder feature
  • ๐Ÿ”ƒ Automatic Updates: Keep your UML diagrams up-to-date with schema changes

๐Ÿƒโ€โ™‚๏ธ Quick Usage

You must have the Prisma VSCode extension installed to use this extension.

  1. Open a .prisma file in VSCode
  2. Look for the UML icon in the editor toolbar
  3. Click it to generate the diagram instantly

๐Ÿ› ๏ธ Technologies

  • Extension: TypeScript + VSCode Extension API
  • WebView: React + Vite + Tailwind CSS
  • UML Rendering: React Flow + Custom Components
  • Prisma Integration: @prisma/internals DMMF
  • Monorepo: Turbo + npm workspaces
  • Code Quality: Biome (ESLint + Prettier alternative)

๐Ÿ“„ License

MIT License - see LICENSE for more details.