# locupleto/streamlit-lightweight-charts-v5 architecture

> Architecture diagram of the GitHub repository locupleto/streamlit-lightweight-charts-v5, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/locupleto/streamlit-lightweight-charts-v5
- Repository: https://github.com/locupleto/streamlit-lightweight-charts-v5

## Overview

#### Purpose and public entry point
This repository packages a Streamlit custom component that renders TradingView Lightweight Charts v5 from Python, emphasizing multi-pane financial/technical-analysis layouts. Python callers invoke `lightweight_charts_v5_component` from `lightweight_charts_v5/__init__.py`; the component accepts chart/series specifications and returns through Streamlit’s component bridge.

#### Python-to-frontend component boundary
The package root registers or exposes the Streamlit component and is the sole intended Python API boundary: `lightweight_charts_v5/__init__.py`. Chart configuration, data points, dimensions, and options cross from Streamlit’s Python runtime into the bundled browser frontend as serializable component arguments. The frontend owns chart construction and browser-side rendering.

#### Browser rendering application
The Vite/React application is the rendering runtime. `lightweight_charts_v5/frontend/src/index.tsx` boots the Streamlit component frontend, while `lightweight_charts_v5/frontend/src/LightweightChartsComponent.tsx` translates supplied chart definitions into Lightweight Charts instances, series, panes, sizing, and chart lifecycle updates. `lightweight_charts_v5/frontend/index.html` is the Vite browser entry document.

#### Chart composition model
The central data flow is: caller builds `charts[]` → each chart supplies chart-level options, a series collection, and height → React creates/configures corresponding Lightweight Charts structures. Series payloads use Lightweight Charts-compatible records (for example time/value or OHLC data), leaving indicator calculation and market-data acquisition outside the library. Multi-pane support is driven by the v5 chart configuration handled in `lightweight_charts_v5/frontend/src/LightweightChartsComponent.tsx`.

#### Specialized visual overlays
Browser-side plugins encapsulate non-core rendering layers that sit on chart data/scales rather than the Python API:
- Ichimoku cloud with span fills and regime coloring: `lightweight_charts_v5/frontend/src/plugins/IchimokuCloudPlugin.ts`
- Static support/resistance-style rectangles: `lightweight_charts_v5/frontend/src/plugins/StaticRectanglePlugin.ts`
These are integrated by the main React chart component, keeping custom canvas/chart primitives separate from generic series setup.

#### Demo applications and external data
Streamlit applications under `demo/` are executable integration examples rather than library runtime dependencies. Main entry points are `demo/minimal_demo.py` and `demo/chart_demo.py`; standalone specialized examples include `demo/volume_profile_demo.py` and `demo/ichimoku_demo.py`. Demos obtain market data through Yahoo Finance via `yfinance`, then transform it into component-compatible chart payloads. Streamlit is the host runtime; TradingView Lightweight Charts is the browser charting dependency.

#### Delivery and verification
Python packaging/dependencies are defined by `pyproject.toml` and `requirements.txt`; the frontend’s Node/Vite dependency graph is in `lightweight_charts_v5/frontend/package.json`. CI and release automation run through `.github/workflows/ci.yml` and `.github/workflows/release.yml`. Browser-level component rendering is exercised through the Streamlit smoke application at `e2e/smoke_app.py` and its end-to-end checks.

