# graphql/graphiql architecture

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

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

## Overview

##### Project type and purpose
- This is a full-stack monorepo (“GraphQL IDE Monorepo”) that publishes multiple npm packages:
- A core GraphQL language service library
- Editor integrations (CodeMirror 5, CodeMirror 6, Monaco)
- A React-based Web IDE (GraphiQL)
- LSP server & CLI for editors & IDEs
- VSCode extensions (syntax, execution, language integration)
- Utility toolkit and plugins (doc-explorer, code-exporter, history, explorer)
- Example apps and Netlify functions

##### File structure
- Top-level: configuration, CI, docs, examples, functions, packages, resources, scripts, working-group
- “packages/…”: one folder per published module, each with its own src, tests, build configs
- “examples/…”: front-end demos showing how to wire up each integration
- “functions/graphql.ts”: a Netlify serverless function demo
- Monorepo orchestration: turbo.json (task runner), yarn workspaces, changesets for releases

##### README for additional insights
- The README describes the ecosystem: language-service core → shared by GraphiQL, CodeMirror, Monaco
- LSP server and CLI layer wrapping the core for IDE use
- VSCode extension consumes the LSP server via IPC or stdio
- Examples illustrate end-to-end flows

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Monorepo Root"
        subgraph Tooling
            TURBO["turbo.json"]:::tooling
            RELEASE["changesets & workflows"]:::tooling
        end
        subgraph Packages
            Core["Core GraphQL Language Service"]:::library
            LSP["Language Service Server (LSP)"]:::server
            CLI["CLI Wrapper for LSP"]:::server
            CM5["CodeMirror-GraphQL (CM5)"]:::editor
            CM6["CM6-GraphQL"]:::editor
            Monaco["Monaco-GraphQL"]:::editor
            GRAPHIQL["GraphiQL Host IDE"]:::ui
            GRAPHIQL_REACT["GraphiQL React Library"]:::library
            PLUG_DOC["Doc Explorer Plugin"]:::ui
            PLUG_CODE["Code Exporter Plugin"]:::ui
            PLUG_EXP["Explorer Panel Plugin"]:::ui
            PLUG_HIST["History Plugin"]:::ui
            VS_SYNTAX["VSCode Syntax Extension"]:::vscode
            VS_LANG["VSCode Language Integration"]:::vscode
            VS_EXEC["VSCode Execution Extension"]:::vscode
        end
        subgraph Examples
            EXAMPLES["Example Apps"]:::examples
        end
        FUNCTIONS["Netlify Function (GraphQL API stub)"]:::server
    end

    Core -->|imports| CM5
    Core -->|imports| CM6
    Core -->|imports| Monaco
    Core -->|exports APIs| GRAPHIQL_REACT
    Core -->|core engine| LSP
    LSP -->|wraps| CLI
    LSP -->|JSON-RPC| VS_LANG
    LSP -->|JSON-RPC| VS_EXEC
    CLI -->|used by| EXAMPLES
    GRAPHIQL -->|uses| GRAPHIQL_REACT
    GRAPHIQL -->|integrates| CM5
    GRAPHIQL -->|integrates| CM6
    GRAPHIQL -->|integrates| Monaco
    PLUG_DOC -.->|extends| GRAPHIQL
    PLUG_CODE -.->|extends| GRAPHIQL
    PLUG_EXP -.->|extends| GRAPHIQL
    PLUG_HIST -.->|extends| GRAPHIQL
    EXAMPLES -->|demonstrates| GRAPHIQL
    EXAMPLES -->|demos| CM5
    EXAMPLES -->|demos| CM6
    EXAMPLES -->|demos| Monaco
    EXAMPLES -->|calls HTTP| FUNCTIONS
    TURBO -->|orchestrates| Packages
    RELEASE -->|publishes| Packages

    classDef library fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef ui fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef server fill:#fff9c4,stroke:#333,stroke-width:1px
    classDef vscode fill:#e1bee7,stroke:#333,stroke-width:1px
    classDef editor fill:#d1c4e9,stroke:#333,stroke-width:1px
    classDef examples fill:#b2dfdb,stroke:#333,stroke-width:1px
    classDef tooling fill:#eeeeee,stroke:#333,stroke-width:1px

    click Core "https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service"
    click LSP "https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-server"
    click CLI "https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-cli"
    click CM5 "https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql"
    click CM6 "https://github.com/graphql/graphiql/tree/main/packages/cm6-graphql"
    click Monaco "https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql"
    click GRAPHIQL "https://github.com/graphql/graphiql/tree/main/packages/graphiql"
    click GRAPHIQL_REACT "https://github.com/graphql/graphiql/tree/main/packages/graphiql-react"
    click PLUG_DOC "https://github.com/graphql/graphiql/tree/main/packages/graphiql-plugin-doc-explorer"
    click PLUG_CODE "https://github.com/graphql/graphiql/tree/main/packages/graphiql-plugin-code-exporter"
    click PLUG_EXP "https://github.com/graphql/graphiql/tree/main/packages/graphiql-plugin-explorer"
    click PLUG_HIST "https://github.com/graphql/graphiql/tree/main/packages/graphiql-plugin-history"
    click VS_SYNTAX "https://github.com/graphql/graphiql/tree/main/packages/vscode-graphql-syntax"
    click VS_LANG "https://github.com/graphql/graphiql/tree/main/packages/vscode-graphql"
    click VS_EXEC "https://github.com/graphql/graphiql/tree/main/packages/vscode-graphql-execution"
    click EXAMPLES "https://github.com/graphql/graphiql/tree/main/examples/"
    click FUNCTIONS "https://github.com/graphql/graphiql/blob/main/functions/graphql.ts"
    click TURBO "https://github.com/graphql/graphiql/blob/main/turbo.json"
    click RELEASE "https://github.com/graphql/graphiql/blob/main/.changeset/config.json"
```
