# ishekaa12/analytics-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/ishekaa12/analytics-dashboard
- Repository: https://github.com/ishekaa12/analytics-dashboard

## Overview

This is a privacy-focused, multi-site web analytics platform. A site tracker sends pageview and click events to the FastAPI backend; the backend filters bots, enriches events with geography, stores them, and serves analytics to dashboards. The unified backend and the Substack-specific backend are distinct implementations in the tree. The README documents capabilities such as heatmaps, funnels, geographic views, and live updates; some corresponding route details are not present in the excerpts, so those links are documented rather than inferred from unsampled code.

Main entry points: [`main.py`](https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py) (Unified API), [`static/dashboard.js`](https://github.com/ishekaa12/analytics-dashboard/blob/main/static/dashboard.js) (Analytics visualizations), [`frontend/dashboard/substack/main.py`](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/main.py) (Substack API), [`tracker.js`](https://github.com/ishekaa12/analytics-dashboard/blob/main/tracker.js) (Site tracker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection and privacy"]
  node_unified_tracker["Site tracker<br/>[tracker.js]"]
  node_substack_tracker["Substack tracker<br/>[tracker.js]"]
end

subgraph group_backend["Analytics backends"]
  node_unified_api["Unified API<br/>[main.py]"]
  node_bot_filter["Bot filtering<br/>[main.py]"]
  node_geo_lookup["Geo lookup<br/>[main.py]"]
  node_substack_api["Substack API<br/>[main.py]"]
end

subgraph group_storage["Event data"]
  node_substack_store[("Substack data layer<br/>[database.py]")]
  node_unified_store[("Unified event store<br/>[main.py]")]
  node_seed_data["Demo event seeder<br/>[seed_data.py]"]
end

subgraph group_dashboards["Dashboard experience"]
  node_dashboard_hub["Dashboard hub<br/>[index.html]"]
  node_site_dashboards["Site dashboards<br/>[dashboard.html]"]
  node_substack_dashboard["Substack dashboard<br/>[dashboard.html]"]
  node_dashboard_client["Analytics visualizations<br/>[dashboard.js]"]
end

node_site_visitor(("Site visitor"))
node_geo_service["IP geolocation"]

node_site_visitor -->|"visits site"| node_unified_tracker
node_unified_tracker -->|"sends events"| node_unified_api
node_site_visitor -.->|"visits site"| node_substack_tracker
node_substack_tracker -->|"posts events"| node_substack_api
node_unified_api -->|"filters events"| node_bot_filter
node_unified_api -->|"enriches events"| node_geo_lookup
node_geo_lookup -.->|"queries location"| node_geo_service
node_unified_api -->|"writes events"| node_unified_store
node_unified_api -.->|"serves analytics"| node_dashboard_client
node_substack_api -->|"reads and writes"| node_substack_store
node_seed_data -->|"seeds events"| node_substack_store
node_dashboard_hub -.->|"links sites"| node_site_dashboards
node_dashboard_client -->|"fetches metrics"| node_unified_api
node_dashboard_client -.->|"subscribes live"| node_unified_api
node_site_dashboards -.->|"loads visuals"| node_dashboard_client
node_substack_dashboard -.->|"requests analytics"| node_substack_api

click node_unified_tracker "https://github.com/ishekaa12/analytics-dashboard/blob/main/tracker.js"
click node_substack_tracker "https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/tracker.js"
click node_unified_api "https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py"
click node_bot_filter "https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py"
click node_geo_lookup "https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py"
click node_substack_api "https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/main.py"
click node_substack_store "https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/database.py"
click node_unified_store "https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py"
click node_seed_data "https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/seed_data.py"
click node_dashboard_hub "https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/index.html"
click node_site_dashboards "https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/luma/dashboard.html"
click node_substack_dashboard "https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/dashboard.html"
click node_dashboard_client "https://github.com/ishekaa12/analytics-dashboard/blob/main/static/dashboard.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_unified_tracker,node_substack_tracker toneBlue
class node_unified_api,node_bot_filter,node_geo_lookup,node_substack_api toneAmber
class node_substack_store,node_unified_store,node_seed_data toneMint
class node_dashboard_hub,node_site_dashboards,node_substack_dashboard,node_dashboard_client toneRose
class node_site_visitor,node_geo_service toneIndigo
```

## Components

### Collection and privacy

- [Site tracker](https://github.com/ishekaa12/analytics-dashboard/blob/main/tracker.js): `tracker.js`
- [Substack tracker](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/tracker.js): `frontend/dashboard/substack/tracker.js`

### Analytics backends

- [Unified API](https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py): `main.py`
- [Bot filtering](https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py): `main.py`
- [Geo lookup](https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py): `main.py`
- [Substack API](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/main.py): `frontend/dashboard/substack/main.py`

### Event data

- [Substack data layer](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/database.py): `frontend/dashboard/substack/database.py`
- [Unified event store](https://github.com/ishekaa12/analytics-dashboard/blob/main/main.py): `main.py`
- [Demo event seeder](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/seed_data.py): `frontend/dashboard/substack/seed_data.py`

### Dashboard experience

- [Dashboard hub](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/index.html): `frontend/index.html`
- [Site dashboards](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/luma/dashboard.html): `frontend/dashboard/luma/dashboard.html`
- [Substack dashboard](https://github.com/ishekaa12/analytics-dashboard/blob/main/frontend/dashboard/substack/dashboard.html): `frontend/dashboard/substack/dashboard.html`
- [Analytics visualizations](https://github.com/ishekaa12/analytics-dashboard/blob/main/static/dashboard.js): `static/dashboard.js`

### Other components

- **Site visitor**
- **IP geolocation**

## Connections

- Site visitor → Site tracker: visits site (evidence: `README.md`)
- Site tracker → Unified API: sends events (evidence: `README.md`)
- Site visitor → Substack tracker: visits site
- Substack tracker → Substack API: posts events (evidence: `frontend/dashboard/substack/tracker.js`)
- Unified API → Bot filtering: filters events (evidence: `main.py`)
- Unified API → Geo lookup: enriches events (evidence: `main.py`)
- Geo lookup → IP geolocation: queries location
- Unified API → Unified event store: writes events (evidence: `main.py`)
- Unified API → Analytics visualizations: serves analytics (evidence: `README.md`)
- Substack API → Substack data layer: reads and writes (evidence: `frontend/dashboard/substack/main.py`)
- Demo event seeder → Substack data layer: seeds events (evidence: `frontend/dashboard/substack/seed_data.py`)
- Dashboard hub → Site dashboards: links sites (evidence: `README.md`)
- Analytics visualizations → Unified API: fetches metrics (evidence: `static/dashboard.js`)
- Analytics visualizations → Unified API: subscribes live (evidence: `README.md`)
- Site dashboards → Analytics visualizations: loads visuals (evidence: `README.md`)
- Substack dashboard → Substack API: requests analytics
