# daugmaud/graphiql architecture

> Architecture diagram of the GitHub repository daugmaud/graphiql, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daugmaud/graphiql
- Repository: https://github.com/daugmaud/graphiql

## Overview

##### Project Type and Purpose
- This is a large **monorepo** implementing the GraphQL IDE ecosystem. It ships:
- A reference in-browser IDE UI (`packages/graphiql`, `packages/graphiql-react`, `packages/graphiql-plugin-explorer`)
- Editor language modes for CodeMirror (`packages/codemirror-graphql`) and Monaco (`packages/monaco-graphql`)
- A centralized TypeScript-based GraphQL language service core (`packages/graphql-language-service`)
- An LSP server (`packages/graphql-language-service-server`) and accompanying CLI (`packages/graphql-language-service-server-cli`) for IDE integrations
- A VSCode extension (`packages/vscode-graphql`)
- Toolkit libraries for building fetchers, storage, async helpers (`packages/graphiql-toolkit`)
- Examples, documentation, CI & release orchestration.
- Purpose: Provide an official, extensible, to-specification set of GraphQL language and IDE tools across web UIs, editor modes, and LSP clients/servers.

##### Architectural Analysis of the File Structure
- **Root**
- `package.json`, `tsconfig.json`, `scripts/`, `resources/`, `.github/workflows/` – orchestrate build, test, release across workspaces
- `packages/` – each subfolder is a self-contained npm package published separately
- `examples/` – runnable demos showing how to consume and integrate the packages
- `docs/`, `working-group/` – specification, governance, migration/security docs
- **Packages**
- **UI Layer** (browser/web):
– `packages/graphiql` (React-based GraphiQL IDE)
– `packages/graphiql-react` (React bindings/UI components)
– `packages/graphiql-plugin-explorer` (doc-explorer plugin)
- **Editor Modes**:
– `packages/codemirror-graphql`
– `packages/monaco-graphql`
- **Language Service Core**:
– `packages/graphql-language-service` (shared logic: parsing, autocomplete, diagnostics)
- **Language Service Server**:
– `packages/graphql-language-service-server` (LSP server implementation)
– `packages/graphql-language-service-server-cli` (CLI wrapper)
- **IDE Extension**:
– `packages/vscode-graphql` (VSCode extension launching the LSP server, UI contributions)
- **Toolkit**:
– `packages/graphiql-toolkit` (helpers for fetchers, storage, formatters)

##### Key Architectural Patterns
- **Monorepo + Yarn Workspaces / Lerna style** – single source for multiple inter-dependent packages
- **Layered Dependencies** – UI packages depend on editor modes and the language service core; editor modes depend on the language service core; the LSP server wraps the core for IDEs; CLI and VSCode extension launch or consume the server
- **Separation of Concerns** – distinct boundaries between UI, language logic, server protocol, CLI, and editor integration
- **Shared Dev Tooling & CI** – root-level build scripts, TypeScript configs, ESLint, Prettier, Cypress for e2e, GitHub Actions workflows

