Architecture

December 5, 2025 · View on GitHub

┌────────────────────────────────────────────────────────────────────────────┐
│                           VS Code Extension                                │
│  packages/vscode/src/extension.ts                                          │
│                                                                            │
│  ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌───────────┐ │
│  │ Language Server │ │ Prisma Postgres │ │  Prisma Studio  │ │ AI Tools  │ │
│  │     Plugin      │ │     Manager     │ │     Plugin      │ │  Plugin   │ │
│  └────────┬────────┘ └────────┬─────┬──┘ └───────────────┬─┘ └───────────┘ │
│           │              HTTP │     │                    │                 │
│           │ LSP over IPC      │     │ fork()             │ HTTP (webview)  │
└───────────┼───────────────────┼─────┼────────────────────┼─────────────────┘
            │                   │     │                    │
            │                   │     └─────────────┐    ┌─┴──────────────────────┐
            ▼                   ▼                   ▼    ▼                        ▼
┌───────────────────────────┐  ┌ ─ ─ ─ ─ ─ ┐  ┌─────────────────────────┐  ┌ ─ ─ ─ ─ ─ ─ ─ ┐
│      Language Server      │      Prisma     │   PPG Dev Server Worker │    Remote Prisma
│  packages/language-server │  │  HTTP API │  │   dist/workers/         │  │   Postgres    │
│  /src/server.ts           │     (Cloud)     │   ppgDevServer.js       │      (Cloud)
│                           │  └ ─ ─ ─ ─ ─ ┘  │                         │  └ ─ ─ ─ ─ ─ ─ ─ ┘
│  ┌─────────────────────┐  │                 │  ┌───────────────────┐  │
│  │    MessageHandler   │  │                 │  │    @prisma/dev    │  │
│  │  Dispatches LSP     │  │                 │  │  Local PPG server │  │
│  │  requests           │  │                 │  │                   │  │
│  └──────────┬──────────┘  │                 │  │  ┌─────────────┐  │  │
│             │             │                 │  │  │   pglite    │  │  │
│             ▼             │                 │  │  │  In-process │  │  │
│  ┌─────────────────────┐  │                 │  │  │  PostgreSQL │  │  │
│  │ prisma-schema-wasm  │  │                 │  │  └─────────────┘  │  │
│  │  WASM module for    │  │                 │  └───────────────────┘  │
│  │  parsing/formatting │  │                 │                         │
│  └─────────────────────┘  │                 │  • Detached process     │
└───────────────────────────┘                 │  • IPC communication    │
                                              │  • Survives restarts    │
                                              └─────────────────────────┘

Build System

The VS Code extension uses esbuild to bundle the extension, language server, and worker processes into optimized JavaScript bundles. See Build System for details on the bundling configuration and why certain assets cannot be bundled.

Key Prisma Dependencies

These are internal Prisma packages that provide core functionality:

PackagePurposeBundled?
@prisma/prisma-schema-wasmWASM module for parsing/formatting/lintingPartial¹
@prisma/schema-files-loaderHandles loading multi-file Prisma schemasYes
@prisma/configLoads prisma.config.ts configurationYes
@prisma/studio-core-licensedPrisma Studio UI (webview)No²
@prisma/devLocal Prisma Postgres development serverPartial³
prisma-6-language-serverPinned Prisma 6 language serverNo⁴

¹ JS is bundled; WASM binary is copied separately (loaded at runtime via __dirname)

² Served as static files to the webview at runtime; cannot be inlined into a bundle

³ Bundled into separate worker (dist/workers/ppgDevServer.js); PGlite assets (pglite.data, pglite.wasm) are copied separately

⁴ Kept separate to support runtime switching between Prisma 6 and latest language servers via the prisma.pinToPrisma6 setting

Note: These dependencies are automatically updated via CI. A cron job runs every 5 minutes checking for new Prisma releases (see .github/workflows/1_check_for_updates.yml).

File Organization

packages/
├── language-server/
│   └── src/
│       ├── __test__/                # Tests and fixtures
│       │   ├── __fixtures__/        # .prisma test files
│       │   └── *.test.ts            # Test files
│       ├── lib/
│       │   ├── ast/                 # AST utilities
│       │   ├── code-actions/        # Quick fixes
│       │   ├── completions/         # Completion providers
│       │   ├── prisma-schema-wasm/  # WASM wrapper functions
│       │   ├── MessageHandler.ts    # Main LSP request dispatcher
│       │   └── Schema.ts            # PrismaSchema class
│       └── server.ts                # LSP server entry point

└── vscode/
    └── src/
        ├── __test__/                # Extension tests
        ├── plugins/                 # Plugin modules
        │   ├── ai-tools/
        │   ├── prisma-language-server/
        │   ├── prisma-postgres-manager/
        │   └── prisma-studio/
        ├── workers/                 # Separate process entry points
        │   └── ppgDevServer.ts      # Prisma Postgres local dev server
        ├── extension.ts             # Extension entry point
        └── util.ts                  # Shared utilities