Skip to content

AbianS/prisma-generate-uml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

85 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


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
Loading

πŸ“¦ 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

  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.