# thebiggavin/marketingdashboard architecture

> Architecture diagram of the GitHub repository thebiggavin/marketingdashboard, 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/thebiggavin/marketingdashboard
- Repository: https://github.com/thebiggavin/marketingdashboard

## Overview

Market Research Cockpit is a real-time market and industry research dashboard. Users open the web cockpit, whose dashboard sections poll the API client; the client normally calls the Node proxy, which aggregates public market data and returns it for display. The product also includes specialized AI, commodities, gold, and earnings views, plus native and installable shells. The README documents these capabilities; sampled code confirms the main web entry, API client, proxy, and selected data paths. Unsampled subsystem links are omitted where their callers are not shown.

Main entry points: [`src/App.tsx`](https://github.com/thebiggavin/marketingdashboard/blob/main/src/App.tsx) (Web app), [`server/index.cjs`](https://github.com/thebiggavin/marketingdashboard/blob/main/server/index.cjs) (Node proxy), [`src/lib/api.ts`](https://github.com/thebiggavin/marketingdashboard/blob/main/src/lib/api.ts) (API client), [`src/components/dash`](https://github.com/thebiggavin/marketingdashboard/tree/main/src/components/dash) (Market cockpit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Web app<br/>[App.tsx]"]
  node_sharedpoll["Shared polling"]
  node_api["API client<br/>[api.ts]"]
  node_hosting["Hosted access<br/>[hosting.ts]"]
end

subgraph group_research["Research views"]
  node_dashboard["Market cockpit"]
  node_ai["AI cockpit<br/>[AiDashboard.tsx]"]
  node_modelpricing["Model pricing<br/>[ModelCostPanel.tsx]"]
  node_earnings["Earnings window<br/>[FinDashboard.tsx]"]
  node_goods["Commodity prices<br/>[GoodsDashboard.tsx]"]
  node_gold["Gold monitor<br/>[GoldDashboard.tsx]"]
  node_chain["Industry chains<br/>[ChainPanel.tsx]"]
  node_orpanel["Usage charts"]
end

subgraph group_data["Data service"]
  node_proxy["Node proxy<br/>[index.cjs]"]
  node_sources["Market sources"]
  node_flow["Money flow<br/>[moneyflow.cjs]"]
  node_openrouter["OpenRouter usage<br/>[openrouter.cjs]"]
end

subgraph group_platform["App shells"]
  node_tvapp["Android TV shell<br/>[MainActivity.java]"]
  node_iosapp["iOS script shell<br/>[page.tsx]"]
  node_macapp["macOS shell<br/>[main.swift]"]
  node_pwa["PWA worker<br/>[sw.js]"]
end

node_user(("Researcher"))
node_marketdata(("Public data providers"))

node_user -->|"opens"| node_webapp
node_webapp -->|"renders"| node_dashboard
node_webapp -->|"routes to"| node_ai
node_webapp -->|"routes to"| node_goods
node_webapp -->|"routes to"| node_gold
node_webapp -->|"routes to"| node_earnings
node_webapp -->|"checks access"| node_hosting
node_webapp -->|"subscribes"| node_sharedpoll
node_dashboard -->|"renders"| node_chain
node_dashboard -.->|"fetches data"| node_api
node_sharedpoll -->|"polls"| node_api
node_api -->|"requests API"| node_proxy
node_api -.->|"fallback fetches"| node_marketdata
node_proxy -->|"dispatches"| node_sources
node_proxy -->|"calls"| node_flow
node_proxy -.->|"serves usage"| node_openrouter
node_orpanel -->|"loads usage"| node_api
node_orpanel -.->|"renders in"| node_ai
node_tvapp -->|"loads dashboard"| node_webapp
node_iosapp -->|"loads dashboard"| node_webapp
node_macapp -->|"embeds cockpit"| node_webapp
node_pwa -->|"caches shell"| node_webapp
node_marketdata -->|"provides feeds"| node_proxy

click node_webapp "https://github.com/thebiggavin/marketingdashboard/blob/main/src/App.tsx"
click node_dashboard "https://github.com/thebiggavin/marketingdashboard/tree/main/src/components/dash"
click node_ai "https://github.com/thebiggavin/marketingdashboard/blob/main/src/AiDashboard.tsx"
click node_modelpricing "https://github.com/thebiggavin/marketingdashboard/blob/main/src/components/dash/ModelCostPanel.tsx"
click node_earnings "https://github.com/thebiggavin/marketingdashboard/blob/main/src/FinDashboard.tsx"
click node_goods "https://github.com/thebiggavin/marketingdashboard/blob/main/src/GoodsDashboard.tsx"
click node_gold "https://github.com/thebiggavin/marketingdashboard/blob/main/src/GoldDashboard.tsx"
click node_chain "https://github.com/thebiggavin/marketingdashboard/blob/main/src/components/dash/ChainPanel.tsx"
click node_sharedpoll "https://github.com/thebiggavin/marketingdashboard/blob/main/src/hooks/useSharedPolling.ts"
click node_api "https://github.com/thebiggavin/marketingdashboard/blob/main/src/lib/api.ts"
click node_proxy "https://github.com/thebiggavin/marketingdashboard/blob/main/server/index.cjs"
click node_sources "https://github.com/thebiggavin/marketingdashboard/tree/main/server/sources"
click node_flow "https://github.com/thebiggavin/marketingdashboard/blob/main/server/sources/moneyflow.cjs"
click node_openrouter "https://github.com/thebiggavin/marketingdashboard/blob/main/server/sources/openrouter.cjs"
click node_orpanel "https://github.com/thebiggavin/marketingdashboard/blob/main/src/components/dash/OpenRouterPanel.tsx"
click node_hosting "https://github.com/thebiggavin/marketingdashboard/blob/main/src/lib/hosting.ts"
click node_tvapp "https://github.com/thebiggavin/marketingdashboard/blob/main/android-tv/app/src/main/java/app/marketcockpit/tv/MainActivity.java"
click node_iosapp "https://github.com/thebiggavin/marketingdashboard/blob/main/scriptable/page.tsx"
click node_macapp "https://github.com/thebiggavin/marketingdashboard/blob/main/macos/MarketCockpit/main.swift"
click node_pwa "https://github.com/thebiggavin/marketingdashboard/blob/main/public/sw.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_webapp,node_sharedpoll,node_api,node_hosting toneBlue
class node_dashboard,node_ai,node_modelpricing,node_earnings,node_goods,node_gold,node_chain,node_orpanel toneAmber
class node_proxy,node_sources,node_flow,node_openrouter toneMint
class node_tvapp,node_iosapp,node_macapp,node_pwa toneRose
class node_user,node_marketdata toneIndigo
```

## Components

### Web experience

- [Web app](https://github.com/thebiggavin/marketingdashboard/blob/main/src/App.tsx): `src/App.tsx`
- [Shared polling](https://github.com/thebiggavin/marketingdashboard/blob/main/src/hooks/useSharedPolling.ts): `src/hooks/useSharedPolling.ts`
- [API client](https://github.com/thebiggavin/marketingdashboard/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Hosted access](https://github.com/thebiggavin/marketingdashboard/blob/main/src/lib/hosting.ts): `src/lib/hosting.ts`

### Research views

- [Market cockpit](https://github.com/thebiggavin/marketingdashboard/tree/main/src/components/dash): `src/components/dash`
- [AI cockpit](https://github.com/thebiggavin/marketingdashboard/blob/main/src/AiDashboard.tsx): `src/AiDashboard.tsx`
- [Model pricing](https://github.com/thebiggavin/marketingdashboard/blob/main/src/components/dash/ModelCostPanel.tsx): `src/components/dash/ModelCostPanel.tsx`
- [Earnings window](https://github.com/thebiggavin/marketingdashboard/blob/main/src/FinDashboard.tsx): `src/FinDashboard.tsx`
- [Commodity prices](https://github.com/thebiggavin/marketingdashboard/blob/main/src/GoodsDashboard.tsx): `src/GoodsDashboard.tsx`
- [Gold monitor](https://github.com/thebiggavin/marketingdashboard/blob/main/src/GoldDashboard.tsx): `src/GoldDashboard.tsx`
- [Industry chains](https://github.com/thebiggavin/marketingdashboard/blob/main/src/components/dash/ChainPanel.tsx): `src/components/dash/ChainPanel.tsx`
- [Usage charts](https://github.com/thebiggavin/marketingdashboard/blob/main/src/components/dash/OpenRouterPanel.tsx): `src/components/dash/OpenRouterPanel.tsx`

### Data service

- [Node proxy](https://github.com/thebiggavin/marketingdashboard/blob/main/server/index.cjs): `server/index.cjs`
- [Market sources](https://github.com/thebiggavin/marketingdashboard/tree/main/server/sources): `server/sources`
- [Money flow](https://github.com/thebiggavin/marketingdashboard/blob/main/server/sources/moneyflow.cjs): `server/sources/moneyflow.cjs`
- [OpenRouter usage](https://github.com/thebiggavin/marketingdashboard/blob/main/server/sources/openrouter.cjs): `server/sources/openrouter.cjs`

### App shells

- [Android TV shell](https://github.com/thebiggavin/marketingdashboard/blob/main/android-tv/app/src/main/java/app/marketcockpit/tv/MainActivity.java): `android-tv/app/src/main/java/app/marketcockpit/tv/MainActivity.java`
- [iOS script shell](https://github.com/thebiggavin/marketingdashboard/blob/main/scriptable/page.tsx): `scriptable/page.tsx`
- [macOS shell](https://github.com/thebiggavin/marketingdashboard/blob/main/macos/MarketCockpit/main.swift): `macos/MarketCockpit/main.swift`
- [PWA worker](https://github.com/thebiggavin/marketingdashboard/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Researcher**
- **Public data providers**

## Connections

- Researcher → Web app: opens (evidence: `README.md`)
- Web app → Market cockpit: renders (evidence: `src/App.tsx`)
- Web app → AI cockpit: routes to (evidence: `src/App.tsx`)
- Web app → Commodity prices: routes to (evidence: `src/App.tsx`)
- Web app → Gold monitor: routes to (evidence: `src/App.tsx`)
- Web app → Earnings window: routes to (evidence: `src/App.tsx`)
- Web app → Hosted access: checks access (evidence: `src/App.tsx`)
- Web app → Shared polling: subscribes (evidence: `src/App.tsx`)
- Market cockpit → Industry chains: renders (evidence: `src/App.tsx`)
- Market cockpit → API client: fetches data (evidence: `src/components/dash/OpenRouterPanel.tsx`)
- Shared polling → API client: polls (evidence: `src/hooks/useSharedPolling.ts`)
- API client → Node proxy: requests API (evidence: `README.md`)
- API client → Public data providers: fallback fetches (evidence: `src/lib/api.ts`)
- Node proxy → Market sources: dispatches (evidence: `server/index.cjs`)
- Node proxy → Money flow: calls (evidence: `server/index.cjs`)
- Node proxy → OpenRouter usage: serves usage (evidence: `server/index.cjs`)
- Usage charts → API client: loads usage (evidence: `src/components/dash/OpenRouterPanel.tsx`)
- Usage charts → AI cockpit: renders in
- Android TV shell → Web app: loads dashboard (evidence: `README.md`)
- iOS script shell → Web app: loads dashboard (evidence: `README.md`)
- macOS shell → Web app: embeds cockpit (evidence: `README.md`)
- PWA worker → Web app: caches shell (evidence: `README.md`)
- Public data providers → Node proxy: provides feeds (evidence: `README.md`)
