# shuvro86/shreehan_notion architecture

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

- Interactive diagram: https://gitdiagram.com/shuvro86/shreehan_notion
- Repository: https://github.com/shuvro86/shreehan_notion

## Overview

Shreehan HQ is a Class II learning workspace: students and teachers use a web app for dashboard tasks, study materials, practice, and coursework, while administrators manage accounts and access. The frontend is served by a FastAPI backend; SQLite stores account and classroom data, and a supervised background process refreshes the Notion-backed library and linked Drive files. The graph preserves the documented assistant and practice capabilities. Some UI-to-API details and the worker’s precise connection to importer modules are not shown in the excerpts, so those links are omitted or marked unverified.

Main entry points: [`backend/main.py`](https://github.com/shuvro86/shreehan_notion/blob/main/backend/main.py) (FastAPI app), [`frontend/app/page.tsx`](https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/page.tsx) (Learning app), [`server/notion-sync.mjs`](https://github.com/shuvro86/shreehan_notion/blob/main/server/notion-sync.mjs) (Notion library importer), [`backend/db.py`](https://github.com/shuvro86/shreehan_notion/blob/main/backend/db.py) (SQLite application data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Learning workspace"]
  node_frontend["Learning app<br/>[page.tsx]"]
  node_authui["Sign-in gate<br/>[auth-gate.tsx]"]
  node_libraryui["Document library<br/>[library.tsx]"]
  node_courseworkui["Coursework<br/>[coursework.tsx]"]
  node_kanbanui["Kanban board<br/>[page.tsx]"]
  node_assistantui["Study assistant<br/>[page.tsx]"]
end

subgraph group_api["Application backend"]
  node_apiapp["FastAPI app<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_contentapi["Content APIs<br/>[content.py]"]
  node_workspace["Workspace APIs<br/>[workspace.py]"]
  node_teacher["Teacher APIs<br/>[teacher.py]"]
  node_admin["Administration APIs<br/>[admin.py]"]
end

subgraph group_sync["Content synchronization"]
  node_worker["Sync supervisor<br/>[notion_worker.py]"]
  node_notionsync["Notion library importer<br/>[notion-sync.mjs]"]
  node_drivesync["Drive importer<br/>[drive-sync.mjs]"]
  node_studynotes["Study-note extraction<br/>[study-notes.mjs]"]
end

subgraph group_practice["Study tools"]
  node_practicegen["Subject practice generation"]
  node_unseen["Unseen-paper practice"]
end

subgraph group_state["Persistent state"]
  node_database[("SQLite application data<br/>[db.py]")]
end

node_learner(("Learner / teacher"))
node_notion["Notion"]
node_drive["Google Drive"]
node_openrouter["OpenRouter"]

node_learner -->|"uses"| node_frontend
node_frontend -->|"calls APIs"| node_apiapp
node_apiapp -->|"registers routes"| node_auth
node_apiapp -->|"registers routes"| node_contentapi
node_apiapp -->|"registers routes"| node_workspace
node_apiapp -->|"registers routes"| node_teacher
node_apiapp -->|"registers routes"| node_admin
node_apiapp -->|"starts supervisor"| node_worker
node_auth -->|"stores accounts"| node_database
node_workspace -->|"stores workspace"| node_database
node_teacher -->|"stores coursework"| node_database
node_admin -->|"reads and updates"| node_database
node_worker -.->|"launches importer"| node_notionsync
node_notionsync -->|"uses extraction"| node_studynotes
node_notionsync -->|"uses Drive sync"| node_drivesync
node_notion -->|"provides content"| node_notionsync
node_drive -->|"provides files"| node_drivesync
node_practicegen -->|"uses notes"| node_studynotes
node_practicegen -->|"uses generation"| node_unseen
node_frontend -->|"renders library"| node_libraryui
node_frontend -->|"renders coursework"| node_courseworkui
node_frontend -->|"gates access"| node_authui
node_libraryui -.->|"loads library"| node_contentapi
node_courseworkui -.->|"uses coursework APIs"| node_teacher
node_assistantui -.->|"requests study help"| node_openrouter
node_frontend -.->|"offers practice"| node_practicegen

click node_frontend "https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/page.tsx"
click node_authui "https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/_components/auth-gate.tsx"
click node_libraryui "https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/_components/library.tsx"
click node_courseworkui "https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/_components/coursework.tsx"
click node_kanbanui "https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/kanban/page.tsx"
click node_assistantui "https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/assistant/page.tsx"
click node_apiapp "https://github.com/shuvro86/shreehan_notion/blob/main/backend/main.py"
click node_auth "https://github.com/shuvro86/shreehan_notion/blob/main/backend/auth.py"
click node_contentapi "https://github.com/shuvro86/shreehan_notion/blob/main/backend/content.py"
click node_workspace "https://github.com/shuvro86/shreehan_notion/blob/main/backend/workspace.py"
click node_teacher "https://github.com/shuvro86/shreehan_notion/blob/main/backend/teacher.py"
click node_admin "https://github.com/shuvro86/shreehan_notion/blob/main/backend/admin.py"
click node_worker "https://github.com/shuvro86/shreehan_notion/blob/main/backend/notion_worker.py"
click node_notionsync "https://github.com/shuvro86/shreehan_notion/blob/main/server/notion-sync.mjs"
click node_drivesync "https://github.com/shuvro86/shreehan_notion/blob/main/server/drive-sync.mjs"
click node_studynotes "https://github.com/shuvro86/shreehan_notion/blob/main/server/study-notes.mjs"
click node_practicegen "https://github.com/shuvro86/shreehan_notion/blob/main/server/subject-practice.mjs"
click node_unseen "https://github.com/shuvro86/shreehan_notion/blob/main/server/unseen-practice.mjs"
click node_database "https://github.com/shuvro86/shreehan_notion/blob/main/backend/db.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_frontend,node_authui,node_libraryui,node_courseworkui,node_kanbanui,node_assistantui toneBlue
class node_apiapp,node_auth,node_contentapi,node_workspace,node_teacher,node_admin toneAmber
class node_worker,node_notionsync,node_drivesync,node_studynotes,node_openrouter toneMint
class node_practicegen,node_unseen toneRose
class node_database,node_learner,node_notion,node_drive toneIndigo
```

## Components

### Learning workspace

- [Learning app](https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Sign-in gate](https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/_components/auth-gate.tsx): `frontend/app/_components/auth-gate.tsx`
- [Document library](https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/_components/library.tsx): `frontend/app/_components/library.tsx`
- [Coursework](https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/_components/coursework.tsx): `frontend/app/_components/coursework.tsx`
- [Kanban board](https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/kanban/page.tsx): `frontend/app/kanban/page.tsx`
- [Study assistant](https://github.com/shuvro86/shreehan_notion/blob/main/frontend/app/assistant/page.tsx): `frontend/app/assistant/page.tsx`

### Application backend

- [FastAPI app](https://github.com/shuvro86/shreehan_notion/blob/main/backend/main.py): `backend/main.py`
- [Authentication](https://github.com/shuvro86/shreehan_notion/blob/main/backend/auth.py): `backend/auth.py`
- [Content APIs](https://github.com/shuvro86/shreehan_notion/blob/main/backend/content.py): `backend/content.py`
- [Workspace APIs](https://github.com/shuvro86/shreehan_notion/blob/main/backend/workspace.py): `backend/workspace.py`
- [Teacher APIs](https://github.com/shuvro86/shreehan_notion/blob/main/backend/teacher.py): `backend/teacher.py`
- [Administration APIs](https://github.com/shuvro86/shreehan_notion/blob/main/backend/admin.py): `backend/admin.py`

### Content synchronization

- [Sync supervisor](https://github.com/shuvro86/shreehan_notion/blob/main/backend/notion_worker.py): `backend/notion_worker.py`
- [Notion library importer](https://github.com/shuvro86/shreehan_notion/blob/main/server/notion-sync.mjs): `server/notion-sync.mjs`
- [Drive importer](https://github.com/shuvro86/shreehan_notion/blob/main/server/drive-sync.mjs): `server/drive-sync.mjs`
- [Study-note extraction](https://github.com/shuvro86/shreehan_notion/blob/main/server/study-notes.mjs): `server/study-notes.mjs`

### Study tools

- [Subject practice generation](https://github.com/shuvro86/shreehan_notion/blob/main/server/subject-practice.mjs): `server/subject-practice.mjs`
- [Unseen-paper practice](https://github.com/shuvro86/shreehan_notion/blob/main/server/unseen-practice.mjs): `server/unseen-practice.mjs`

### Persistent state

- [SQLite application data](https://github.com/shuvro86/shreehan_notion/blob/main/backend/db.py): `backend/db.py`

### Other components

- **Learner / teacher**
- **Notion**
- **Google Drive**
- **OpenRouter**

## Connections

- Learner / teacher → Learning app: uses (evidence: `README.md`)
- Learning app → FastAPI app: calls APIs (evidence: `README.md`)
- FastAPI app → Authentication: registers routes (evidence: `backend/main.py`)
- FastAPI app → Content APIs: registers routes (evidence: `backend/main.py`)
- FastAPI app → Workspace APIs: registers routes (evidence: `backend/main.py`)
- FastAPI app → Teacher APIs: registers routes (evidence: `backend/main.py`)
- FastAPI app → Administration APIs: registers routes (evidence: `backend/main.py`)
- FastAPI app → Sync supervisor: starts supervisor (evidence: `backend/main.py`)
- Authentication → SQLite application data: stores accounts (evidence: `backend/auth.py`)
- Workspace APIs → SQLite application data: stores workspace (evidence: `backend/workspace.py`)
- Teacher APIs → SQLite application data: stores coursework (evidence: `backend/teacher.py`)
- Administration APIs → SQLite application data: reads and updates (evidence: `backend/admin.py`)
- Sync supervisor → Notion library importer: launches importer
- Notion library importer → Study-note extraction: uses extraction (evidence: `server/notion-sync.mjs`)
- Notion library importer → Drive importer: uses Drive sync (evidence: `server/notion-sync.mjs`)
- Notion → Notion library importer: provides content (evidence: `README.md`)
- Google Drive → Drive importer: provides files (evidence: `README.md`)
- Subject practice generation → Study-note extraction: uses notes (evidence: `server/subject-practice.mjs`)
- Subject practice generation → Unseen-paper practice: uses generation (evidence: `server/subject-practice.mjs`)
- Learning app → Document library: renders library (evidence: `frontend/app/page.tsx`)
- Learning app → Coursework: renders coursework (evidence: `frontend/app/page.tsx`)
- Learning app → Sign-in gate: gates access (evidence: `frontend/app/page.tsx`)
- Document library → Content APIs: loads library
- Coursework → Teacher APIs: uses coursework APIs
- Study assistant → OpenRouter: requests study help
- Learning app → Subject practice generation: offers practice