Main entry points: [`lightweight_charts_v5/__init__.py`](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/__init__.py) (Component API), [`lightweight_charts_v5/frontend/src/LightweightChartsComponent.tsx`](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/LightweightChartsComponent.tsx) (Chart renderer), [`lightweight_charts_v5/frontend/src/index.tsx`](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/index.tsx) (Frontend bootstrap), [`demo/minimal_demo.py`](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/demo/minimal_demo.py) (Minimal demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_python["Python / Streamlit"]
  node_python_api["Component API<br/>Python package<br/>[__init__.py]"]
  node_streamlit_bridge["Streamlit bridge<br/>component protocol"]
end

subgraph group_frontend["Browser renderer"]
  node_vite_document["Vite document<br/>browser entry<br/>[index.html]"]
  node_frontend_bootstrap["Frontend bootstrap<br/>React entry<br/>[index.tsx]"]
  node_chart_component["Chart renderer<br/>React component"]
  node_lightweight_charts{{"Lightweight Charts v5<br/>browser dependency"}}
  node_ichimoku_plugin["Ichimoku cloud overlay<br/>chart plugin"]
  node_rectangle_plugin["Static rectangle overlay<br/>chart plugin"]
end

subgraph group_demos["Demo applications"]
  node_minimal_demo["Minimal demo<br/>Streamlit app<br/>[minimal_demo.py]"]
  node_chart_demo["Chart demo<br/>Streamlit app<br/>[chart_demo.py]"]
  node_specialized_demos["Specialized demos<br/>Streamlit apps<br/>[ichimoku_demo.py]"]
  node_yfinance["Yahoo Finance<br/>external data source"]
end

subgraph group_delivery["Build &amp; verification"]
  node_python_packaging["Python packaging<br/>package manifest<br/>[pyproject.toml]"]
  node_frontend_dependencies["Frontend dependencies<br/>Node manifest<br/>[package.json]"]
  node_ci["CI workflow<br/>GitHub Actions<br/>[ci.yml]"]
  node_release["Release workflow<br/>GitHub Actions<br/>[release.yml]"]
  node_smoke_app["Smoke app<br/>Streamlit E2E fixture<br/>[smoke_app.py]"]
end

node_chart_specs["Chart specifications<br/>component payload"]

node_minimal_demo -->|"fetches market data"| node_yfinance
node_chart_demo -->|"fetches market data"| node_yfinance
node_specialized_demos -->|"fetches market data"| node_yfinance
node_minimal_demo -->|"invokes"| node_python_api
node_chart_demo -->|"invokes"| node_python_api
node_specialized_demos -->|"invokes"| node_python_api
node_python_api -->|"accepts"| node_chart_specs
node_python_api -->|"registers / sends arguments"| node_streamlit_bridge
node_streamlit_bridge -->|"delivers component arguments"| node_frontend_bootstrap
node_vite_document -->|"loads"| node_frontend_bootstrap
node_frontend_bootstrap -->|"mounts"| node_chart_component
node_chart_specs -->|"drives chart options and series"| node_chart_component
node_chart_component -->|"creates charts, panes, and series"| node_lightweight_charts
node_chart_component -->|"integrates"| node_ichimoku_plugin
node_chart_component -->|"integrates"| node_rectangle_plugin
node_python_packaging -->|"packages"| node_python_api
node_frontend_dependencies -->|"supplies Vite/React runtime"| node_frontend_bootstrap
node_ci -->|"runs E2E checks"| node_smoke_app
node_release -->|"publishes"| node_python_packaging
node_smoke_app -->|"exercises"| node_python_api

click node_python_api "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/__init__.py"
click node_vite_document "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/index.html"
click node_frontend_bootstrap "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/index.tsx"
click node_chart_component "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/LightweightChartsComponent.tsx"
click node_ichimoku_plugin "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/plugins/IchimokuCloudPlugin.ts"
click node_rectangle_plugin "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/plugins/StaticRectanglePlugin.ts"
click node_minimal_demo "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/demo/minimal_demo.py"
click node_chart_demo "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/demo/chart_demo.py"
click node_specialized_demos "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/demo/ichimoku_demo.py"
click node_python_packaging "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/pyproject.toml"
click node_frontend_dependencies "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/package.json"
click node_ci "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/.github/workflows/ci.yml"
click node_release "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/.github/workflows/release.yml"
click node_smoke_app "https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/e2e/smoke_app.py"

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_python_api,node_streamlit_bridge toneBlue
class node_vite_document,node_frontend_bootstrap,node_chart_component,node_lightweight_charts,node_ichimoku_plugin,node_rectangle_plugin toneAmber
class node_minimal_demo,node_chart_demo,node_specialized_demos,node_yfinance toneMint
class node_python_packaging,node_frontend_dependencies,node_ci,node_release,node_smoke_app toneRose
class node_chart_specs toneNeutral
```

## Components

### Python / Streamlit

- [Component API](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/__init__.py): Python package · Sole public Python boundary for chart specifications. · `lightweight_charts_v5/__init__.py`
- **Streamlit bridge**: component protocol · Serializable arguments cross into the browser frontend.

### Browser renderer

- [Vite document](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/index.html): browser entry · `lightweight_charts_v5/frontend/index.html`
- [Frontend bootstrap](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/index.tsx): React entry · `lightweight_charts_v5/frontend/src/index.tsx`
- [Chart renderer](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/LightweightChartsComponent.tsx): React component · Creates, updates, sizes, and disposes multi-pane chart instances. · `lightweight_charts_v5/frontend/src/LightweightChartsComponent.tsx`
- **Lightweight Charts v5**: browser dependency · Provides chart, pane, scale, and series primitives.
- [Ichimoku cloud overlay](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/plugins/IchimokuCloudPlugin.ts): chart plugin · Draws span fills and regime coloring. · `lightweight_charts_v5/frontend/src/plugins/IchimokuCloudPlugin.ts`
- [Static rectangle overlay](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/src/plugins/StaticRectanglePlugin.ts): chart plugin · Draws support/resistance-style rectangles. · `lightweight_charts_v5/frontend/src/plugins/StaticRectanglePlugin.ts`

### Demo applications

- [Minimal demo](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/demo/minimal_demo.py): Streamlit app · `demo/minimal_demo.py`
- [Chart demo](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/demo/chart_demo.py): Streamlit app · `demo/chart_demo.py`
- [Specialized demos](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/demo/ichimoku_demo.py): Streamlit apps · Volume profile and Ichimoku examples. · `demo/ichimoku_demo.py`
- **Yahoo Finance**: external data source · Demo market-data provider via yfinance.

### Build & verification

- [Python packaging](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/pyproject.toml): package manifest · `pyproject.toml`
- [Frontend dependencies](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/lightweight_charts_v5/frontend/package.json): Node manifest · `lightweight_charts_v5/frontend/package.json`
- [CI workflow](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/.github/workflows/ci.yml): GitHub Actions · `.github/workflows/ci.yml`
- [Release workflow](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/.github/workflows/release.yml): GitHub Actions · `.github/workflows/release.yml`
- [Smoke app](https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/e2e/smoke_app.py): Streamlit E2E fixture · Exercises browser-level component rendering. · `e2e/smoke_app.py`

### Other components

- **Chart specifications**: component payload · charts[] contains options, series, data, and heights.

## Connections

- Minimal demo → Yahoo Finance: fetches market data
- Chart demo → Yahoo Finance: fetches market data
- Specialized demos → Yahoo Finance: fetches market data
- Minimal demo → Component API: invokes
- Chart demo → Component API: invokes
- Specialized demos → Component API: invokes
- Component API → Chart specifications: accepts
- Component API → Streamlit bridge: registers / sends arguments
- Streamlit bridge → Frontend bootstrap: delivers component arguments
- Vite document → Frontend bootstrap: loads
- Frontend bootstrap → Chart renderer: mounts
- Chart specifications → Chart renderer: drives chart options and series
- Chart renderer → Lightweight Charts v5: creates charts, panes, and series
- Chart renderer → Ichimoku cloud overlay: integrates
- Chart renderer → Static rectangle overlay: integrates
- Python packaging → Component API: packages
- Frontend dependencies → Frontend bootstrap: supplies Vite/React runtime
- CI workflow → Smoke app: runs E2E checks
- Release workflow → Python packaging: publishes
- Smoke app → Component API: exercises
