# engineer12-garko/quranshare architecture

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

- Interactive diagram: https://gitdiagram.com/engineer12-garko/quranshare
- Repository: https://github.com/engineer12-garko/quranshare

## Overview

QuranFlow is a Quranic reminder-video library with a browser client and FastAPI backend. The main user journey is to browse or receive recommendations for catalog videos, stream one, share it, and optionally confirm it was posted; authenticated activity supports personalized recommendations. Curators synchronize the catalog from Google Drive. Separate reader and Du'a routes provide Quran and supplication content through external providers, with Quran Foundation compatibility and verse-of-day capabilities retained. Edges reflect shown route registration, indexed references, or README documentation; unsampled subsystem internals are not inferred.

Main entry points: [`app/main.py`](https://github.com/engineer12-garko/quranshare/blob/main/app/main.py) (FastAPI application), [`app/routes/videos.py`](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/videos.py) (Video endpoints), [`app/services/videos.py`](https://github.com/engineer12-garko/quranshare/blob/main/app/services/videos.py) (Catalog and streaming), [`app/services/history.py`](https://github.com/engineer12-garko/quranshare/blob/main/app/services/history.py) (Posting history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_browser["QuranFlow client<br/>[app.js]"]
end

subgraph group_api["API and identity"]
  node_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Auth routes<br/>[auth.py]"]
  node_auth_service["Auth service<br/>[auth.py]"]
  node_auth_dependency["Session authorization<br/>[auth.py]"]
  node_user_model["User records<br/>[user.py]"]
  node_admin_routes["Admin operations<br/>[admin.py]"]
end

subgraph group_catalog["Video catalog"]
  node_video_routes["Video endpoints<br/>[videos.py]"]
  node_video_service["Catalog and streaming<br/>[videos.py]"]
  node_video_model["Video records<br/>[video.py]"]
  node_category_routes["Category endpoints<br/>[categories.py]"]
  node_category_model["Category records<br/>[category.py]"]
  node_sync_service["Drive catalog sync<br/>[sync.py]"]
  node_drive_service["Drive file access<br/>[google_drive.py]"]
end

subgraph group_activity["User activity"]
  node_history_routes["Share and history<br/>[history.py]"]
  node_history_service["Posting history<br/>[history.py]"]
  node_history_model["Posting records<br/>[posting_history.py]"]
  node_reminder_routes["Reminder endpoints<br/>[reminder.py]"]
  node_reminder_service["Recommendations<br/>[reminder.py]"]
  node_progress_routes["Progress endpoints<br/>[progress.py]"]
  node_progress_service["Reading progress<br/>[progress.py]"]
end

subgraph group_content["Quran and Du'a"]
  node_content_routes["Quran reader routes<br/>[content.py]"]
  node_alquran_service["AlQuran Cloud client<br/>[alquran_cloud.py]"]
  node_qf_service["Quran Foundation client"]
  node_dua_routes["Du'a endpoints<br/>[duas.py]"]
  node_opendua_service["OpenDua client<br/>[opendua.py]"]
end

node_visitor(("Visitor / user"))
node_google_drive["Google Drive"]
node_quran_providers["Quran content APIs"]
node_opendua["OpenDua API"]
node_database[("SQL database<br/>[database.py]")]

node_visitor -->|"uses"| node_browser
node_browser -->|"requests API"| node_app
node_app -->|"registers"| node_auth_routes
node_app -->|"registers"| node_video_routes
node_app -->|"registers"| node_category_routes
node_app -->|"registers"| node_content_routes
node_app -->|"registers"| node_dua_routes
node_app -->|"registers"| node_history_routes
node_app -->|"registers"| node_reminder_routes
node_app -->|"registers"| node_progress_routes
node_app -->|"registers"| node_admin_routes
node_auth_routes -->|"calls"| node_auth_service
node_auth_service -->|"creates and checks"| node_user_model
node_auth_dependency -->|"loads session user"| node_user_model
node_auth_routes -->|"requires current user"| node_auth_dependency
node_admin_routes -->|"requires roles"| node_auth_dependency
node_admin_routes -->|"runs sync"| node_sync_service
node_sync_service -->|"lists Drive files"| node_drive_service
node_drive_service -->|"lists and streams"| node_google_drive
node_video_routes -->|"calls"| node_video_service
node_video_service -->|"queries catalog"| node_video_model
node_video_service -->|"streams file"| node_drive_service
node_category_routes -->|"queries categories"| node_category_model
node_video_routes -->|"records share or post"| node_history_service
node_history_routes -->|"calls"| node_history_service
node_history_service -->|"records activity"| node_history_model
node_video_routes -->|"requests recommendations"| node_reminder_service
node_reminder_routes -->|"calls"| node_reminder_service
node_reminder_service -->|"reads recent posts"| node_history_model
node_progress_routes -->|"calls"| node_progress_service
node_content_routes -->|"calls"| node_alquran_service
node_content_routes -->|"calls"| node_qf_service
node_alquran_service -->|"fetches Quran data"| node_quran_providers
node_qf_service -->|"fetches compatibility content"| node_quran_providers
node_dua_routes -->|"calls"| node_opendua_service
node_opendua_service -->|"fetches Du'a data"| node_opendua
node_auth_service -.->|"reads and writes"| node_database
node_video_service -.->|"reads catalog"| node_database
node_history_service -.->|"stores activity"| node_database
node_sync_service -.->|"updates catalog"| node_database

click node_browser "https://github.com/engineer12-garko/quranshare/blob/main/app/static/js/app.js"
click node_app "https://github.com/engineer12-garko/quranshare/blob/main/app/main.py"
click node_auth_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/auth.py"
click node_auth_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/auth.py"
click node_auth_dependency "https://github.com/engineer12-garko/quranshare/blob/main/app/dependencies/auth.py"
click node_user_model "https://github.com/engineer12-garko/quranshare/blob/main/app/models/user.py"
click node_admin_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/admin.py"
click node_video_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/videos.py"
click node_video_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/videos.py"
click node_video_model "https://github.com/engineer12-garko/quranshare/blob/main/app/models/video.py"
click node_category_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/categories.py"
click node_category_model "https://github.com/engineer12-garko/quranshare/blob/main/app/models/category.py"
click node_sync_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/sync.py"
click node_drive_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/google_drive.py"
click node_history_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/history.py"
click node_history_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/history.py"
click node_history_model "https://github.com/engineer12-garko/quranshare/blob/main/app/models/posting_history.py"
click node_reminder_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/reminder.py"
click node_reminder_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/reminder.py"
click node_progress_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/progress.py"
click node_progress_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/progress.py"
click node_content_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/content.py"
click node_alquran_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/alquran_cloud.py"
click node_qf_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/quran_foundation.py"
click node_dua_routes "https://github.com/engineer12-garko/quranshare/blob/main/app/routes/duas.py"
click node_opendua_service "https://github.com/engineer12-garko/quranshare/blob/main/app/services/opendua.py"
click node_database "https://github.com/engineer12-garko/quranshare/blob/main/app/database.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_browser,node_visitor toneBlue
class node_app,node_auth_routes,node_auth_service,node_auth_dependency,node_user_model,node_admin_routes,node_database toneAmber
class node_video_routes,node_video_service,node_video_model,node_category_routes,node_category_model,node_sync_service,node_drive_service,node_quran_providers,node_opendua toneMint
class node_history_routes,node_history_service,node_history_model,node_reminder_routes,node_reminder_service,node_progress_routes,node_progress_service toneRose
class node_content_routes,node_alquran_service,node_qf_service,node_dua_routes,node_opendua_service,node_google_drive toneIndigo
```

## Components

### Browser experience

- [QuranFlow client](https://github.com/engineer12-garko/quranshare/blob/main/app/static/js/app.js): `app/static/js/app.js`

### API and identity

- [FastAPI application](https://github.com/engineer12-garko/quranshare/blob/main/app/main.py): `app/main.py`
- [Auth routes](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/auth.py): `app/routes/auth.py`
- [Auth service](https://github.com/engineer12-garko/quranshare/blob/main/app/services/auth.py): `app/services/auth.py`
- [Session authorization](https://github.com/engineer12-garko/quranshare/blob/main/app/dependencies/auth.py): `app/dependencies/auth.py`
- [User records](https://github.com/engineer12-garko/quranshare/blob/main/app/models/user.py): `app/models/user.py`
- [Admin operations](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/admin.py): `app/routes/admin.py`

### Video catalog

- [Video endpoints](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/videos.py): `app/routes/videos.py`
- [Catalog and streaming](https://github.com/engineer12-garko/quranshare/blob/main/app/services/videos.py): `app/services/videos.py`
- [Video records](https://github.com/engineer12-garko/quranshare/blob/main/app/models/video.py): `app/models/video.py`
- [Category endpoints](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/categories.py): `app/routes/categories.py`
- [Category records](https://github.com/engineer12-garko/quranshare/blob/main/app/models/category.py): `app/models/category.py`
- [Drive catalog sync](https://github.com/engineer12-garko/quranshare/blob/main/app/services/sync.py): `app/services/sync.py`
- [Drive file access](https://github.com/engineer12-garko/quranshare/blob/main/app/services/google_drive.py): `app/services/google_drive.py`

### User activity

- [Share and history](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/history.py): `app/routes/history.py`
- [Posting history](https://github.com/engineer12-garko/quranshare/blob/main/app/services/history.py): `app/services/history.py`
- [Posting records](https://github.com/engineer12-garko/quranshare/blob/main/app/models/posting_history.py): `app/models/posting_history.py`
- [Reminder endpoints](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/reminder.py): `app/routes/reminder.py`
- [Recommendations](https://github.com/engineer12-garko/quranshare/blob/main/app/services/reminder.py): `app/services/reminder.py`
- [Progress endpoints](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/progress.py): `app/routes/progress.py`
- [Reading progress](https://github.com/engineer12-garko/quranshare/blob/main/app/services/progress.py): `app/services/progress.py`

### Quran and Du'a

- [Quran reader routes](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/content.py): `app/routes/content.py`
- [AlQuran Cloud client](https://github.com/engineer12-garko/quranshare/blob/main/app/services/alquran_cloud.py): `app/services/alquran_cloud.py`
- [Quran Foundation client](https://github.com/engineer12-garko/quranshare/blob/main/app/services/quran_foundation.py): `app/services/quran_foundation.py`
- [Du'a endpoints](https://github.com/engineer12-garko/quranshare/blob/main/app/routes/duas.py): `app/routes/duas.py`
- [OpenDua client](https://github.com/engineer12-garko/quranshare/blob/main/app/services/opendua.py): `app/services/opendua.py`

### Other components

- **Visitor / user**
- **Google Drive**
- **Quran content APIs**
- **OpenDua API**
- [SQL database](https://github.com/engineer12-garko/quranshare/blob/main/app/database.py): `app/database.py`

## Connections

- Visitor / user → QuranFlow client: uses
- QuranFlow client → FastAPI application: requests API
- FastAPI application → Auth routes: registers (evidence: `app/main.py`)
- FastAPI application → Video endpoints: registers (evidence: `app/main.py`)
- FastAPI application → Category endpoints: registers (evidence: `app/main.py`)
- FastAPI application → Quran reader routes: registers (evidence: `app/main.py`)
- FastAPI application → Du'a endpoints: registers (evidence: `app/main.py`)
- FastAPI application → Share and history: registers (evidence: `app/main.py`)
- FastAPI application → Reminder endpoints: registers (evidence: `app/main.py`)
- FastAPI application → Progress endpoints: registers (evidence: `app/main.py`)
- FastAPI application → Admin operations: registers (evidence: `app/main.py`)
- Auth routes → Auth service: calls (evidence: `app/routes/auth.py`)
- Auth service → User records: creates and checks (evidence: `app/services/auth.py`)
- Session authorization → User records: loads session user (evidence: `app/dependencies/auth.py`)
- Auth routes → Session authorization: requires current user (evidence: `app/routes/auth.py`)
- Admin operations → Session authorization: requires roles (evidence: `app/routes/admin.py`)
- Admin operations → Drive catalog sync: runs sync (evidence: `app/routes/admin.py`)
- Drive catalog sync → Drive file access: lists Drive files (evidence: `app/services/sync.py`)
- Drive file access → Google Drive: lists and streams (evidence: `app/services/google_drive.py`)
- Video endpoints → Catalog and streaming: calls (evidence: `app/routes/videos.py`)
- Catalog and streaming → Video records: queries catalog (evidence: `app/services/videos.py`)
- Catalog and streaming → Drive file access: streams file (evidence: `app/services/videos.py`)
- Category endpoints → Category records: queries categories (evidence: `app/routes/categories.py`)
- Video endpoints → Posting history: records share or post (evidence: `app/routes/videos.py`)
- Share and history → Posting history: calls (evidence: `app/routes/history.py`)
- Posting history → Posting records: records activity (evidence: `app/services/history.py`)
- Video endpoints → Recommendations: requests recommendations (evidence: `app/routes/videos.py`)
- Reminder endpoints → Recommendations: calls (evidence: `app/routes/reminder.py`)
- Recommendations → Posting records: reads recent posts (evidence: `app/services/reminder.py`)
- Progress endpoints → Reading progress: calls (evidence: `app/routes/progress.py`)
- Quran reader routes → AlQuran Cloud client: calls (evidence: `app/routes/content.py`)
- Quran reader routes → Quran Foundation client: calls (evidence: `app/routes/content.py`)
- AlQuran Cloud client → Quran content APIs: fetches Quran data
- Quran Foundation client → Quran content APIs: fetches compatibility content
- Du'a endpoints → OpenDua client: calls (evidence: `app/routes/duas.py`)
- OpenDua client → OpenDua API: fetches Du'a data
- Auth service → SQL database: reads and writes
- Catalog and streaming → SQL database: reads catalog
- Posting history → SQL database: stores activity
- Drive catalog sync → SQL database: updates catalog
