# parikshithrg/pg-terminal architecture

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

- Interactive diagram: https://gitdiagram.com/parikshithrg/pg-terminal
- Repository: https://github.com/parikshithrg/pg-terminal

## Overview

PG-terminal is a private, read-only market terminal served locally. The principal workflow is an owner opening the web interface, supplying a Kite request token, and having the server exchange it for a daily access token and verify the profile; the Seasonality workflow stores validated completed candles and fetches only newer sessions on later loads. The excerpts establish SQLite storage and candle validation, while most server and interface internals were not sampled, so those links are limited to README evidence or marked unverified.

Main entry points: [`server.py`](https://github.com/parikshithrg/pg-terminal/blob/main/server.py) (Local server), [`dist/index.html`](https://github.com/parikshithrg/pg-terminal/blob/main/dist/index.html) (Web interface), [`eod_store.py`](https://github.com/parikshithrg/pg-terminal/blob/main/eod_store.py) (Validated candle store), [`dist/styles.css`](https://github.com/parikshithrg/pg-terminal/blob/main/dist/styles.css) (Shared styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Terminal interface"]
  node_interface["Web interface<br/>[index.html]"]
  node_shared_styles["Shared styles<br/>[styles.css]"]
  node_universe_data["Reference universes"]
end

subgraph group_runtime["Local runtime"]
  node_server["Local server<br/>[server.py]"]
  node_kite{{"Kite API"}}
end

subgraph group_marketdata["Market data"]
  node_seasonality["Seasonality candles<br/>[server.py]"]
  node_eod_store["Validated candle store<br/>[eod_store.py]"]
  node_sqlite[("SQLite database")]
end

node_owner(("Terminal owner"))

node_owner -->|"opens"| node_interface
node_interface -->|"served by"| node_server
node_owner -->|"submits token"| node_server
node_server -->|"exchanges token"| node_kite
node_server -->|"verifies profile"| node_kite
node_server -.->|"uses storage"| node_eod_store
node_eod_store -->|"reads and writes"| node_sqlite
node_interface -->|"loads styles"| node_shared_styles

click node_interface "https://github.com/parikshithrg/pg-terminal/blob/main/dist/index.html"
click node_shared_styles "https://github.com/parikshithrg/pg-terminal/blob/main/dist/styles.css"
click node_universe_data "https://github.com/parikshithrg/pg-terminal/blob/main/dist/reference-universes.js"
click node_server "https://github.com/parikshithrg/pg-terminal/blob/main/server.py"
click node_seasonality "https://github.com/parikshithrg/pg-terminal/blob/main/server.py"
click node_eod_store "https://github.com/parikshithrg/pg-terminal/blob/main/eod_store.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_interface,node_shared_styles,node_universe_data toneBlue
class node_server,node_kite toneAmber
class node_seasonality,node_eod_store,node_sqlite toneMint
class node_owner toneIndigo
```

## Components

### Terminal interface

- [Web interface](https://github.com/parikshithrg/pg-terminal/blob/main/dist/index.html): `dist/index.html`
- [Shared styles](https://github.com/parikshithrg/pg-terminal/blob/main/dist/styles.css): `dist/styles.css`
- [Reference universes](https://github.com/parikshithrg/pg-terminal/blob/main/dist/reference-universes.js): `dist/reference-universes.js`

### Local runtime

- [Local server](https://github.com/parikshithrg/pg-terminal/blob/main/server.py): `server.py`
- **Kite API**

### Market data

- [Seasonality candles](https://github.com/parikshithrg/pg-terminal/blob/main/server.py): `server.py`
- [Validated candle store](https://github.com/parikshithrg/pg-terminal/blob/main/eod_store.py): `eod_store.py`
- **SQLite database**

### Other components

- **Terminal owner**

## Connections

- Terminal owner → Web interface: opens (evidence: `README.md`)
- Web interface → Local server: served by (evidence: `README.md`)
- Terminal owner → Local server: submits token (evidence: `README.md`)
- Local server → Kite API: exchanges token (evidence: `README.md`)
- Local server → Kite API: verifies profile (evidence: `README.md`)
- Local server → Validated candle store: uses storage
- Validated candle store → SQLite database: reads and writes (evidence: `eod_store.py`)
- Web interface → Shared styles: loads styles (evidence: `README.md`)
