# langgptai/langgpt architecture

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

- Interactive diagram: https://gitdiagram.com/langgptai/langgpt
- Repository: https://github.com/langgptai/langgpt

## Overview

PromptShow is a browser-based editor for composing code or prompt-like text into styled, shareable images. The main path runs from the home page into the editor container and rendering surface, where users configure appearance and export or share results; separate routes support saved snippets and embeds. The README describes LangGPT prompt-design methodology, not this app, so it does not substantiate additional runtime capabilities. Some UI modules are represented from the file tree only; their interactions are omitted where source evidence is unavailable.

Main entry points: [`PromptShow/lib/api.js`](https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/api.js) (Application API), [`PromptShow/components/EditorContainer.js`](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/EditorContainer.js) (Editor container), [`PromptShow/pages/embed/index.js`](https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/embed/index.js) (Embed page), [`PromptShow/components/Carbon.js`](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Carbon.js) (Code canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor and output"]
  node_editor_container["Editor container<br/>[EditorContainer.js]"]
  node_editor["Code editor<br/>[Editor.js]"]
  node_carbon["Code canvas<br/>[Carbon.js]"]
  node_width["Width handler<br/>[WidthHandler.js]"]
  node_watermark["Watermark graphic<br/>[Watermark.js]"]
end

subgraph group_appearance["Appearance controls"]
  node_settings["Editor settings<br/>[Settings.js]"]
  node_themes["Theme controls<br/>[index.js]"]
  node_theme_create["Theme creation<br/>[ThemeCreate.js]"]
  node_highlights["Syntax highlights"]
  node_presets["Presets<br/>[Presets.js]"]
  node_backgrounds["Background selection"]
end

subgraph group_accounts["Accounts and snippets"]
  node_snippets_page["Snippet library<br/>[snippets.js]"]
  node_account_page["Account and billing<br/>[account.js]"]
  node_auth_context["Authentication context<br/>[AuthContext.js]"]
end

subgraph group_delivery["Sharing and routes"]
  node_home["Home page<br/>[index.js]"]
  node_export["Image export<br/>[ExportMenu.js]"]
  node_embed_page["Embed page<br/>[index.js]"]
end

subgraph group_platform["Runtime services"]
  node_api_context["API context<br/>[ApiContext.js]"]
  node_api["Application API<br/>[api.js]"]
  node_client["HTTP client and auth<br/>[client.js]"]
  node_routing["State routing<br/>[routing.js]"]
  node_local_state[("Local settings storage<br/>[util.js]")]
end

node_user(("User"))
node_snippet_service["Snippet service"]
node_unsplash["Unsplash service"]
node_imgur["Imgur"]

node_user -->|"opens"| node_home
node_home -->|"renders"| node_editor_container
node_editor_container -->|"uses"| node_editor
node_editor -.->|"configures"| node_carbon
node_carbon -->|"uses"| node_width
node_carbon -->|"renders"| node_watermark
node_themes -->|"renders"| node_theme_create
node_themes -->|"renders"| node_highlights
node_user -.->|"configures"| node_settings
node_user -.->|"selects"| node_presets
node_user -.->|"selects"| node_backgrounds
node_user -.->|"exports"| node_export
node_user -->|"browses"| node_snippets_page
node_user -.->|"manages account"| node_account_page
node_user -.->|"views embed"| node_embed_page
node_embed_page -->|"renders"| node_carbon
node_embed_page -->|"reads state"| node_routing
node_embed_page -->|"uses context"| node_api_context
node_snippets_page -->|"uses context"| node_api_context
node_snippets_page -->|"uses auth"| node_auth_context
node_auth_context -->|"sets token"| node_client
node_auth_context -->|"uses client"| node_api
node_api_context -->|"provides API"| node_api
node_api -->|"sends requests"| node_client
node_api -->|"requests snippets"| node_snippet_service
node_api -->|"requests images"| node_unsplash
node_api -->|"uploads image"| node_imgur
node_editor_container -->|"uses routing"| node_routing
node_routing -->|"uses helpers"| node_local_state
node_editor_container -->|"uses auth"| node_auth_context

click node_home "https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/index.js"
click node_editor_container "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/EditorContainer.js"
click node_editor "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Editor.js"
click node_carbon "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Carbon.js"
click node_width "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/WidthHandler.js"
click node_watermark "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/svg/Watermark.js"
click node_settings "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Settings.js"
click node_themes "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Themes/index.js"
click node_theme_create "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Themes/ThemeCreate.js"
click node_highlights "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Themes/GlobalHighlights.js"
click node_presets "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Presets.js"
click node_backgrounds "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/BackgroundSelect.js"
click node_export "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/ExportMenu.js"
click node_embed_page "https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/embed/index.js"
click node_snippets_page "https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/snippets.js"
click node_account_page "https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/account.js"
click node_auth_context "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/AuthContext.js"
click node_api_context "https://github.com/langgptai/langgpt/blob/main/PromptShow/components/ApiContext.js"
click node_api "https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/api.js"
click node_client "https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/client.js"
click node_routing "https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/routing.js"
click node_local_state "https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/util.js"

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_editor_container,node_editor,node_carbon,node_width,node_watermark,node_user toneBlue
class node_settings,node_themes,node_theme_create,node_highlights,node_presets,node_backgrounds toneAmber
class node_snippets_page,node_account_page,node_auth_context toneMint
class node_home,node_export,node_embed_page toneRose
class node_api_context,node_api,node_client,node_routing,node_local_state,node_snippet_service,node_unsplash,node_imgur toneIndigo
```

## Components

### Editor and output

- [Editor container](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/EditorContainer.js): `PromptShow/components/EditorContainer.js`
- [Code editor](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Editor.js): `PromptShow/components/Editor.js`
- [Code canvas](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Carbon.js): `PromptShow/components/Carbon.js`
- [Width handler](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/WidthHandler.js): `PromptShow/components/WidthHandler.js`
- [Watermark graphic](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/svg/Watermark.js): `PromptShow/components/svg/Watermark.js`

### Appearance controls

- [Editor settings](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Settings.js): `PromptShow/components/Settings.js`
- [Theme controls](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Themes/index.js): `PromptShow/components/Themes/index.js`
- [Theme creation](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Themes/ThemeCreate.js): `PromptShow/components/Themes/ThemeCreate.js`
- [Syntax highlights](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Themes/GlobalHighlights.js): `PromptShow/components/Themes/GlobalHighlights.js`
- [Presets](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/Presets.js): `PromptShow/components/Presets.js`
- [Background selection](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/BackgroundSelect.js): `PromptShow/components/BackgroundSelect.js`

### Accounts and snippets

- [Snippet library](https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/snippets.js): `PromptShow/pages/snippets.js`
- [Account and billing](https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/account.js): `PromptShow/pages/account.js`
- [Authentication context](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/AuthContext.js): `PromptShow/components/AuthContext.js`

### Sharing and routes

- [Home page](https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/index.js): `PromptShow/pages/index.js`
- [Image export](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/ExportMenu.js): `PromptShow/components/ExportMenu.js`
- [Embed page](https://github.com/langgptai/langgpt/blob/main/PromptShow/pages/embed/index.js): `PromptShow/pages/embed/index.js`

### Runtime services

- [API context](https://github.com/langgptai/langgpt/blob/main/PromptShow/components/ApiContext.js): `PromptShow/components/ApiContext.js`
- [Application API](https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/api.js): `PromptShow/lib/api.js`
- [HTTP client and auth](https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/client.js): `PromptShow/lib/client.js`
- [State routing](https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/routing.js): `PromptShow/lib/routing.js`
- [Local settings storage](https://github.com/langgptai/langgpt/blob/main/PromptShow/lib/util.js): `PromptShow/lib/util.js`

### Other components

- **User**
- **Snippet service**
- **Unsplash service**
- **Imgur**

## Connections

- User → Home page: opens
- Home page → Editor container: renders (evidence: `PromptShow/pages/index.js`)
- Editor container → Code editor: uses (evidence: `PromptShow/components/EditorContainer.js`)
- Code editor → Code canvas: configures
- Code canvas → Width handler: uses (evidence: `PromptShow/components/Carbon.js`)
- Code canvas → Watermark graphic: renders (evidence: `PromptShow/components/Carbon.js`)
- Theme controls → Theme creation: renders (evidence: `PromptShow/components/Themes/index.js`)
- Theme controls → Syntax highlights: renders (evidence: `PromptShow/components/Themes/index.js`)
- User → Editor settings: configures
- User → Presets: selects
- User → Background selection: selects
- User → Image export: exports
- User → Snippet library: browses (evidence: `PromptShow/pages/snippets.js`)
- User → Account and billing: manages account
- User → Embed page: views embed
- Embed page → Code canvas: renders (evidence: `PromptShow/pages/embed/index.js`)
- Embed page → State routing: reads state (evidence: `PromptShow/pages/embed/index.js`)
- Embed page → API context: uses context (evidence: `PromptShow/pages/embed/index.js`)
- Snippet library → API context: uses context (evidence: `PromptShow/pages/snippets.js`)
- Snippet library → Authentication context: uses auth (evidence: `PromptShow/pages/snippets.js`)
- Authentication context → HTTP client and auth: sets token (evidence: `PromptShow/components/AuthContext.js`)
- Authentication context → Application API: uses client (evidence: `PromptShow/components/AuthContext.js`)
- API context → Application API: provides API (evidence: `PromptShow/components/ApiContext.js`)
- Application API → HTTP client and auth: sends requests (evidence: `PromptShow/lib/api.js`)
- Application API → Snippet service: requests snippets (evidence: `PromptShow/lib/api.js`)
- Application API → Unsplash service: requests images (evidence: `PromptShow/lib/api.js`)
- Application API → Imgur: uploads image (evidence: `PromptShow/lib/api.js`)
- Editor container → State routing: uses routing (evidence: `PromptShow/components/EditorContainer.js`)
- State routing → Local settings storage: uses helpers (evidence: `PromptShow/lib/routing.js`)
- Editor container → Authentication context: uses auth (evidence: `PromptShow/components/EditorContainer.js`)
