# hello2ashu/stats-proxy architecture

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

- Interactive diagram: https://gitdiagram.com/hello2ashu/stats-proxy
- Repository: https://github.com/hello2ashu/stats-proxy

## Overview

This repository is a small HTTP stats service for Homepage, plus a GitHub-to-Homepage repository synchronizer and a festival-calendar provider. The main workflow is an HTTP request to the server, which selects an enabled provider, retrieves upstream data and returns it; the server also caches provider results. GitHub synchronization has a separate scheduled/webhook-triggered workflow that updates Homepage configuration. Provider implementations are shown unevenly, so only documented or excerpt-supported integrations and relationships are drawn.

Main entry points: [`app/server.py`](https://github.com/hello2ashu/stats-proxy/blob/main/app/server.py) (Stats API and cache), [`app/providers/github_sync.py`](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/github_sync.py) (GitHub sync provider), [`app/providers/festivals.py`](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/festivals.py) (Festival calendar), [`app/providers/bookorbit.py`](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/bookorbit.py) (BookOrbit stats)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP service"]
  node_server["Stats API and cache<br/>[server.py]"]
end

subgraph group_stats["Stats providers"]
  node_bookorbit["BookOrbit stats<br/>[bookorbit.py]"]
  node_paperless["Paperless stats<br/>[paperless.py]"]
  node_dockhand["Dockhand stats<br/>[dockhand.py]"]
  node_synology["Synology stats<br/>[synology.py]"]
  node_karakeep["Karakeep stats<br/>[karakeep.py]"]
  node_dawarich["Dawarich stats<br/>[dawarich.py]"]
  node_airtrail["AirTrail stats<br/>[airtrail.py]"]
  node_trek["Trek stats<br/>[trek.py]"]
  node_plex["Plex stats<br/>[plex.py]"]
  node_linkwarden["Linkwarden stats<br/>[linkwarden.py]"]
  node_trilium["Trilium stats<br/>[trilium.py]"]
end

subgraph group_sync["Repository sync"]
  node_github["GitHub sync provider<br/>[github_sync.py]"]
  node_syncscript["Homepage repo updater"]
end

subgraph group_calendar["Festival calendar"]
  node_festivals["Festival calendar<br/>[festivals.py]"]
end

node_homepage(("Homepage dashboard"))
node_drik["Drikpanchang calendar"]
node_panchang["Panchang API"]
node_paperless_service["Paperless-ngx"]
node_bookorbit_service["BookOrbit service"]
node_dockhand_service["Dockhand service"]
node_synology_service["Synology DSM"]
node_plex_service["Plex service"]
node_linkwarden_service["Linkwarden service"]
node_karakeep_service["Karakeep service"]
node_github_service["GitHub"]
node_homepage_config["Homepage config"]

node_homepage -->|"requests stats"| node_server
node_server -->|"returns JSON"| node_homepage
node_server -->|"fetches stats"| node_bookorbit
node_server -->|"fetches stats"| node_paperless
node_server -->|"fetches stats"| node_dockhand
node_server -->|"fetches stats"| node_synology
node_server -->|"fetches stats"| node_karakeep
node_server -->|"fetches stats"| node_dawarich
node_server -->|"fetches stats"| node_airtrail
node_server -->|"fetches stats"| node_trek
node_server -->|"fetches stats"| node_plex
node_server -->|"fetches stats"| node_linkwarden
node_server -->|"fetches stats"| node_trilium
node_server -->|"routes requests"| node_github
node_server -->|"routes requests"| node_festivals
node_bookorbit -->|"requests data"| node_bookorbit_service
node_paperless -->|"requests data"| node_paperless_service
node_dockhand -->|"requests data"| node_dockhand_service
node_synology -->|"requests data"| node_synology_service
node_plex -->|"requests data"| node_plex_service
node_linkwarden -->|"requests data"| node_linkwarden_service
node_karakeep -->|"requests data"| node_karakeep_service
node_trilium -.->|"reads config"| node_homepage_config
node_github -->|"runs script"| node_syncscript
node_github -->|"receives webhooks"| node_github_service
node_syncscript -->|"updates config"| node_homepage_config
node_festivals -->|"scrapes festivals"| node_drik
node_festivals -->|"requests fallback data"| node_panchang

click node_server "https://github.com/hello2ashu/stats-proxy/blob/main/app/server.py"
click node_bookorbit "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/bookorbit.py"
click node_paperless "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/paperless.py"
click node_dockhand "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/dockhand.py"
click node_synology "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/synology.py"
click node_karakeep "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/karakeep.py"
click node_dawarich "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/dawarich.py"
click node_airtrail "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/airtrail.py"
click node_trek "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/trek.py"
click node_plex "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/plex.py"
click node_linkwarden "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/linkwarden.py"
click node_trilium "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/trilium.py"
click node_github "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/github_sync.py"
click node_syncscript "https://github.com/hello2ashu/stats-proxy/blob/main/app/scripts/github_repos_to_homepage.py"
click node_festivals "https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/festivals.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_server toneBlue
class node_bookorbit,node_paperless,node_dockhand,node_synology,node_karakeep,node_dawarich,node_airtrail,node_trek,node_plex,node_linkwarden,node_trilium toneAmber
class node_github,node_syncscript,node_panchang toneMint
class node_festivals toneRose
class node_homepage,node_drik,node_paperless_service,node_bookorbit_service,node_dockhand_service,node_synology_service,node_plex_service,node_linkwarden_service,node_karakeep_service,node_github_service,node_homepage_config toneIndigo
```

## Components

### HTTP service

- [Stats API and cache](https://github.com/hello2ashu/stats-proxy/blob/main/app/server.py): `app/server.py`

### Stats providers

- [BookOrbit stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/bookorbit.py): `app/providers/bookorbit.py`
- [Paperless stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/paperless.py): `app/providers/paperless.py`
- [Dockhand stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/dockhand.py): `app/providers/dockhand.py`
- [Synology stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/synology.py): `app/providers/synology.py`
- [Karakeep stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/karakeep.py): `app/providers/karakeep.py`
- [Dawarich stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/dawarich.py): `app/providers/dawarich.py`
- [AirTrail stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/airtrail.py): `app/providers/airtrail.py`
- [Trek stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/trek.py): `app/providers/trek.py`
- [Plex stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/plex.py): `app/providers/plex.py`
- [Linkwarden stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/linkwarden.py): `app/providers/linkwarden.py`
- [Trilium stats](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/trilium.py): `app/providers/trilium.py`

### Repository sync

- [GitHub sync provider](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/github_sync.py): `app/providers/github_sync.py`
- [Homepage repo updater](https://github.com/hello2ashu/stats-proxy/blob/main/app/scripts/github_repos_to_homepage.py): `app/scripts/github_repos_to_homepage.py`

### Festival calendar

- [Festival calendar](https://github.com/hello2ashu/stats-proxy/blob/main/app/providers/festivals.py): `app/providers/festivals.py`

### Other components

- **Homepage dashboard**
- **Drikpanchang calendar**
- **Panchang API**
- **Paperless-ngx**
- **BookOrbit service**
- **Dockhand service**
- **Synology DSM**
- **Plex service**
- **Linkwarden service**
- **Karakeep service**
- **GitHub**
- **Homepage config**

## Connections

- Homepage dashboard → Stats API and cache: requests stats (evidence: `app/server.py`)
- Stats API and cache → Homepage dashboard: returns JSON (evidence: `app/server.py`)
- Stats API and cache → BookOrbit stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Paperless stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Dockhand stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Synology stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Karakeep stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Dawarich stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → AirTrail stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Trek stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Plex stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Linkwarden stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → Trilium stats: fetches stats (evidence: `app/server.py`)
- Stats API and cache → GitHub sync provider: routes requests (evidence: `app/server.py`)
- Stats API and cache → Festival calendar: routes requests (evidence: `app/server.py`)
- BookOrbit stats → BookOrbit service: requests data (evidence: `app/providers/bookorbit.py`)
- Paperless stats → Paperless-ngx: requests data (evidence: `app/providers/paperless.py`)
- Dockhand stats → Dockhand service: requests data (evidence: `app/providers/dockhand.py`)
- Synology stats → Synology DSM: requests data (evidence: `app/providers/synology.py`)
- Plex stats → Plex service: requests data (evidence: `app/providers/plex.py`)
- Linkwarden stats → Linkwarden service: requests data (evidence: `app/providers/linkwarden.py`)
- Karakeep stats → Karakeep service: requests data (evidence: `app/providers/karakeep.py`)
- Trilium stats → Homepage config: reads config
- GitHub sync provider → Homepage repo updater: runs script (evidence: `app/providers/github_sync.py`)
- GitHub sync provider → GitHub: receives webhooks (evidence: `app/providers/github_sync.py`)
- Homepage repo updater → Homepage config: updates config
- Festival calendar → Drikpanchang calendar: scrapes festivals (evidence: `app/providers/festivals.py`)
- Festival calendar → Panchang API: requests fallback data (evidence: `app/providers/festivals.py`)
