# langchain-ai/langgraphjs architecture

> Architecture diagram of the GitHub repository langchain-ai/langgraphjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/langchain-ai/langgraphjs
- Repository: https://github.com/langchain-ai/langgraphjs

## Overview

1. **This is a TypeScript/JavaScript monorepo for LangGraph.js.**  
   The repo ships the core orchestration engine, server/runtime components, client SDKs, framework-specific UI bindings, persistence backends, CLI tools, docs, and many runnable examples.

2. **The central runtime is `libs/langgraph-core`.**  
   This package contains the low-level graph execution model: channels, state reducers, prebuilt agent executors, and the Pregel-style runner/loop. It is the main “engine” layer and has no direct HTTP/UI concerns.

3. **`libs/langgraph` is the public umbrella package.**  
   It re-exports selected core capabilities to provide the primary developer-facing API surface. Architecturally it sits above `langgraph-core` and is meant to be the simple import target for application authors.

4. **Stateful execution and persistence are split into checkpoint packages.**  
   `libs/checkpoint` provides the generic checkpoint/store abstractions and in-memory implementations.  
   Backend-specific packages extend that model for **Postgres**, **MongoDB**, **Redis**, and **SQLite**. These packages are the persistence boundary for thread state, replay, time travel, and long-running workflows.

5. **`libs/langgraph-api` is the server-side control plane.**  
   It exposes HTTP APIs for assistants, runs, threads, store access, auth, streams, webhooks, and metadata. It also loads user graphs, parses project config, manages persistence, and mediates between external requests and the graph runtime.

6. **Graph loading is a distinct subsystem inside `langgraph-api`.**  
   The `graph/`, `storage/`, `ui/`, `auth/`, and `http/` folders separate concerns: loading user code, persisting runtime data, attaching UI assets, enforcing auth, and serving the network API. This is the main boundary between “user agent code” and “managed runtime”.

7. **Streaming is a first-class data flow across the stack.**  
   Graph execution produces incremental updates/tokens/events in `langgraph-core`, `langgraph-api` forwards them over HTTP/SSE-style streams, and `libs/sdk` plus the framework-specific SDKs consume and normalize those streams for UI rendering.

8. **`libs/sdk` is the generic client and UI orchestration layer.**  
   It contains API clients, auth helpers, SSE/stream utilities, and higher-level UI orchestration primitives such as message management, branching, interrupts, queues, and agent/session helpers. This package is the bridge from backend streams to frontend state.

9. **Framework SDKs adapt the generic SDK to UI frameworks.**  
   `libs/sdk-react`, `libs/sdk-svelte`, `libs/sdk-vue`, `libs/sdk-angular`, and `libs/sdk-angular` wrap the shared streaming/state logic for each frontend ecosystem. They are thin integration layers, not separate business logic stacks.

10. **The `libs/sdk-*` packages and `libs/langgraph-ui` support UI composition.**  
    `langgraph-ui` provides tooling for bundling/rendering UI assets, while the framework SDKs provide reusable stream/thread/context patterns. This is important for diagramming because the UI layer is intentionally decoupled from the graph engine.

11. **`libs/langgraph-cli` and `libs/create-langgraph` support project lifecycle.**  
    The CLI handles local dev, build, Docker/Cloudflare-oriented workflows, project bootstrapping, and packaging concerns. `create-langgraph` is the scaffolder that generates new LangGraph applications and agent templates.

12. **`libs/langgraph-supervisor`, `libs/langgraph-swarm`, and `libs/langgraph-cua` add specialized orchestration patterns.**  
    Supervisor/swarm packages model multi-agent handoff and coordination. CUA adds computer-use agent nodes like VM creation and action execution. These are extensions built on top of the core orchestration model.

13. **The repo has strong compatibility and environment-test boundaries.**  
    `internal/environment_tests` validates package exports across CJS, ESM, bundlers, Vite, Cloudflare, Vercel, and TypeScript compilation. This indicates the distribution boundary is a major architectural concern, not just runtime behavior.

