# darkwa-chief/presbyterian-brigade-management-system architecture

> Architecture diagram of the GitHub repository darkwa-chief/presbyterian-brigade-management-system, 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/darkwa-chief/presbyterian-brigade-management-system
- Repository: https://github.com/darkwa-chief/presbyterian-brigade-management-system

## Overview

The Presbyterian Brigade Management System is a role-based PHP application for managing church brigade records and operations. Users authenticate through the login page; role-restricted admin, officer, and member pages provide dashboards and domain-specific management or viewing, with classes implementing the principal records and database access. Notification APIs support retrieval, unread counts, and read status; audit APIs support log deletion and clearing. The README documents broader capabilities, while some corresponding page implementations were not sampled, so those links are shown only where the source index supports them.

Main entry points: [`classes/Database.php`](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Database.php) (Database access), [`classes/User.php`](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/User.php) (User accounts), [`includes/auth.php`](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/includes/auth.php) (Sessions and access control), [`classes/Notification.php`](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Notification.php) (Notification records and reads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Access and UI"]
  node_login["Login and logout<br/>[login.php]"]
  node_role_pages["Role dashboards and pages"]
  node_header["Navigation and notification UI<br/>[header.php]"]
  node_profile["Profile settings"]
end

subgraph group_operations["Brigade Operations"]
  node_brigader_pages["Brigader administration<br/>[brigaders.php]"]
  node_attendance_pages["Attendance management<br/>[attendance.php]"]
  node_event_pages["Event management<br/>[events.php]"]
  node_recital_pages["Recital management<br/>[recitals.php]"]
  node_rank_pages["Rank administration<br/>[ranks.php]"]
  node_user_pages["User administration<br/>[users.php]"]
  node_brigader_model["Brigader records and promotions<br/>[Brigader.php]"]
  node_attendance_model["Attendance records<br/>[Attendance.php]"]
  node_event_model["Events<br/>[Event.php]"]
  node_recital_model["Recital records<br/>[Recital.php]"]
  node_rank_model["Ranks and promotions<br/>[Rank.php]"]
end

subgraph group_comms["Notifications and Audit"]
  node_notify_pages["Notification management<br/>[notifications.php]"]
  node_notify_api["Notification APIs"]
  node_notification_model["Notification records and reads<br/>[Notification.php]"]
  node_audit_pages["Audit log viewer<br/>[audit-logs.php]"]
  node_audit_api["Audit log APIs"]
end

subgraph group_core["Application Core"]
  node_auth["Sessions and access control<br/>[auth.php]"]
  node_middleware["Role middleware<br/>[middleware.php]"]
  node_user_model["User accounts<br/>[User.php]"]
  node_email["Email notifications<br/>[Email.php]"]
  node_helpers["Formatting and pagination<br/>[functions.php]"]
end

subgraph group_storage["Persistence"]
  node_database["Database access<br/>[Database.php]"]
  node_mysql[("MySQL")]
end

node_user_actor(("Brigade user"))

node_user_actor -->|"signs in"| node_login
node_login -->|"authenticates"| node_user_model
node_login -->|"starts session"| node_auth
node_role_pages -.->|"checks access"| node_auth
node_role_pages -.->|"enforces roles"| node_middleware
node_role_pages -->|"renders navigation"| node_header
node_profile -->|"updates account"| node_user_model
node_brigader_pages -->|"manages records"| node_brigader_model
node_brigader_pages -->|"assigns ranks"| node_rank_model
node_attendance_pages -->|"records attendance"| node_attendance_model
node_event_pages -.->|"manages events"| node_event_model
node_recital_pages -->|"manages recitals"| node_recital_model
node_rank_pages -.->|"manages ranks"| node_rank_model
node_user_pages -.->|"manages users"| node_user_model
node_notify_pages -->|"manages notifications"| node_notification_model
node_notify_api -->|"reads and updates"| node_notification_model
node_header -->|"loads notifications"| node_notification_model
node_audit_pages -->|"reads audit logs"| node_database
node_audit_api -->|"clears logs"| node_database
node_auth -->|"loads current user"| node_user_model
node_auth -->|"writes audit records"| node_database
node_brigader_model -->|"queries records"| node_database
node_attendance_model -->|"queries records"| node_database
node_event_model -->|"queries records"| node_database
node_recital_model -->|"queries records"| node_database
node_rank_model -->|"queries records"| node_database
node_notification_model -->|"queries records"| node_database
node_user_model -->|"queries records"| node_database
node_database -->|"connects and queries"| node_mysql
node_notify_pages -.->|"sends email"| node_email

click node_login "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/login.php"
click node_role_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/tree/main/public"
click node_header "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/includes/header.php"
click node_profile "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/profile-settings.php"
click node_brigader_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/brigaders.php"
click node_attendance_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/attendance.php"
click node_event_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/events.php"
click node_recital_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/recitals.php"
click node_rank_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/ranks.php"
click node_user_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/users.php"
click node_brigader_model "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Brigader.php"
click node_attendance_model "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Attendance.php"
click node_event_model "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Event.php"
click node_recital_model "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Recital.php"
click node_rank_model "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Rank.php"
click node_notify_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/notifications.php"
click node_notify_api "https://github.com/darkwa-chief/presbyterian-brigade-management-system/tree/main/public/api"
click node_notification_model "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Notification.php"
click node_audit_pages "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/audit-logs.php"
click node_audit_api "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/api/clear-audit-logs.php"
click node_auth "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/includes/auth.php"
click node_middleware "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/includes/middleware.php"
click node_user_model "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/User.php"
click node_email "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Email.php"
click node_helpers "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/includes/functions.php"
click node_database "https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Database.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_role_pages,node_header,node_profile,node_user_actor toneBlue
class node_brigader_pages,node_attendance_pages,node_event_pages,node_recital_pages,node_rank_pages,node_user_pages,node_brigader_model,node_attendance_model,node_event_model,node_recital_model,node_rank_model toneAmber
class node_notify_pages,node_notify_api,node_notification_model,node_audit_pages,node_audit_api toneMint
class node_auth,node_middleware,node_user_model,node_email,node_helpers toneRose
class node_database,node_mysql toneIndigo
```

## Components

### Access and UI

- [Login and logout](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/login.php): `public/login.php`
- [Role dashboards and pages](https://github.com/darkwa-chief/presbyterian-brigade-management-system/tree/main/public): `public`
- [Navigation and notification UI](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/includes/header.php): `public/includes/header.php`
- [Profile settings](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/profile-settings.php): `public/profile-settings.php`

### Brigade Operations

- [Brigader administration](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/brigaders.php): `public/admin/brigaders.php`
- [Attendance management](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/attendance.php): `public/admin/attendance.php`
- [Event management](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/events.php): `public/admin/events.php`
- [Recital management](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/recitals.php): `public/admin/recitals.php`
- [Rank administration](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/ranks.php): `public/admin/ranks.php`
- [User administration](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/users.php): `public/admin/users.php`
- [Brigader records and promotions](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Brigader.php): `classes/Brigader.php`
- [Attendance records](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Attendance.php): `classes/Attendance.php`
- [Events](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Event.php): `classes/Event.php`
- [Recital records](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Recital.php): `classes/Recital.php`
- [Ranks and promotions](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Rank.php): `classes/Rank.php`

### Notifications and Audit

- [Notification management](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/notifications.php): `public/admin/notifications.php`
- [Notification APIs](https://github.com/darkwa-chief/presbyterian-brigade-management-system/tree/main/public/api): `public/api`
- [Notification records and reads](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Notification.php): `classes/Notification.php`
- [Audit log viewer](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/admin/audit-logs.php): `public/admin/audit-logs.php`
- [Audit log APIs](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/public/api/clear-audit-logs.php): `public/api/clear-audit-logs.php`

### Application Core

- [Sessions and access control](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/includes/auth.php): `includes/auth.php`
- [Role middleware](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/includes/middleware.php): `includes/middleware.php`
- [User accounts](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/User.php): `classes/User.php`
- [Email notifications](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Email.php): `classes/Email.php`
- [Formatting and pagination](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/includes/functions.php): `includes/functions.php`

### Persistence

- [Database access](https://github.com/darkwa-chief/presbyterian-brigade-management-system/blob/main/classes/Database.php): `classes/Database.php`
- **MySQL**

### Other components

- **Brigade user**

## Connections

- Brigade user → Login and logout: signs in (evidence: `README.md`)
- Login and logout → User accounts: authenticates (evidence: `public/login.php`)
- Login and logout → Sessions and access control: starts session (evidence: `public/login.php`)
- Role dashboards and pages → Sessions and access control: checks access (evidence: `public/index.php`)
- Role dashboards and pages → Role middleware: enforces roles (evidence: `public/admin/brigaders.php`)
- Role dashboards and pages → Navigation and notification UI: renders navigation (evidence: `public/admin/attendance.php`)
- Profile settings → User accounts: updates account (evidence: `public/profile-settings.php`)
- Brigader administration → Brigader records and promotions: manages records (evidence: `public/admin/brigaders.php`)
- Brigader administration → Ranks and promotions: assigns ranks (evidence: `public/admin/brigaders.php`)
- Attendance management → Attendance records: records attendance (evidence: `public/admin/attendance.php`)
- Event management → Events: manages events (evidence: `public/admin/events.php`)
- Recital management → Recital records: manages recitals (evidence: `public/admin/recitals.php`)
- Rank administration → Ranks and promotions: manages ranks
- User administration → User accounts: manages users
- Notification management → Notification records and reads: manages notifications (evidence: `public/admin/notifications.php`)
- Notification APIs → Notification records and reads: reads and updates (evidence: `public/api/get-notifications.php`)
- Navigation and notification UI → Notification records and reads: loads notifications (evidence: `public/includes/header.php`)
- Audit log viewer → Database access: reads audit logs (evidence: `public/admin/audit-logs.php`)
- Audit log APIs → Database access: clears logs (evidence: `public/api/clear-audit-logs.php`)
- Sessions and access control → User accounts: loads current user (evidence: `includes/auth.php`)
- Sessions and access control → Database access: writes audit records (evidence: `includes/auth.php`)
- Brigader records and promotions → Database access: queries records (evidence: `classes/Brigader.php`)
- Attendance records → Database access: queries records (evidence: `classes/Attendance.php`)
- Events → Database access: queries records (evidence: `classes/Event.php`)
- Recital records → Database access: queries records (evidence: `classes/Recital.php`)
- Ranks and promotions → Database access: queries records (evidence: `classes/Rank.php`)
- Notification records and reads → Database access: queries records (evidence: `classes/Notification.php`)
- User accounts → Database access: queries records (evidence: `classes/User.php`)
- Database access → MySQL: connects and queries (evidence: `classes/Database.php`)
- Notification management → Email notifications: sends email (evidence: `public/admin/notifications.php`)
