# ongechiosiango/shulebase architecture

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

- Interactive diagram: https://gitdiagram.com/ongechiosiango/shulebase
- Repository: https://github.com/ongechiosiango/shulebase

## Overview

ShuleBase is a multi-tenant school-management SaaS for Kenyan schools. Users enter through the public login or registration pages, then work in role-based portals: administrators manage school setup and users, teachers record attendance and grades or publish assignments and materials, and parents and students view academic and fee information. The README documents CBC/KCSE grading, bulk tools, report cards, and M-Pesa reconciliation. The sampled excerpts show login, role checks, database setup, and parts of grading and portal pages; other feature links reflect README descriptions, not inspected call sites.

Main entry points: [`public/teacher`](https://github.com/ongechiosiango/shulebase/tree/main/public/teacher) (Teacher portal), [`core/Auth.php`](https://github.com/ongechiosiango/shulebase/blob/main/core/Auth.php) (Authentication and roles), [`public/admin`](https://github.com/ongechiosiango/shulebase/tree/main/public/admin) (School administration), [`public/parent`](https://github.com/ongechiosiango/shulebase/tree/main/public/parent) (Parent portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and tenancy"]
  node_login["Login portal<br/>[index.php]"]
  node_registration["School registration<br/>[register.php]"]
end

subgraph group_school["School administration"]
  node_admin["School administration"]
  node_billing["Fee billing<br/>[Billing.php]"]
end

subgraph group_learning["Teaching and learning"]
  node_academic["Grading engine<br/>[AcademicEngine.php]"]
  node_teacher["Teacher portal"]
  node_assignments["Assignments and quizzes<br/>[assignments.php]"]
  node_materials["Learning materials"]
  node_attendance["Attendance tracking"]
  node_reports["Report cards and exports<br/>[cbc_report_tpl.php]"]
end

subgraph group_family["Family services"]
  node_student["Student portal"]
  node_parent["Parent portal"]
end

subgraph group_platform["Shared platform"]
  node_auth["Authentication and roles<br/>[Auth.php]"]
  node_limiter["Login rate limiting<br/>[RateLimiter.php]"]
  node_dbconfig["Database connection<br/>[db.php]"]
  node_mysql[("MySQL database")]
  node_csrf["CSRF protection<br/>[Csrf.php]"]
  node_sms["SMS messaging<br/>[SMS.php]"]
end

node_people(("School users"))
node_mpesa["M-Pesa Daraja"]

node_people -->|"sign in"| node_login
node_people -->|"register school"| node_registration
node_login -->|"authenticate"| node_auth
node_auth -->|"check attempts"| node_limiter
node_auth -->|"query users"| node_mysql
node_registration -->|"create school"| node_mysql
node_dbconfig -->|"connect"| node_mysql
node_dbconfig -->|"verify POST"| node_csrf
node_admin -->|"enforce role"| node_auth
node_admin -->|"manage school data"| node_mysql
node_teacher -->|"enforce role"| node_auth
node_teacher -->|"grade results"| node_academic
node_teacher -->|"record schoolwork"| node_mysql
node_teacher -->|"manage assignments"| node_assignments
node_teacher -->|"publish materials"| node_materials
node_teacher -->|"record attendance"| node_attendance
node_student -->|"enforce role"| node_auth
node_student -->|"read learning data"| node_mysql
node_parent -->|"enforce role"| node_auth
node_parent -->|"read child data"| node_mysql
node_student -->|"view results"| node_reports
node_parent -->|"view results"| node_reports
node_admin -->|"export results"| node_reports
node_admin -->|"manage fees"| node_billing
node_parent -->|"view statements"| node_billing
node_billing -->|"reconcile fees"| node_mysql
node_billing -.->|"reconcile payments"| node_mpesa
node_teacher -.->|"send communication"| node_sms

click node_login "https://github.com/ongechiosiango/shulebase/blob/main/public/index.php"
click node_registration "https://github.com/ongechiosiango/shulebase/blob/main/public/register.php"
click node_auth "https://github.com/ongechiosiango/shulebase/blob/main/core/Auth.php"
click node_limiter "https://github.com/ongechiosiango/shulebase/blob/main/core/RateLimiter.php"
click node_dbconfig "https://github.com/ongechiosiango/shulebase/blob/main/config/db.php"
click node_csrf "https://github.com/ongechiosiango/shulebase/blob/main/core/Csrf.php"
click node_admin "https://github.com/ongechiosiango/shulebase/tree/main/public/admin"
click node_academic "https://github.com/ongechiosiango/shulebase/blob/main/core/AcademicEngine.php"
click node_teacher "https://github.com/ongechiosiango/shulebase/tree/main/public/teacher"
click node_assignments "https://github.com/ongechiosiango/shulebase/blob/main/public/student/assignments.php"
click node_materials "https://github.com/ongechiosiango/shulebase/blob/main/public/teacher/learning_materials.php"
click node_attendance "https://github.com/ongechiosiango/shulebase/blob/main/public/teacher/mark_attendance.php"
click node_reports "https://github.com/ongechiosiango/shulebase/blob/main/includes/cbc_report_tpl.php"
click node_student "https://github.com/ongechiosiango/shulebase/tree/main/public/student"
click node_parent "https://github.com/ongechiosiango/shulebase/tree/main/public/parent"
click node_billing "https://github.com/ongechiosiango/shulebase/blob/main/core/Billing.php"
click node_sms "https://github.com/ongechiosiango/shulebase/blob/main/core/SMS.php"

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_login,node_registration,node_people toneBlue
class node_admin,node_billing toneAmber
class node_academic,node_teacher,node_assignments,node_materials,node_attendance,node_reports toneMint
class node_student,node_parent toneRose
class node_auth,node_limiter,node_dbconfig,node_mysql,node_csrf,node_sms,node_mpesa toneIndigo
```

## Components

### Access and tenancy

- [Login portal](https://github.com/ongechiosiango/shulebase/blob/main/public/index.php): `public/index.php`
- [School registration](https://github.com/ongechiosiango/shulebase/blob/main/public/register.php): `public/register.php`

### School administration

- [School administration](https://github.com/ongechiosiango/shulebase/tree/main/public/admin): `public/admin`
- [Fee billing](https://github.com/ongechiosiango/shulebase/blob/main/core/Billing.php): `core/Billing.php`

### Teaching and learning

- [Grading engine](https://github.com/ongechiosiango/shulebase/blob/main/core/AcademicEngine.php): `core/AcademicEngine.php`
- [Teacher portal](https://github.com/ongechiosiango/shulebase/tree/main/public/teacher): `public/teacher`
- [Assignments and quizzes](https://github.com/ongechiosiango/shulebase/blob/main/public/student/assignments.php): `public/student/assignments.php`
- [Learning materials](https://github.com/ongechiosiango/shulebase/blob/main/public/teacher/learning_materials.php): `public/teacher/learning_materials.php`
- [Attendance tracking](https://github.com/ongechiosiango/shulebase/blob/main/public/teacher/mark_attendance.php): `public/teacher/mark_attendance.php`
- [Report cards and exports](https://github.com/ongechiosiango/shulebase/blob/main/includes/cbc_report_tpl.php): `includes/cbc_report_tpl.php`

### Family services

- [Student portal](https://github.com/ongechiosiango/shulebase/tree/main/public/student): `public/student`
- [Parent portal](https://github.com/ongechiosiango/shulebase/tree/main/public/parent): `public/parent`

### Shared platform

- [Authentication and roles](https://github.com/ongechiosiango/shulebase/blob/main/core/Auth.php): `core/Auth.php`
- [Login rate limiting](https://github.com/ongechiosiango/shulebase/blob/main/core/RateLimiter.php): `core/RateLimiter.php`
- [Database connection](https://github.com/ongechiosiango/shulebase/blob/main/config/db.php): `config/db.php`
- **MySQL database**
- [CSRF protection](https://github.com/ongechiosiango/shulebase/blob/main/core/Csrf.php): `core/Csrf.php`
- [SMS messaging](https://github.com/ongechiosiango/shulebase/blob/main/core/SMS.php): `core/SMS.php`

### Other components

- **School users**
- **M-Pesa Daraja**

## Connections

- School users → Login portal: sign in
- School users → School registration: register school
- Login portal → Authentication and roles: authenticate
- Authentication and roles → Login rate limiting: check attempts
- Authentication and roles → MySQL database: query users
- School registration → MySQL database: create school
- Database connection → MySQL database: connect
- Database connection → CSRF protection: verify POST
- School administration → Authentication and roles: enforce role
- School administration → MySQL database: manage school data
- Teacher portal → Authentication and roles: enforce role
- Teacher portal → Grading engine: grade results
- Teacher portal → MySQL database: record schoolwork
- Teacher portal → Assignments and quizzes: manage assignments
- Teacher portal → Learning materials: publish materials
- Teacher portal → Attendance tracking: record attendance
- Student portal → Authentication and roles: enforce role
- Student portal → MySQL database: read learning data
- Parent portal → Authentication and roles: enforce role
- Parent portal → MySQL database: read child data
- Student portal → Report cards and exports: view results
- Parent portal → Report cards and exports: view results
- School administration → Report cards and exports: export results
- School administration → Fee billing: manage fees
- Parent portal → Fee billing: view statements
- Fee billing → MySQL database: reconcile fees
- Fee billing → M-Pesa Daraja: reconcile payments
- Teacher portal → SMS messaging: send communication