14. **Docs and examples are treated as part of the product architecture.**  
    `docs/` is a full MkDocs-based documentation site with scripts that convert notebooks and generate reference material. `examples/` contains many runnable apps and notebooks demonstrating agent patterns, UI integrations, persistence, and deployment flows.

15. **Typical end-to-end flow is: app code → core graph → checkpoints → API/stream → SDK/UI.**  
    User-authored agent graphs are executed by `langgraph-core`, state is persisted via checkpoint backends, `langgraph-api` exposes the runtime over network APIs, and `sdk`/framework SDKs render streamed progress and interactive controls in client apps.

Main entry points: [`libs/langgraph-core`](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-core) (langgraph-core), [`libs/langgraph-api`](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-api) (langgraph-api), [`libs/sdk`](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk) (sdk), [`libs/checkpoint`](https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint) (checkpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_langgraph_core["langgraph-core<br/>graph engine"]
  node_langgraph["langgraph<br/>public API"]
end

subgraph group_persistence["Persistence"]
  node_checkpoint[("checkpoint")]
  node_checkpoint_postgres[("checkpoint-postgres<br/>postgres backend")]
  node_checkpoint_mongodb[("checkpoint-mongodb<br/>mongo backend")]
  node_checkpoint_redis[("checkpoint-redis<br/>redis backend")]
  node_checkpoint_sqlite[("checkpoint-sqlite<br/>sqlite backend")]
end

subgraph group_control["Control Plane"]
  node_langgraph_api["langgraph-api<br/>server control plane"]
  node_langgraph_cli["langgraph-cli<br/>developer cli"]
  node_create_langgraph["create-langgraph<br/>scaffolder"]
end

subgraph group_clients["Clients & UI"]
  node_sdk["sdk"]
  node_sdk_react["sdk-react<br/>react adapter"]
  node_sdk_svelte["sdk-svelte<br/>svelte adapter"]
  node_sdk_vue["sdk-vue<br/>vue adapter"]
  node_sdk_angular["sdk-angular<br/>angular adapter"]
  node_langgraph_ui["langgraph-ui<br/>ui bundler"]
end

subgraph group_ecosystem["Ecosystem"]
  node_supervisor{{"langgraph-supervisor<br/>multi-agent coord"}}
  node_swarm{{"langgraph-swarm<br/>multi-agent swarm"}}
  node_cua{{"langgraph-cua<br/>computer-use"}}
  node_docs["docs<br/>documentation site"]
  node_examples["examples"]
  node_environment_tests["environment tests<br/>compatibility matrix"]
  node_build_tools["build tools<br/>repo tooling"]
end

node_langgraph -->|"re-exports"| node_langgraph_core
node_langgraph_core -->|"persists via"| node_checkpoint
node_checkpoint_postgres -->|"extends"| node_checkpoint
node_checkpoint_mongodb -->|"extends"| node_checkpoint
node_checkpoint_redis -->|"extends"| node_checkpoint
node_checkpoint_sqlite -->|"extends"| node_checkpoint
node_langgraph_api -->|"executes graphs"| node_langgraph_core
node_langgraph_api -->|"stores state"| node_checkpoint
node_langgraph_api -->|"serves ui"| node_langgraph_ui
node_langgraph_api -->|"streams to"| node_sdk
node_langgraph_cli -->|"starts runtime"| node_langgraph_api
node_create_langgraph -->|"bootstraps"| node_langgraph_cli
node_sdk -->|"consumes api"| node_langgraph_api
node_sdk_react -->|"adapts"| node_sdk
node_sdk_svelte -->|"adapts"| node_sdk
node_sdk_vue -->|"adapts"| node_sdk
node_sdk_angular -->|"adapts"| node_sdk
node_supervisor -->|"builds on"| node_langgraph_core
node_swarm -->|"builds on"| node_langgraph_core
node_cua -->|"builds on"| node_langgraph_core
node_docs -.->|"documents"| node_langgraph_core
node_examples -.->|"demonstrates"| node_langgraph_core
node_environment_tests -.->|"validates exports"| node_langgraph
node_build_tools -.->|"supports"| node_langgraph_cli

click node_langgraph_core "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-core"
click node_langgraph "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph"
click node_checkpoint "https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint"
click node_checkpoint_postgres "https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-postgres"
click node_checkpoint_mongodb "https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-mongodb"
click node_checkpoint_redis "https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-redis"
click node_checkpoint_sqlite "https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-sqlite"
click node_langgraph_api "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-api"
click node_langgraph_cli "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-cli"
click node_create_langgraph "https://github.com/langchain-ai/langgraphjs/tree/main/libs/create-langgraph"
click node_sdk "https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk"
click node_sdk_react "https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-react"
click node_sdk_svelte "https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-svelte"
click node_sdk_vue "https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-vue"
click node_sdk_angular "https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-angular"
click node_langgraph_ui "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-ui"
click node_supervisor "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-supervisor"
click node_swarm "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-swarm"
click node_cua "https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-cua"
click node_docs "https://github.com/langchain-ai/langgraphjs/tree/main/docs"
click node_examples "https://github.com/langchain-ai/langgraphjs/tree/main/examples"
click node_environment_tests "https://github.com/langchain-ai/langgraphjs/tree/main/internal/environment_tests"
click node_build_tools "https://github.com/langchain-ai/langgraphjs/tree/main/internal/build"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_langgraph_core,node_langgraph toneBlue
class node_checkpoint,node_checkpoint_postgres,node_checkpoint_mongodb,node_checkpoint_redis,node_checkpoint_sqlite toneAmber
class node_langgraph_api,node_langgraph_cli,node_create_langgraph toneMint
class node_sdk,node_sdk_react,node_sdk_svelte,node_sdk_vue,node_sdk_angular,node_langgraph_ui toneRose
class node_supervisor,node_swarm,node_cua,node_docs,node_examples,node_environment_tests,node_build_tools toneIndigo
```

## Components

### Runtime

Core graph execution and orchestration layers.

- [langgraph-core](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-core): graph engine · Low-level execution model: channels, state, prebuilt agents, and Pregel-style runtime. · `libs/langgraph-core`
- [langgraph](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph): public API · Umbrella package re-exporting selected core capabilities for application authors. · `libs/langgraph`

### Persistence

Checkpoint and store backends for durable state.

- [checkpoint](https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint): checkpoint base · Generic checkpoint/store abstractions plus in-memory implementations. · `libs/checkpoint`
- [checkpoint-postgres](https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-postgres): postgres backend · Postgres persistence backend with migrations and store implementation. · `libs/checkpoint-postgres`
- [checkpoint-mongodb](https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-mongodb): mongo backend · MongoDB-backed checkpoint implementation. · `libs/checkpoint-mongodb`
- [checkpoint-redis](https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-redis): redis backend · Redis-backed checkpoint and store implementation. · `libs/checkpoint-redis`
- [checkpoint-sqlite](https://github.com/langchain-ai/langgraphjs/tree/main/libs/checkpoint-sqlite): sqlite backend · SQLite checkpoint backend for lightweight durable storage. · `libs/checkpoint-sqlite`

### Control Plane

Server, CLI, and project lifecycle tooling.

- [langgraph-api](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-api): server control plane · HTTP API server that loads graphs, serves runs/threads/store/auth, and streams execution. · `libs/langgraph-api`
- [langgraph-cli](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-cli): developer cli · Local development, build, Docker/Cloudflare workflows, and deployment tooling. · `libs/langgraph-cli`
- [create-langgraph](https://github.com/langchain-ai/langgraphjs/tree/main/libs/create-langgraph): scaffolder · Project and template generator for new LangGraph applications. · `libs/create-langgraph`

### Clients & UI

SDKs and UI integration layers for consuming streams.

- [sdk](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk): client sdk · Generic client, auth, SSE, and UI orchestration layer for consuming LangGraph services. · `libs/sdk`
- [sdk-react](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-react): react adapter · React bindings for the shared streaming and thread orchestration logic. · `libs/sdk-react`
- [sdk-svelte](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-svelte): svelte adapter · Svelte bindings for the shared streaming and thread orchestration logic. · `libs/sdk-svelte`
- [sdk-vue](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-vue): vue adapter · Vue bindings for the shared streaming and thread orchestration logic. · `libs/sdk-vue`
- [sdk-angular](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk-angular): angular adapter · Angular bindings for the shared streaming and thread orchestration logic. · `libs/sdk-angular`
- [langgraph-ui](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-ui): ui bundler · Tooling for bundling and rendering UI assets for LangGraph applications. · `libs/langgraph-ui`

### Ecosystem

Specialized orchestration packages, docs, examples, and validation.

- [langgraph-supervisor](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-supervisor): multi-agent coord · Supervisor-style multi-agent handoff and coordination patterns. · `libs/langgraph-supervisor`
- [langgraph-swarm](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-swarm): multi-agent swarm · Swarm-oriented agent coordination and handoff patterns. · `libs/langgraph-swarm`
- [langgraph-cua](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-cua): computer-use · Computer-use agent nodes for VM creation and action execution. · `libs/langgraph-cua`
- [docs](https://github.com/langchain-ai/langgraphjs/tree/main/docs): documentation site · MkDocs-based docs, reference generation scripts, and notebook conversion tooling. · `docs`
- [examples](https://github.com/langchain-ai/langgraphjs/tree/main/examples): runnable examples · Runnable apps and notebooks demonstrating agents, UI integrations, persistence, and deployment. · `examples`
- [environment tests](https://github.com/langchain-ai/langgraphjs/tree/main/internal/environment_tests): compatibility matrix · Export and packaging validation across CJS, ESM, bundlers, Vite, Cloudflare, Vercel, and TypeScript. · `internal/environment_tests`
- [build tools](https://github.com/langchain-ai/langgraphjs/tree/main/internal/build): repo tooling · Internal build utilities and benchmark harnesses used by the repository. · `internal/build`

## Connections

- langgraph → langgraph-core: re-exports · Public API surface builds on the core engine.
- langgraph-core → checkpoint: persists via · Runtime state can be checkpointed through the shared persistence abstractions.
- checkpoint-postgres → checkpoint: extends · Backend-specific persistence implementation.
- checkpoint-mongodb → checkpoint: extends · Backend-specific persistence implementation.
- checkpoint-redis → checkpoint: extends · Backend-specific persistence implementation.
- checkpoint-sqlite → checkpoint: extends · Backend-specific persistence implementation.
- langgraph-api → langgraph-core: executes graphs · Server loads user graphs and runs them through the engine.
- langgraph-api → checkpoint: stores state · API runtime uses checkpoint/store abstractions for durable workflow state.
- langgraph-api → langgraph-ui: serves ui · Server can attach or load UI assets for managed apps.
- langgraph-api → sdk: streams to · HTTP and streaming responses are consumed by client SDKs.
- langgraph-cli → langgraph-api: starts runtime · CLI manages local dev and deployment entrypoints for the API/server runtime.
- create-langgraph → langgraph-cli: bootstraps · Scaffolding feeds the project lifecycle supported by the CLI.
- sdk → langgraph-api: consumes api · Generic client layer talks to the server control plane and stream endpoints.
- sdk-react → sdk: adapts · Framework wrapper over the shared SDK logic.
- sdk-svelte → sdk: adapts · Framework wrapper over the shared SDK logic.
- sdk-vue → sdk: adapts · Framework wrapper over the shared SDK logic.
- sdk-angular → sdk: adapts · Framework wrapper over the shared SDK logic.
- langgraph-supervisor → langgraph-core: builds on · Specialized orchestration pattern implemented on top of the core engine.
- langgraph-swarm → langgraph-core: builds on · Specialized orchestration pattern implemented on top of the core engine.
- langgraph-cua → langgraph-core: builds on · Computer-use nodes are implemented on top of the core engine.
- docs → langgraph-core: documents · Documentation covers the runtime, persistence, server, and SDK layers.
- examples → langgraph-core: demonstrates · Examples show application patterns built on the core engine and surrounding stack.
- environment tests → langgraph: validates exports · Compatibility matrix checks package distribution across runtimes and bundlers.
- build tools → langgraph-cli: supports · Internal tooling assists build and release workflows.
