# nikhilshoonya/traincheck architecture

> Architecture diagram of the GitHub repository nikhilshoonya/traincheck, 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/nikhilshoonya/traincheck
- Repository: https://github.com/nikhilshoonya/traincheck

## Overview

TrainCheck is a learning-and-development platform for employee training, assessments, behaviour reviews, feedback and compliance reporting. L&D administrators manage people, training, question banks and imports; employees complete assigned training and assessments, with a backend-controlled assessment gate and scoring workflow. Reports and exports provide operational and learning evidence. The graph emphasizes backend ownership and documented module relationships; frontend pages are present in the tree, but sampled evidence does not establish their API calls. Some subsystems are represented by their exact enclosing directories because their implementation files were not sampled.

Main entry points: [`backend/app/main.py`](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/main.py) (API application), [`backend/app/modules/training/router.py`](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/training/router.py) (Training management), [`backend/app/modules/employee/router.py`](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/employee/router.py) (Employee workspace API), [`backend/app/modules/imports/service.py`](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/imports/service.py) (Bulk imports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and access"]
  node_api["API application<br/>[main.py]"]
  node_access["Identity and gate<br/>[deps.py]"]
  node_db["Database sessions<br/>[db.py]"]
  node_schema[("Domain records<br/>[models.py]")]
end

subgraph group_learning["Learning setup"]
  node_training["Training management<br/>[router.py]"]
  node_questions["Question bank<br/>[router.py]"]
  node_imports["Bulk imports<br/>[service.py]"]
  node_organisation["Organisation people<br/>[people.py]"]
end

subgraph group_assessment["Assessment lifecycle"]
  node_gate["Obligation gate<br/>[gate.py]"]
  node_schedule["Assessment scheduling<br/>[scheduling.py]"]
  node_engine["Exam and scoring engine<br/>[service.py]"]
  node_notifications["Notifications<br/>[service.py]"]
end

subgraph group_people["People and feedback"]
  node_employee_api["Employee workspace API<br/>[router.py]"]
  node_identity["Sign-in<br/>[router.py]"]
  node_behaviour["Behaviour reviews<br/>[router.py]"]
  node_feedback["Assessment feedback<br/>[router.py]"]
end

subgraph group_insights["Reports and operations"]
  node_reports["Reports and exports<br/>[router.py]"]
  node_audit["Audit history<br/>[router.py]"]
  node_scheduler["Scheduled jobs<br/>[jobs.py]"]
end

node_employee(("Employee"))
node_ldadmin(("L&amp;D admin"))
node_frontend["TrainCheck workspace<br/>[layout.tsx]"]

node_api -->|"registers routes"| node_identity
node_api -->|"registers routes"| node_employee_api
node_api -->|"registers routes"| node_training
node_api -->|"registers routes"| node_questions
node_api -->|"registers routes"| node_imports
node_api -->|"registers routes"| node_behaviour
node_api -->|"registers routes"| node_feedback
node_api -->|"registers routes"| node_reports
node_api -->|"registers routes"| node_audit
node_identity -->|"uses access checks"| node_access
node_employee_api -->|"uses assessment gate"| node_gate
node_access -->|"checks obligations"| node_gate
node_gate -->|"checks pool readiness"| node_engine
node_gate -->|"alerts unavailable"| node_notifications
node_training -->|"uses exam services"| node_engine
node_training -->|"uses calendar logic"| node_schedule
node_training -->|"uses notification service"| node_notifications
node_employee_api -->|"uses due dates"| node_schedule
node_employee_api -->|"uses review service"| node_behaviour
node_employee_api -->|"uses scorecard data"| node_reports
node_feedback -->|"checks assessment state"| node_engine
node_imports -->|"uses question bank"| node_questions
node_imports -->|"uses training service"| node_training
node_imports -->|"uses people data"| node_organisation
node_reports -->|"uses calendar logic"| node_schedule
node_reports -->|"uses notification service"| node_notifications
node_behaviour -->|"reads and writes"| node_schema
node_training -->|"reads and writes"| node_schema
node_engine -->|"reads and writes"| node_schema
node_db -->|"maps records"| node_schema
node_employee -.->|"uses workspace"| node_frontend
node_ldadmin -.->|"uses workspace"| node_frontend

click node_api "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/main.py"
click node_access "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/core/deps.py"
click node_db "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/core/db.py"
click node_schema "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/models.py"
click node_training "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/training/router.py"
click node_questions "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/question_bank/router.py"
click node_imports "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/imports/service.py"
click node_organisation "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/organisation/people.py"
click node_employee_api "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/employee/router.py"
click node_identity "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/identity/router.py"
click node_behaviour "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/behaviour/router.py"
click node_feedback "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/feedback/router.py"
click node_gate "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/assessment/gate.py"
click node_schedule "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/assessment/scheduling.py"
click node_engine "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/assessment/service.py"
click node_notifications "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/notifications/service.py"
click node_reports "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/reports/router.py"
click node_audit "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/audit/router.py"
click node_scheduler "https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/scheduler/jobs.py"
click node_frontend "https://github.com/nikhilshoonya/traincheck/blob/main/frontend/src/app/(workspace)/layout.tsx"

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_api,node_access,node_db,node_schema toneBlue
class node_training,node_questions,node_imports,node_organisation toneAmber
class node_gate,node_schedule,node_engine,node_notifications toneMint
class node_employee_api,node_identity,node_behaviour,node_feedback toneRose
class node_reports,node_audit,node_scheduler,node_employee,node_ldadmin toneIndigo
class node_frontend toneTeal
```

## Components

### API and access

- [API application](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/main.py): `backend/app/main.py`
- [Identity and gate](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/core/deps.py): `backend/app/core/deps.py`
- [Database sessions](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [Domain records](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/models.py): `backend/app/models.py`

### Learning setup

- [Training management](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/training/router.py): `backend/app/modules/training/router.py`
- [Question bank](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/question_bank/router.py): `backend/app/modules/question_bank/router.py`
- [Bulk imports](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/imports/service.py): `backend/app/modules/imports/service.py`
- [Organisation people](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/organisation/people.py): `backend/app/modules/organisation/people.py`

### Assessment lifecycle

- [Obligation gate](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/assessment/gate.py): `backend/app/modules/assessment/gate.py`
- [Assessment scheduling](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/assessment/scheduling.py): `backend/app/modules/assessment/scheduling.py`
- [Exam and scoring engine](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/assessment/service.py): `backend/app/modules/assessment/service.py`
- [Notifications](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/notifications/service.py): `backend/app/modules/notifications/service.py`

### People and feedback

- [Employee workspace API](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/employee/router.py): `backend/app/modules/employee/router.py`
- [Sign-in](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/identity/router.py): `backend/app/modules/identity/router.py`
- [Behaviour reviews](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/behaviour/router.py): `backend/app/modules/behaviour/router.py`
- [Assessment feedback](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/feedback/router.py): `backend/app/modules/feedback/router.py`

### Reports and operations

- [Reports and exports](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/reports/router.py): `backend/app/modules/reports/router.py`
- [Audit history](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/audit/router.py): `backend/app/modules/audit/router.py`
- [Scheduled jobs](https://github.com/nikhilshoonya/traincheck/blob/main/backend/app/modules/scheduler/jobs.py): `backend/app/modules/scheduler/jobs.py`

### Other components

- **Employee**
- **L&D admin**
- [TrainCheck workspace](https://github.com/nikhilshoonya/traincheck/blob/main/frontend/src/app/(workspace)/layout.tsx): `frontend/src/app/(workspace)/layout.tsx`

## Connections

- API application → Sign-in: registers routes (evidence: `backend/app/main.py`)
- API application → Employee workspace API: registers routes (evidence: `backend/app/main.py`)
- API application → Training management: registers routes (evidence: `backend/app/main.py`)
- API application → Question bank: registers routes (evidence: `backend/app/main.py`)
- API application → Bulk imports: registers routes (evidence: `backend/app/main.py`)
- API application → Behaviour reviews: registers routes (evidence: `backend/app/main.py`)
- API application → Assessment feedback: registers routes (evidence: `backend/app/main.py`)
- API application → Reports and exports: registers routes (evidence: `backend/app/main.py`)
- API application → Audit history: registers routes (evidence: `backend/app/main.py`)
- Sign-in → Identity and gate: uses access checks (evidence: `backend/app/modules/identity/router.py`)
- Employee workspace API → Obligation gate: uses assessment gate (evidence: `backend/app/modules/employee/router.py`)
- Identity and gate → Obligation gate: checks obligations (evidence: `backend/app/core/deps.py`)
- Obligation gate → Exam and scoring engine: checks pool readiness (evidence: `backend/app/modules/assessment/gate.py`)
- Obligation gate → Notifications: alerts unavailable (evidence: `backend/app/modules/assessment/gate.py`)
- Training management → Exam and scoring engine: uses exam services (evidence: `backend/app/modules/training/router.py`)
- Training management → Assessment scheduling: uses calendar logic (evidence: `backend/app/modules/training/router.py`)
- Training management → Notifications: uses notification service (evidence: `backend/app/modules/training/router.py`)
- Employee workspace API → Assessment scheduling: uses due dates (evidence: `backend/app/modules/employee/router.py`)
- Employee workspace API → Behaviour reviews: uses review service (evidence: `backend/app/modules/employee/router.py`)
- Employee workspace API → Reports and exports: uses scorecard data (evidence: `backend/app/modules/employee/router.py`)
- Assessment feedback → Exam and scoring engine: checks assessment state (evidence: `backend/app/modules/feedback/router.py`)
- Bulk imports → Question bank: uses question bank (evidence: `backend/app/modules/imports/service.py`)
- Bulk imports → Training management: uses training service (evidence: `backend/app/modules/imports/service.py`)
- Bulk imports → Organisation people: uses people data (evidence: `backend/app/modules/imports/service.py`)
- Reports and exports → Assessment scheduling: uses calendar logic (evidence: `backend/app/modules/reports/router.py`)
- Reports and exports → Notifications: uses notification service (evidence: `backend/app/modules/reports/router.py`)
- Behaviour reviews → Domain records: reads and writes (evidence: `backend/app/modules/behaviour/router.py`)
- Training management → Domain records: reads and writes (evidence: `backend/app/modules/training/router.py`)
- Exam and scoring engine → Domain records: reads and writes (evidence: `backend/app/modules/assessment/service.py`)
- Database sessions → Domain records: maps records (evidence: `backend/app/models.py`)
- Employee → TrainCheck workspace: uses workspace
- L&D admin → TrainCheck workspace: uses workspace
