1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174<br />
<p align="center">
<a href="#" target="_blank"><img src="./packages/prisma-generate-uml/media/readme/banner.jpg" alt="logo"></a>
<br />
<br />
<b>Prisma Generate UML</b> is a VSCode extension that quickly creates UML diagrams from Prisma schemas with a single click, offering easy visualization.
<br />
<br />
</p>
> _You can download final bundles from the [Releases](https://github.com/AbianS/prisma-generate-uml/releases) section._
      
> [!NOTE]
> ๐ง
> **Prisma Generate UML** is currently under development. Stay tuned for more updates!

## ๐๏ธ Architecture
```mermaid
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
```bash
# 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](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma)
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](LICENSE) for more details.