# samuelprakash18/teachman architecture

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

- Interactive diagram: https://gitdiagram.com/samuelprakash18/teachman
- Repository: https://github.com/samuelprakash18/teachman

## Overview

TeachMan is a tutor-and-parent management app. Tutors manage teaching, enrollment, billing, expenses, and cash planning; parents discover tutors, request enrollment, and track children’s classes, fees, attendance, and learning. The frontend routes role-specific pages and makes API requests to a FastAPI backend, whose routes use database sessions and domain services. The README documents additional capabilities such as notifications, account settings, and AI; several of those route implementations were not sampled, so their internal links are not inferred.

Main entry points: [`backend/app/main.py`](https://github.com/samuelprakash18/teachman/blob/main/backend/app/main.py) (API application), [`backend/app/services/enrollment_service.py`](https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/enrollment_service.py) (Approval invoicing), [`backend/app/api/routes/enrollments.py`](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/enrollments.py) (Enrollment workflow), [`backend/app/api/routes/payments.py`](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/payments.py) (Invoices and payments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_frontend_routes["Role-based pages<br/>[App.tsx]"]
  node_client_api["API client<br/>[api.ts]"]
end

subgraph group_teaching["Teaching management"]
  node_teaching_ui["Teaching pages<br/>[Enrollments.tsx]"]
  node_parent_ui["Parent pages<br/>[Fees.tsx]"]
  node_students_api["Students and classes<br/>[students.py]"]
  node_enrollment_api["Enrollment workflow<br/>[enrollments.py]"]
  node_enrollment_logic["Approval invoicing"]
  node_teaching_models["Teaching records<br/>[teaching.py]"]
  node_student_models["Student records<br/>[student.py]"]
end

subgraph group_finance["Billing and cash"]
  node_billing_ui["Tutor billing pages<br/>[Invoices.tsx]"]
  node_billing_api["Invoices and payments<br/>[payments.py]"]
  node_invoice_logic["Invoice numbering<br/>[invoice_service.py]"]
  node_finance_models["Financial records<br/>[finance.py]"]
  node_cash_planning["Forecast and expenses<br/>[forecast.py]"]
  node_forecast_logic["Cash forecast engine<br/>[forecast_engine.py]"]
end

subgraph group_platform["Backend platform"]
  node_backend_app["API application<br/>[main.py]"]
  node_auth_api["Authentication<br/>[auth.py]"]
  node_auth_deps["Access dependencies<br/>[deps.py]"]
  node_db_session["Database sessions<br/>[session.py]"]
  node_database[("PostgreSQL")]
end

subgraph group_insights["Learning and assistance"]
  node_learning_ai["Learning and AI<br/>[ai.py]"]
  node_ai_service["AI service<br/>[ai_service.py]"]
  node_notifications["Notifications<br/>[notifications.py]"]
end

node_tutors_parents(("Tutors and parents"))
node_nvidia["NVIDIA service"]

node_tutors_parents -->|"use pages"| node_frontend_routes
node_frontend_routes -->|"routes to"| node_teaching_ui
node_frontend_routes -->|"routes to"| node_parent_ui
node_teaching_ui -->|"requests data"| node_client_api
node_parent_ui -->|"requests data"| node_client_api
node_client_api -.->|"calls API"| node_backend_app
node_backend_app -->|"registers route"| node_auth_api
node_backend_app -->|"registers route"| node_students_api
node_backend_app -->|"registers route"| node_enrollment_api
node_backend_app -->|"registers route"| node_billing_api
node_backend_app -->|"registers route"| node_cash_planning
node_backend_app -->|"registers route"| node_learning_ai
node_backend_app -->|"registers route"| node_notifications
node_enrollment_api -->|"approves via"| node_enrollment_logic
node_enrollment_logic -->|"gets number"| node_invoice_logic
node_enrollment_api -->|"reads and writes"| node_teaching_models
node_enrollment_logic -->|"reads records"| node_teaching_models
node_enrollment_logic -->|"reads records"| node_student_models
node_enrollment_logic -->|"creates invoice"| node_finance_models
node_billing_api -->|"uses numbering"| node_invoice_logic
node_billing_api -->|"reads and writes"| node_finance_models
node_cash_planning -.->|"computes forecast"| node_forecast_logic
node_learning_ai -.->|"uses service"| node_ai_service
node_ai_service -->|"optionally calls"| node_nvidia
node_auth_api -->|"uses identity"| node_auth_deps
node_auth_deps -->|"gets session"| node_db_session
node_enrollment_api -->|"gets session"| node_db_session
node_billing_api -->|"gets session"| node_db_session
node_db_session -->|"opens connection"| node_database

click node_frontend_routes "https://github.com/samuelprakash18/teachman/blob/main/frontend/src/App.tsx"
click node_client_api "https://github.com/samuelprakash18/teachman/blob/main/frontend/src/lib/api.ts"
click node_teaching_ui "https://github.com/samuelprakash18/teachman/blob/main/frontend/src/pages/tutor/Enrollments.tsx"
click node_parent_ui "https://github.com/samuelprakash18/teachman/blob/main/frontend/src/pages/parent/Fees.tsx"
click node_students_api "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/students.py"
click node_enrollment_api "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/enrollments.py"
click node_enrollment_logic "https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/enrollment_service.py"
click node_teaching_models "https://github.com/samuelprakash18/teachman/blob/main/backend/app/models/teaching.py"
click node_student_models "https://github.com/samuelprakash18/teachman/blob/main/backend/app/models/student.py"
click node_billing_ui "https://github.com/samuelprakash18/teachman/blob/main/frontend/src/pages/tutor/Invoices.tsx"
click node_billing_api "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/payments.py"
click node_invoice_logic "https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/invoice_service.py"
click node_finance_models "https://github.com/samuelprakash18/teachman/blob/main/backend/app/models/finance.py"
click node_cash_planning "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/forecast.py"
click node_forecast_logic "https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/forecast_engine.py"
click node_backend_app "https://github.com/samuelprakash18/teachman/blob/main/backend/app/main.py"
click node_auth_api "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/auth.py"
click node_auth_deps "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/deps.py"
click node_db_session "https://github.com/samuelprakash18/teachman/blob/main/backend/app/db/session.py"
click node_learning_ai "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/ai.py"
click node_ai_service "https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/ai_service.py"
click node_notifications "https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/notifications.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_routes,node_client_api toneBlue
class node_teaching_ui,node_parent_ui,node_students_api,node_enrollment_api,node_enrollment_logic,node_teaching_models,node_student_models toneAmber
class node_billing_ui,node_billing_api,node_invoice_logic,node_finance_models,node_cash_planning,node_forecast_logic toneMint
class node_backend_app,node_auth_api,node_auth_deps,node_db_session,node_database toneRose
class node_learning_ai,node_ai_service,node_notifications,node_tutors_parents,node_nvidia toneIndigo
```

## Components

### Web client

- [Role-based pages](https://github.com/samuelprakash18/teachman/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/samuelprakash18/teachman/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Teaching management

- [Teaching pages](https://github.com/samuelprakash18/teachman/blob/main/frontend/src/pages/tutor/Enrollments.tsx): `frontend/src/pages/tutor/Enrollments.tsx`
- [Parent pages](https://github.com/samuelprakash18/teachman/blob/main/frontend/src/pages/parent/Fees.tsx): `frontend/src/pages/parent/Fees.tsx`
- [Students and classes](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/students.py): `backend/app/api/routes/students.py`
- [Enrollment workflow](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/enrollments.py): `backend/app/api/routes/enrollments.py`
- [Approval invoicing](https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/enrollment_service.py): `backend/app/services/enrollment_service.py`
- [Teaching records](https://github.com/samuelprakash18/teachman/blob/main/backend/app/models/teaching.py): `backend/app/models/teaching.py`
- [Student records](https://github.com/samuelprakash18/teachman/blob/main/backend/app/models/student.py): `backend/app/models/student.py`

### Billing and cash

- [Tutor billing pages](https://github.com/samuelprakash18/teachman/blob/main/frontend/src/pages/tutor/Invoices.tsx): `frontend/src/pages/tutor/Invoices.tsx`
- [Invoices and payments](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/payments.py): `backend/app/api/routes/payments.py`
- [Invoice numbering](https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/invoice_service.py): `backend/app/services/invoice_service.py`
- [Financial records](https://github.com/samuelprakash18/teachman/blob/main/backend/app/models/finance.py): `backend/app/models/finance.py`
- [Forecast and expenses](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/forecast.py): `backend/app/api/routes/forecast.py`
- [Cash forecast engine](https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/forecast_engine.py): `backend/app/services/forecast_engine.py`

### Backend platform

- [API application](https://github.com/samuelprakash18/teachman/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Access dependencies](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`
- [Database sessions](https://github.com/samuelprakash18/teachman/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- **PostgreSQL**

### Learning and assistance

- [Learning and AI](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/ai.py): `backend/app/api/routes/ai.py`
- [AI service](https://github.com/samuelprakash18/teachman/blob/main/backend/app/services/ai_service.py): `backend/app/services/ai_service.py`
- [Notifications](https://github.com/samuelprakash18/teachman/blob/main/backend/app/api/routes/notifications.py): `backend/app/api/routes/notifications.py`

### Other components

- **Tutors and parents**
- **NVIDIA service**

## Connections

- Tutors and parents → Role-based pages: use pages (evidence: `frontend/src/App.tsx`)
- Role-based pages → Teaching pages: routes to (evidence: `frontend/src/App.tsx`)
- Role-based pages → Parent pages: routes to (evidence: `frontend/src/App.tsx`)
- Teaching pages → API client: requests data (evidence: `frontend/src/pages/tutor/Enrollments.tsx`)
- Parent pages → API client: requests data (evidence: `frontend/src/pages/parent/Fees.tsx`)
- API client → API application: calls API
- API application → Authentication: registers route (evidence: `backend/app/main.py`)
- API application → Students and classes: registers route (evidence: `backend/app/main.py`)
- API application → Enrollment workflow: registers route (evidence: `backend/app/main.py`)
- API application → Invoices and payments: registers route (evidence: `backend/app/main.py`)
- API application → Forecast and expenses: registers route (evidence: `backend/app/main.py`)
- API application → Learning and AI: registers route (evidence: `backend/app/main.py`)
- API application → Notifications: registers route (evidence: `backend/app/main.py`)
- Enrollment workflow → Approval invoicing: approves via (evidence: `backend/app/api/routes/enrollments.py`)
- Approval invoicing → Invoice numbering: gets number (evidence: `backend/app/services/enrollment_service.py`)
- Enrollment workflow → Teaching records: reads and writes (evidence: `backend/app/api/routes/enrollments.py`)
- Approval invoicing → Teaching records: reads records (evidence: `backend/app/services/enrollment_service.py`)
- Approval invoicing → Student records: reads records (evidence: `backend/app/services/enrollment_service.py`)
- Approval invoicing → Financial records: creates invoice (evidence: `backend/app/services/enrollment_service.py`)
- Invoices and payments → Invoice numbering: uses numbering (evidence: `backend/app/api/routes/payments.py`)
- Invoices and payments → Financial records: reads and writes (evidence: `backend/app/api/routes/payments.py`)
- Forecast and expenses → Cash forecast engine: computes forecast
- Learning and AI → AI service: uses service
- AI service → NVIDIA service: optionally calls (evidence: `backend/app/services/ai_service.py`)
- Authentication → Access dependencies: uses identity (evidence: `backend/app/api/routes/auth.py`)
- Access dependencies → Database sessions: gets session (evidence: `backend/app/api/deps.py`)
- Enrollment workflow → Database sessions: gets session (evidence: `backend/app/api/routes/enrollments.py`)
- Invoices and payments → Database sessions: gets session (evidence: `backend/app/api/routes/payments.py`)
- Database sessions → PostgreSQL: opens connection (evidence: `backend/app/db/session.py`)