##### Essential Elements to Capture
- **Workspace root** → orchestrates build, test, release
- **Dependency graph** between packages
- **Layer separation**: UI ↔ Modes ↔ Core ↔ Server/CLI ↔ IDE
- **Integration surfaces**: plugin APIs, LSP protocol, CLI interface
- **Dev pipeline**: scripts, CI workflows, tests, publication steps

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Workspace Orchestrator
    subgraph "Workspace Orchestrator"
        Root_pkg["package.json"]:::tooling
        Root_ts["tsconfig.json"]:::tooling
        Root_scripts["scripts/"]:::tooling
        Root_res["resources/"]:::tooling
        Root_ci[".github/workflows/"]:::tooling
    end

    %% UI Layer
    subgraph "UI Layer (Browser IDE)" 
        GRAPHIQL["packages/graphiql"]:::ui
        GRAPHIQL_REACT["packages/graphiql-react"]:::ui
        EXPLORER["packages/graphiql-plugin-explorer"]:::ui
    end

    %% Editor Modes
    subgraph "Editor Modes"
        CODEMIRROR["packages/codemirror-graphql"]:::editor
        MONACO["packages/monaco-graphql"]:::editor
    end

    %% Language Service Core
    subgraph "Language Service Core"
        CORE["packages/graphql-language-service"]:::core
    end

    %% Server & CLI
    subgraph "Server & CLI"
        SERVER["packages/graphql-language-service-server"]:::server
        CLI["packages/graphql-language-service-cli"]:::server
    end

    %% IDE Extension
    subgraph "IDE Extension"
        VSCODE["packages/vscode-graphql"]:::ide
    end

    %% Toolkit
    subgraph "Toolkit Libraries"
        TOOLKIT["packages/graphiql-toolkit"]:::tooling
    end

    %% Examples & Demos
    subgraph "Examples & Demos"
        EX1["examples/cm6-graphql-parcel/"]:::tooling
        EX2["examples/graphiql-cdn/"]:::tooling
        EX3["examples/graphiql-create-react-app/"]:::tooling
        EX4["examples/graphiql-parcel/"]:::tooling
        EX5["examples/graphiql-webpack/"]:::tooling
        EX6["examples/monaco-graphql-react-vite/"]:::tooling
        EX7["examples/monaco-graphql-webpack/"]:::tooling
    end

    %% Documentation & Governance
    subgraph "Docs & Governance"
        DOCS["docs/"]:::tooling
        WG["working-group/"]:::tooling
    end

    %% Dependency Relationships
    Root_scripts -->|orchestrates| GRAPHIQL
    Root_scripts --> GRAPHIQL_REACT
    Root_scripts --> EXPLORER
    Root_scripts --> CODEMIRROR
    Root_scripts --> MONACO
    Root_scripts --> CORE
    Root_scripts --> SERVER
    Root_scripts --> CLI
    Root_scripts --> VSCODE
    Root_scripts --> TOOLKIT
    Root_scripts --> EX1
    Root_scripts --> DOCS

    GRAPHIQL -->|depends on| CODEMIRROR
    GRAPHIQL -->|depends on| MONACO
    GRAPHIQL -->|depends on| CORE

    GRAPHIQL_REACT -->|depends on| CORE
    EXPLORER -->|uses plugin API| GRAPHIQL

    CODEMIRROR -->|invokes| CORE
    MONACO -->|invokes| CORE

    SERVER -->|wraps| CORE
    CLI -->|launches| SERVER

    VSCODE -->|spawns RPC| SERVER

    EX1 -->|imports| GRAPHIQL
    EX1 -->|imports| TOOLKIT
    EX2 -->|imports| GRAPHIQL
    EX3 -->|imports| GRAPHIQL_REACT
    EX4 -->|imports| GRAPHIQL
    EX5 -->|imports| GRAPHIQL
    EX6 -->|imports| MONACO
    EX7 -->|imports| MONACO

    DOCS -->|describes| CORE
    WG -->|defines specs| CORE

    %% Click Events
    click Root_pkg "https://github.com/daugmaud/graphiql/blob/main/package.json"
    click Root_ts "https://github.com/daugmaud/graphiql/blob/main/tsconfig.json"
    click Root_scripts "https://github.com/daugmaud/graphiql/tree/main/scripts/"
    click Root_res "https://github.com/daugmaud/graphiql/tree/main/resources/"
    click Root_ci "https://github.com/daugmaud/graphiql/tree/main/.github/workflows/"

    click GRAPHIQL "https://github.com/daugmaud/graphiql/tree/main/packages/graphiql/"
    click GRAPHIQL_REACT "https://github.com/daugmaud/graphiql/tree/main/packages/graphiql-react/"
    click EXPLORER "https://github.com/daugmaud/graphiql/tree/main/packages/graphiql-plugin-explorer/"

    click CODEMIRROR "https://github.com/daugmaud/graphiql/tree/main/packages/codemirror-graphql/"
    click MONACO "https://github.com/daugmaud/graphiql/tree/main/packages/monaco-graphql/"

    click CORE "https://github.com/daugmaud/graphiql/tree/main/packages/graphql-language-service/"

    click SERVER "https://github.com/daugmaud/graphiql/tree/main/packages/graphql-language-service-server/"
    click CLI "https://github.com/daugmaud/graphiql/tree/main/packages/graphql-language-service-cli/"

    click VSCODE "https://github.com/daugmaud/graphiql/tree/main/packages/vscode-graphql/"

    click TOOLKIT "https://github.com/daugmaud/graphiql/tree/main/packages/graphiql-toolkit/"

    click EX1 "https://github.com/daugmaud/graphiql/tree/main/examples/cm6-graphql-parcel/"
    click EX2 "https://github.com/daugmaud/graphiql/tree/main/examples/graphiql-cdn/"
    click EX3 "https://github.com/daugmaud/graphiql/tree/main/examples/graphiql-create-react-app/"
    click EX4 "https://github.com/daugmaud/graphiql/tree/main/examples/graphiql-parcel/"
    click EX5 "https://github.com/daugmaud/graphiql/tree/main/examples/graphiql-webpack/"
    click EX6 "https://github.com/daugmaud/graphiql/tree/main/examples/monaco-graphql-react-vite/"
    click EX7 "https://github.com/daugmaud/graphiql/tree/main/examples/monaco-graphql-webpack/"

    click DOCS "https://github.com/daugmaud/graphiql/tree/main/docs/"
    click WG "https://github.com/daugmaud/graphiql/tree/main/working-group/"

    %% Styles
    classDef ui fill:#D0E6FF,stroke:#4A90E2,stroke-width:1px
    classDef editor fill:#E0FFD0,stroke:#6DA54E,stroke-width:1px
    classDef core fill:#FFF4C1,stroke:#D8B100,stroke-width:1px
    classDef server fill:#FFE0B2,stroke:#F08C00,stroke-width:1px
    classDef ide fill:#E1D0FF,stroke:#8B2AF5,stroke-width:1px
    classDef tooling fill:#F0F0F0,stroke:#A0A0A0,stroke-width:1px
```
