# ahosan83/project250 architecture

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

- Interactive diagram: https://gitdiagram.com/ahosan83/project250
- Repository: https://github.com/ahosan83/project250

## Overview

This is a role-based school management system: browser users work through a plain HTML/JavaScript frontend, which uses a Go REST API backed by PostgreSQL. The principal workflow is authenticated access to school operations and records; distinct domains include students/classes, attendance, exams/results, and fees. The README also documents dashboard, notices, HR/payroll, accounts, library, and teacher workflows. Several of those are implemented in the large module handler file, so they are represented as distinct responsibilities sharing that source path. Some route and frontend wiring is not shown in the excerpts.

Main entry points: [`backend/main.go`](https://github.com/ahosan83/project250/blob/main/backend/main.go) (REST API), [`backend/db.go`](https://github.com/ahosan83/project250/blob/main/backend/db.go) (Database setup), [`backend/handlers_dashboard.go`](https://github.com/ahosan83/project250/blob/main/backend/handlers_dashboard.go) (Dashboard metrics), [`backend/handlers_students.go`](https://github.com/ahosan83/project250/blob/main/backend/handlers_students.go) (Student records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web frontend"]
  node_web_pages["Role portals"]
  node_web_api["API client<br/>[api.js]"]
end

subgraph group_platform["API platform"]
  node_api_server["REST API<br/>[main.go]"]
  node_auth["Authentication<br/>[handlers_auth.go]"]
  node_jwt["JWT middleware<br/>[auth.go]"]
  node_db_setup["Database setup<br/>[db.go]"]
  node_postgres[("PostgreSQL")]
  node_school_data["School data<br/>[models.go]"]
end

subgraph group_school["School operations"]
  node_dashboard["Dashboard metrics"]
  node_students["Student records"]
  node_teachers["Teacher workflows"]
  node_classes["Class records"]
  node_attendance["Attendance"]
  node_exams["Exams and results<br/>[handlers_exams.go]"]
  node_fees["Fees<br/>[handlers_fees.go]"]
  node_notices["Notices"]
end

subgraph group_services["Administration services"]
  node_admin_security["Security and audit"]
  node_hr_payroll["HR and payroll"]
  node_accounts_documents["Accounts and documents"]
  node_library["Library services"]
  node_learning_support["Learning support"]
end

node_school_users(("School users"))

node_school_users -->|"uses"| node_web_pages
node_web_api -->|"requests API"| node_api_server
node_api_server -->|"serves frontend"| node_web_pages
node_api_server -->|"initializes"| node_db_setup
node_db_setup -->|"connects"| node_postgres
node_api_server -.->|"routes auth"| node_auth
node_api_server -.->|"protects routes"| node_jwt
node_api_server -->|"routes dashboard"| node_dashboard
node_api_server -->|"routes classes"| node_classes
node_api_server -->|"routes students"| node_students
node_api_server -->|"routes attendance"| node_attendance
node_api_server -->|"routes exams"| node_exams
node_api_server -->|"routes fees"| node_fees
node_api_server -->|"routes teacher workflows"| node_teachers
node_dashboard -->|"queries metrics"| node_postgres
node_students -->|"reads and writes"| node_postgres
node_classes -->|"reads and writes"| node_postgres
node_attendance -->|"reads and writes"| node_postgres
node_exams -->|"reads and writes"| node_postgres
node_fees -->|"reads and writes"| node_postgres
node_teachers -->|"queries records"| node_postgres
node_notices -.->|"registered routes"| node_api_server
node_admin_security -.->|"registered routes"| node_api_server
node_hr_payroll -->|"registered routes"| node_api_server
node_accounts_documents -->|"registered routes"| node_api_server
node_library -->|"registered routes"| node_api_server
node_learning_support -.->|"registered routes"| node_api_server
node_school_data -.->|"models stored data"| node_postgres

click node_web_pages "https://github.com/ahosan83/project250/tree/main/frontend"
click node_web_api "https://github.com/ahosan83/project250/blob/main/frontend/js/api.js"
click node_api_server "https://github.com/ahosan83/project250/blob/main/backend/main.go"
click node_auth "https://github.com/ahosan83/project250/blob/main/backend/handlers_auth.go"
click node_jwt "https://github.com/ahosan83/project250/blob/main/backend/auth.go"
click node_db_setup "https://github.com/ahosan83/project250/blob/main/backend/db.go"
click node_dashboard "https://github.com/ahosan83/project250/blob/main/backend/handlers_dashboard.go"
click node_students "https://github.com/ahosan83/project250/blob/main/backend/handlers_students.go"
click node_teachers "https://github.com/ahosan83/project250/blob/main/backend/handlers_teachers.go"
click node_classes "https://github.com/ahosan83/project250/blob/main/backend/handlers_classes.go"
click node_attendance "https://github.com/ahosan83/project250/blob/main/backend/handlers_attendance.go"
click node_exams "https://github.com/ahosan83/project250/blob/main/backend/handlers_exams.go"
click node_fees "https://github.com/ahosan83/project250/blob/main/backend/handlers_fees.go"
click node_notices "https://github.com/ahosan83/project250/blob/main/backend/handlers_notices.go"
click node_admin_security "https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go"
click node_hr_payroll "https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go"
click node_accounts_documents "https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go"
click node_library "https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go"
click node_learning_support "https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go"
click node_school_data "https://github.com/ahosan83/project250/blob/main/backend/models.go"

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_web_pages,node_web_api,node_school_users toneBlue
class node_api_server,node_auth,node_jwt,node_db_setup,node_postgres,node_school_data toneAmber
class node_dashboard,node_students,node_teachers,node_classes,node_attendance,node_exams,node_fees,node_notices toneMint
class node_admin_security,node_hr_payroll,node_accounts_documents,node_library,node_learning_support toneRose
```

## Components

### Web frontend

- [Role portals](https://github.com/ahosan83/project250/tree/main/frontend): `frontend`
- [API client](https://github.com/ahosan83/project250/blob/main/frontend/js/api.js): `frontend/js/api.js`

### API platform

- [REST API](https://github.com/ahosan83/project250/blob/main/backend/main.go): `backend/main.go`
- [Authentication](https://github.com/ahosan83/project250/blob/main/backend/handlers_auth.go): `backend/handlers_auth.go`
- [JWT middleware](https://github.com/ahosan83/project250/blob/main/backend/auth.go): `backend/auth.go`
- [Database setup](https://github.com/ahosan83/project250/blob/main/backend/db.go): `backend/db.go`
- **PostgreSQL**
- [School data](https://github.com/ahosan83/project250/blob/main/backend/models.go): `backend/models.go`

### School operations

- [Dashboard metrics](https://github.com/ahosan83/project250/blob/main/backend/handlers_dashboard.go): `backend/handlers_dashboard.go`
- [Student records](https://github.com/ahosan83/project250/blob/main/backend/handlers_students.go): `backend/handlers_students.go`
- [Teacher workflows](https://github.com/ahosan83/project250/blob/main/backend/handlers_teachers.go): `backend/handlers_teachers.go`
- [Class records](https://github.com/ahosan83/project250/blob/main/backend/handlers_classes.go): `backend/handlers_classes.go`
- [Attendance](https://github.com/ahosan83/project250/blob/main/backend/handlers_attendance.go): `backend/handlers_attendance.go`
- [Exams and results](https://github.com/ahosan83/project250/blob/main/backend/handlers_exams.go): `backend/handlers_exams.go`
- [Fees](https://github.com/ahosan83/project250/blob/main/backend/handlers_fees.go): `backend/handlers_fees.go`
- [Notices](https://github.com/ahosan83/project250/blob/main/backend/handlers_notices.go): `backend/handlers_notices.go`

### Administration services

- [Security and audit](https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go): `backend/handlers_modules.go`
- [HR and payroll](https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go): `backend/handlers_modules.go`
- [Accounts and documents](https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go): `backend/handlers_modules.go`
- [Library services](https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go): `backend/handlers_modules.go`
- [Learning support](https://github.com/ahosan83/project250/blob/main/backend/handlers_modules.go): `backend/handlers_modules.go`

### Other components

- **School users**

## Connections

- School users → Role portals: uses (evidence: `README.md`)
- API client → REST API: requests API (evidence: `frontend/js/api.js`)
- REST API → Role portals: serves frontend (evidence: `README.md`)
- REST API → Database setup: initializes (evidence: `backend/main.go`)
- Database setup → PostgreSQL: connects (evidence: `README.md`)
- REST API → Authentication: routes auth
- REST API → JWT middleware: protects routes
- REST API → Dashboard metrics: routes dashboard (evidence: `backend/main.go`)
- REST API → Class records: routes classes (evidence: `backend/main.go`)
- REST API → Student records: routes students (evidence: `backend/main.go`)
- REST API → Attendance: routes attendance (evidence: `backend/main.go`)
- REST API → Exams and results: routes exams (evidence: `backend/main.go`)
- REST API → Fees: routes fees (evidence: `backend/main.go`)
- REST API → Teacher workflows: routes teacher workflows (evidence: `backend/main.go`)
- Dashboard metrics → PostgreSQL: queries metrics (evidence: `backend/handlers_dashboard.go`)
- Student records → PostgreSQL: reads and writes (evidence: `backend/handlers_students.go`)
- Class records → PostgreSQL: reads and writes (evidence: `backend/handlers_classes.go`)
- Attendance → PostgreSQL: reads and writes (evidence: `backend/handlers_attendance.go`)
- Exams and results → PostgreSQL: reads and writes (evidence: `backend/handlers_exams.go`)
- Fees → PostgreSQL: reads and writes (evidence: `backend/handlers_fees.go`)
- Teacher workflows → PostgreSQL: queries records (evidence: `backend/handlers_teachers.go`)
- Notices → REST API: registered routes
- Security and audit → REST API: registered routes
- HR and payroll → REST API: registered routes (evidence: `backend/main.go`)
- Accounts and documents → REST API: registered routes (evidence: `backend/main.go`)
- Library services → REST API: registered routes (evidence: `backend/main.go`)
- Learning support → REST API: registered routes
- School data → PostgreSQL: models stored data
