# qusai68/sms architecture

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

- Interactive diagram: https://gitdiagram.com/qusai68/sms
- Repository: https://github.com/qusai68/sms

## Overview

This is a school-management API for authenticating users and managing student and teacher records. The main workflow is an HTTP request routed to a controller, which checks identity or role as needed, reads or changes school data through Entity Framework, and returns a response. Student and teacher endpoints support searching, record details, creation, updates, and deletion; DTOs shape input and output, while shared lookup data supplies grades, sections, positions, subjects, and statuses. Controller excerpts provide the main flow evidence; unsampled endpoint details are not inferred.

Main entry points: [`SMS/DbContexts/SchoolContext.cs`](https://github.com/qusai68/sms/blob/master/SMS/DbContexts/SchoolContext.cs) (School data context), [`SMS/Controllers/AuthController.cs`](https://github.com/qusai68/sms/blob/master/SMS/Controllers/AuthController.cs) (Authentication), [`SMS/Controllers/StudentsController.cs`](https://github.com/qusai68/sms/blob/master/SMS/Controllers/StudentsController.cs) (Student management), [`SMS/Models/Teacher.cs`](https://github.com/qusai68/sms/blob/master/SMS/Models/Teacher.cs) (Teacher entity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API workflows"]
  node_host["HTTP host<br/>[Program.cs]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Authentication<br/>[AuthController.cs]"]
end

subgraph group_school["School records"]
  node_student_api["Student management"]
  node_teacher_api["Teacher management"]
end

subgraph group_persistence["Persistence model"]
  node_context["School data context<br/>[SchoolContext.cs]"]
  node_student["Student entity<br/>[Student.cs]"]
  node_teacher["Teacher entity<br/>[Teacher.cs]"]
  node_user["User entity<br/>[User.cs]"]
  node_lookup["Lookup entity<br/>[Lookup.cs]"]
end

subgraph group_contracts["Request and response contracts"]
  node_student_dto["Student DTOs"]
  node_teacher_dto["Teacher DTOs"]
  node_auth_dto["Auth DTOs"]
end

node_client(("API client"))
node_sql[("School SQL database")]

node_client -->|"sends HTTP"| node_host
node_host -->|"routes requests"| node_auth
node_host -->|"routes requests"| node_student_api
node_host -->|"routes requests"| node_teacher_api
node_auth -->|"accepts credentials"| node_auth_dto
node_student_api -->|"maps records"| node_student_dto
node_teacher_api -->|"maps records"| node_teacher_dto
node_host -->|"configures context"| node_context
node_auth -->|"queries users"| node_context
node_student_api -->|"reads and writes"| node_context
node_teacher_api -->|"reads and writes"| node_context
node_context -->|"exposes set"| node_student
node_context -->|"exposes set"| node_teacher
node_context -->|"exposes set"| node_user
node_context -->|"exposes set"| node_lookup
node_context -->|"uses SQL Server"| node_sql
node_student_api -->|"creates accounts"| node_user
node_teacher_api -->|"creates accounts"| node_user
node_auth -->|"checks credentials"| node_user
node_auth -->|"derives role"| node_teacher
node_auth -->|"derives role"| node_student
node_student_api -->|"validates homeroom"| node_teacher
node_student_api -->|"validates lookups"| node_lookup
node_teacher_api -->|"validates lookups"| node_lookup
node_student -->|"references teacher"| node_teacher
node_student -->|"references lookups"| node_lookup
node_teacher -->|"references lookups"| node_lookup
node_teacher -->|"references account"| node_user
node_student -->|"references account"| node_user

click node_host "https://github.com/qusai68/sms/blob/master/SMS/Program.cs"
click node_auth "https://github.com/qusai68/sms/blob/master/SMS/Controllers/AuthController.cs"
click node_student_api "https://github.com/qusai68/sms/blob/master/SMS/Controllers/StudentsController.cs"
click node_teacher_api "https://github.com/qusai68/sms/blob/master/SMS/Controllers/TeachersController.cs"
click node_student_dto "https://github.com/qusai68/sms/tree/master/SMS/Dtos/Students"
click node_teacher_dto "https://github.com/qusai68/sms/tree/master/SMS/Dtos/Teachers"
click node_auth_dto "https://github.com/qusai68/sms/tree/master/SMS/Dtos/Auth"
click node_context "https://github.com/qusai68/sms/blob/master/SMS/DbContexts/SchoolContext.cs"
click node_student "https://github.com/qusai68/sms/blob/master/SMS/Models/Student.cs"
click node_teacher "https://github.com/qusai68/sms/blob/master/SMS/Models/Teacher.cs"
click node_user "https://github.com/qusai68/sms/blob/master/SMS/Models/User.cs"
click node_lookup "https://github.com/qusai68/sms/blob/master/SMS/Models/Lookup.cs"

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_host,node_client toneBlue
class node_auth,node_sql toneAmber
class node_student_api,node_teacher_api toneMint
class node_context,node_student,node_teacher,node_user,node_lookup toneRose
class node_student_dto,node_teacher_dto,node_auth_dto toneIndigo
```

## Components

### API workflows

- [HTTP host](https://github.com/qusai68/sms/blob/master/SMS/Program.cs): `SMS/Program.cs`

### Identity and access

- [Authentication](https://github.com/qusai68/sms/blob/master/SMS/Controllers/AuthController.cs): `SMS/Controllers/AuthController.cs`

### School records

- [Student management](https://github.com/qusai68/sms/blob/master/SMS/Controllers/StudentsController.cs): `SMS/Controllers/StudentsController.cs`
- [Teacher management](https://github.com/qusai68/sms/blob/master/SMS/Controllers/TeachersController.cs): `SMS/Controllers/TeachersController.cs`

### Persistence model

- [School data context](https://github.com/qusai68/sms/blob/master/SMS/DbContexts/SchoolContext.cs): `SMS/DbContexts/SchoolContext.cs`
- [Student entity](https://github.com/qusai68/sms/blob/master/SMS/Models/Student.cs): `SMS/Models/Student.cs`
- [Teacher entity](https://github.com/qusai68/sms/blob/master/SMS/Models/Teacher.cs): `SMS/Models/Teacher.cs`
- [User entity](https://github.com/qusai68/sms/blob/master/SMS/Models/User.cs): `SMS/Models/User.cs`
- [Lookup entity](https://github.com/qusai68/sms/blob/master/SMS/Models/Lookup.cs): `SMS/Models/Lookup.cs`

### Request and response contracts

- [Student DTOs](https://github.com/qusai68/sms/tree/master/SMS/Dtos/Students): `SMS/Dtos/Students`
- [Teacher DTOs](https://github.com/qusai68/sms/tree/master/SMS/Dtos/Teachers): `SMS/Dtos/Teachers`
- [Auth DTOs](https://github.com/qusai68/sms/tree/master/SMS/Dtos/Auth): `SMS/Dtos/Auth`

### Other components

- **API client**
- **School SQL database**

## Connections

- API client → HTTP host: sends HTTP (evidence: `SMS/Program.cs`)
- HTTP host → Authentication: routes requests (evidence: `SMS/Program.cs`)
- HTTP host → Student management: routes requests (evidence: `SMS/Program.cs`)
- HTTP host → Teacher management: routes requests (evidence: `SMS/Program.cs`)
- Authentication → Auth DTOs: accepts credentials (evidence: `SMS/Controllers/AuthController.cs`)
- Student management → Student DTOs: maps records (evidence: `SMS/Controllers/StudentsController.cs`)
- Teacher management → Teacher DTOs: maps records (evidence: `SMS/Controllers/TeachersController.cs`)
- HTTP host → School data context: configures context (evidence: `SMS/Program.cs`)
- Authentication → School data context: queries users (evidence: `SMS/Controllers/AuthController.cs`)
- Student management → School data context: reads and writes (evidence: `SMS/Controllers/StudentsController.cs`)
- Teacher management → School data context: reads and writes (evidence: `SMS/Controllers/TeachersController.cs`)
- School data context → Student entity: exposes set (evidence: `SMS/DbContexts/SchoolContext.cs`)
- School data context → Teacher entity: exposes set (evidence: `SMS/DbContexts/SchoolContext.cs`)
- School data context → User entity: exposes set (evidence: `SMS/DbContexts/SchoolContext.cs`)
- School data context → Lookup entity: exposes set (evidence: `SMS/DbContexts/SchoolContext.cs`)
- School data context → School SQL database: uses SQL Server
- Student management → User entity: creates accounts (evidence: `SMS/Controllers/StudentsController.cs`)
- Teacher management → User entity: creates accounts (evidence: `SMS/Controllers/TeachersController.cs`)
- Authentication → User entity: checks credentials (evidence: `SMS/Controllers/AuthController.cs`)
- Authentication → Teacher entity: derives role (evidence: `SMS/Controllers/AuthController.cs`)
- Authentication → Student entity: derives role (evidence: `SMS/Controllers/AuthController.cs`)
- Student management → Teacher entity: validates homeroom (evidence: `SMS/Controllers/StudentsController.cs`)
- Student management → Lookup entity: validates lookups (evidence: `SMS/Controllers/StudentsController.cs`)
- Teacher management → Lookup entity: validates lookups (evidence: `SMS/Controllers/TeachersController.cs`)
- Student entity → Teacher entity: references teacher (evidence: `SMS/Models/Student.cs`)
- Student entity → Lookup entity: references lookups (evidence: `SMS/Models/Student.cs`)
- Teacher entity → Lookup entity: references lookups (evidence: `SMS/Models/Teacher.cs`)
- Teacher entity → User entity: references account (evidence: `SMS/Models/Teacher.cs`)
- Student entity → User entity: references account (evidence: `SMS/Models/Student.cs`)
