# inaz-in/home-work-system architecture

> Architecture diagram of the GitHub repository inaz-in/home-work-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inaz-in/home-work-system
- Repository: https://github.com/inaz-in/home-work-system

## Overview

Homework is a group schedule and homework tracker: users sign in, browse schedule occurrences, share homework comments/files while keeping completion personal, and can also manage plans and group information. The backend serves these features from PostgreSQL and synchronizes schedules with BMSTU’s public API. The README documents the major capabilities; route-level wiring beyond the supplied excerpts is represented only where the route tree or documentation supports it.

Main entry points: [`frontend/src/api/client.ts`](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/api/client.ts) (API client), [`backend/src/db/pool.ts`](https://github.com/inaz-in/home-work-system/blob/main/backend/src/db/pool.ts) (Database pool), [`frontend/src/App.tsx`](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/App.tsx) (App navigation), [`backend/src/routes/schedule.ts`](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/schedule.ts) (Schedule API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App navigation<br/>[App.tsx]"]
  node_authform["Sign-in form<br/>[AuthForm.tsx]"]
  node_usercontext["User session<br/>[UserContext.tsx]"]
  node_schedulepage["Schedule views<br/>[SchedulePage.tsx]"]
  node_subjects["Subject view<br/>[SubjectsPage.tsx]"]
  node_birthdays["Birthdays view<br/>[BirthdaysPage.tsx]"]
  node_plans["Personal plans<br/>[PlansPage.tsx]"]
  node_adminui["Admin console<br/>[AdminPage.tsx]"]
  node_settings["User settings<br/>[SettingsPage.tsx]"]
  node_clientapi["API client<br/>[client.ts]"]
end

subgraph group_api["Application API"]
  node_authroute["Authentication<br/>[auth.ts]"]
  node_schedroute["Schedule API<br/>[schedule.ts]"]
  node_homeworkroute["Homework API<br/>[homework.ts]"]
  node_overviewroute["Calendar overview<br/>[overview.ts]"]
  node_plansroute["Plans API<br/>[plans.ts]"]
  node_birthdaysroute["Birthdays API<br/>[birthdays.ts]"]
  node_usersroute["User management<br/>[users.ts]"]
  node_adminroute["Admin operations<br/>[admin.ts]"]
  node_semestersroute["Semester settings<br/>[semesters.ts]"]
end

subgraph group_schedule["Schedule integration"]
  node_resolver["Occurrence resolver"]
  node_subgroup["Subgroup filtering<br/>[subgroup.ts]"]
  node_sync["Schedule sync<br/>[bmstuSync.ts]"]
end

subgraph group_data["Persistent data"]
  node_pg[("PostgreSQL")]
  node_pool["Database pool<br/>[pool.ts]"]
end

node_student(("Group member"))
node_admin(("Administrator"))
node_bmstu{{"BMSTU schedule API"}}

node_student -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"shows"| node_authform
node_app -->|"selects"| node_schedulepage
node_app -->|"selects"| node_subjects
node_app -->|"selects"| node_birthdays
node_app -->|"selects"| node_plans
node_app -->|"selects"| node_adminui
node_app -->|"selects"| node_settings
node_authform -->|"submits credentials"| node_clientapi
node_usercontext -->|"validates session"| node_clientapi
node_schedulepage -->|"loads schedule"| node_clientapi
node_subjects -->|"loads subjects"| node_clientapi
node_birthdays -->|"loads birthdays"| node_clientapi
node_plans -->|"manages plans"| node_clientapi
node_adminui -->|"manages group"| node_clientapi
node_settings -->|"updates profile"| node_clientapi
node_clientapi -->|"HTTP requests"| node_authroute
node_clientapi -->|"HTTP requests"| node_schedroute
node_clientapi -->|"HTTP requests"| node_homeworkroute
node_clientapi -->|"HTTP requests"| node_overviewroute
node_clientapi -->|"HTTP requests"| node_plansroute
node_clientapi -->|"HTTP requests"| node_birthdaysroute
node_clientapi -->|"HTTP requests"| node_usersroute
node_clientapi -->|"HTTP requests"| node_adminroute
node_clientapi -->|"HTTP requests"| node_semestersroute
node_schedroute -->|"resolves occurrences"| node_resolver
node_homeworkroute -->|"resolves occurrences"| node_resolver
node_resolver -->|"filters by subgroup"| node_subgroup
node_sync -->|"fetches schedule"| node_bmstu
node_sync -->|"updates schedule"| node_pool
node_authroute -->|"reads/writes users"| node_pool
node_schedroute -->|"reads schedule"| node_pool
node_homeworkroute -->|"stores homework"| node_pool
node_overviewroute -->|"loads overview"| node_pool
node_plansroute -->|"stores plans"| node_pool
node_birthdaysroute -->|"reads birthdays"| node_pool
node_usersroute -->|"manages users"| node_pool
node_adminroute -->|"manages settings"| node_pool
node_semestersroute -->|"reads/writes semesters"| node_pool
node_pool -->|"queries"| node_pg

click node_app "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/App.tsx"
click node_authform "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/components/AuthForm.tsx"
click node_usercontext "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/context/UserContext.tsx"
click node_schedulepage "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/SchedulePage.tsx"
click node_subjects "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/SubjectsPage.tsx"
click node_birthdays "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/BirthdaysPage.tsx"
click node_plans "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/PlansPage.tsx"
click node_adminui "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/AdminPage.tsx"
click node_settings "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_clientapi "https://github.com/inaz-in/home-work-system/blob/main/frontend/src/api/client.ts"
click node_authroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/auth.ts"
click node_schedroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/schedule.ts"
click node_homeworkroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/homework.ts"
click node_overviewroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/overview.ts"
click node_plansroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/plans.ts"
click node_birthdaysroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/birthdays.ts"
click node_usersroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/users.ts"
click node_adminroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/admin.ts"
click node_semestersroute "https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/semesters.ts"
click node_resolver "https://github.com/inaz-in/home-work-system/blob/main/backend/src/services/scheduleResolver.ts"
click node_subgroup "https://github.com/inaz-in/home-work-system/blob/main/backend/src/services/subgroup.ts"
click node_sync "https://github.com/inaz-in/home-work-system/blob/main/backend/src/services/bmstuSync.ts"
click node_pool "https://github.com/inaz-in/home-work-system/blob/main/backend/src/db/pool.ts"

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_app,node_authform,node_usercontext,node_schedulepage,node_subjects,node_birthdays,node_plans,node_adminui,node_settings,node_clientapi toneBlue
class node_authroute,node_schedroute,node_homeworkroute,node_overviewroute,node_plansroute,node_birthdaysroute,node_usersroute,node_adminroute,node_semestersroute toneAmber
class node_resolver,node_subgroup,node_sync,node_bmstu toneMint
class node_pg,node_pool toneRose
class node_student,node_admin toneIndigo
```

## Components

### Web client

- [App navigation](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in form](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/components/AuthForm.tsx): `frontend/src/components/AuthForm.tsx`
- [User session](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/context/UserContext.tsx): `frontend/src/context/UserContext.tsx`
- [Schedule views](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/SchedulePage.tsx): `frontend/src/pages/SchedulePage.tsx`
- [Subject view](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/SubjectsPage.tsx): `frontend/src/pages/SubjectsPage.tsx`
- [Birthdays view](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/BirthdaysPage.tsx): `frontend/src/pages/BirthdaysPage.tsx`
- [Personal plans](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/PlansPage.tsx): `frontend/src/pages/PlansPage.tsx`
- [Admin console](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/AdminPage.tsx): `frontend/src/pages/AdminPage.tsx`
- [User settings](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`
- [API client](https://github.com/inaz-in/home-work-system/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### Application API

- [Authentication](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [Schedule API](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/schedule.ts): `backend/src/routes/schedule.ts`
- [Homework API](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/homework.ts): `backend/src/routes/homework.ts`
- [Calendar overview](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/overview.ts): `backend/src/routes/overview.ts`
- [Plans API](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/plans.ts): `backend/src/routes/plans.ts`
- [Birthdays API](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/birthdays.ts): `backend/src/routes/birthdays.ts`
- [User management](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/users.ts): `backend/src/routes/users.ts`
- [Admin operations](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/admin.ts): `backend/src/routes/admin.ts`
- [Semester settings](https://github.com/inaz-in/home-work-system/blob/main/backend/src/routes/semesters.ts): `backend/src/routes/semesters.ts`

### Schedule integration

- [Occurrence resolver](https://github.com/inaz-in/home-work-system/blob/main/backend/src/services/scheduleResolver.ts): `backend/src/services/scheduleResolver.ts`
- [Subgroup filtering](https://github.com/inaz-in/home-work-system/blob/main/backend/src/services/subgroup.ts): `backend/src/services/subgroup.ts`
- [Schedule sync](https://github.com/inaz-in/home-work-system/blob/main/backend/src/services/bmstuSync.ts): `backend/src/services/bmstuSync.ts`

### Persistent data

- **PostgreSQL**
- [Database pool](https://github.com/inaz-in/home-work-system/blob/main/backend/src/db/pool.ts): `backend/src/db/pool.ts`

### Other components

- **Group member**
- **Administrator**
- **BMSTU schedule API**

## Connections

- Group member → App navigation: uses
- Administrator → App navigation: uses
- App navigation → Sign-in form: shows
- App navigation → Schedule views: selects
- App navigation → Subject view: selects
- App navigation → Birthdays view: selects
- App navigation → Personal plans: selects
- App navigation → Admin console: selects
- App navigation → User settings: selects
- Sign-in form → API client: submits credentials
- User session → API client: validates session
- Schedule views → API client: loads schedule
- Subject view → API client: loads subjects
- Birthdays view → API client: loads birthdays
- Personal plans → API client: manages plans
- Admin console → API client: manages group
- User settings → API client: updates profile
- API client → Authentication: HTTP requests
- API client → Schedule API: HTTP requests
- API client → Homework API: HTTP requests
- API client → Calendar overview: HTTP requests
- API client → Plans API: HTTP requests
- API client → Birthdays API: HTTP requests
- API client → User management: HTTP requests
- API client → Admin operations: HTTP requests
- API client → Semester settings: HTTP requests
- Schedule API → Occurrence resolver: resolves occurrences
- Homework API → Occurrence resolver: resolves occurrences
- Occurrence resolver → Subgroup filtering: filters by subgroup
- Schedule sync → BMSTU schedule API: fetches schedule
- Schedule sync → Database pool: updates schedule
- Authentication → Database pool: reads/writes users
- Schedule API → Database pool: reads schedule
- Homework API → Database pool: stores homework
- Calendar overview → Database pool: loads overview
- Plans API → Database pool: stores plans
- Birthdays API → Database pool: reads birthdays
- User management → Database pool: manages users
- Admin operations → Database pool: manages settings
- Semester settings → Database pool: reads/writes semesters
- Database pool → PostgreSQL: queries
