# falconbhai/admin-managment architecture

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

- Interactive diagram: https://gitdiagram.com/falconbhai/admin-managment
- Repository: https://github.com/falconbhai/admin-managment

## Overview

Supreme Portal is a PHP staff-management portal for roleplay communities. Personnel enter through password or Discord login, then use permission-gated interview and administration workflows; staff use the operational hub for roster, attendance, leave, salary, chat, and notifications. The admin dashboard covers question-bank and notice administration, while audit logging spans database, local files, and optional Sheets sync. The README documents several capabilities whose implementation was not sampled, so those links are shown only where the documented entry point supports them; internal wiring is otherwise limited to the excerpts.

Main entry points: [`auditlogs/index.php`](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/index.php) (Personnel hub), [`db.php`](https://github.com/falconbhai/admin-managment/blob/main/db.php) (Database connection), [`index.php`](https://github.com/falconbhai/admin-managment/blob/main/index.php) (Login gateway), [`audit_helper.php`](https://github.com/falconbhai/admin-managment/blob/main/audit_helper.php) (Audit logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and Access"]
  node_gateway["Login gateway<br/>[index.php]"]
  node_auth["Sessions and permissions<br/>[auth.php]"]
  node_discord_login["Discord OAuth callback"]
  node_discord_worker["Discord proxy"]
end

subgraph group_interview["Interview Operations"]
  node_interview_setup["Interview setup<br/>[setup.php]"]
  node_interview_session["Interview session<br/>[interview.php]"]
  node_admin["Supervisor dashboard<br/>[admin.php]"]
end

subgraph group_personnel["Personnel Operations"]
  node_portal["Personnel hub<br/>[index.php]"]
  node_roster["Roster and ranks<br/>[roster.php]"]
  node_attendance["Attendance<br/>[attendance.php]"]
  node_salary["Salary payouts<br/>[salary.php]"]
  node_leave["Leave requests<br/>[loa.php]"]
  node_chat["Staff chat<br/>[chat.php]"]
  node_notifications["Notifications<br/>[notifications.php]"]
end

subgraph group_services["Shared Services"]
  node_api["System action handler<br/>[api.php]"]
  node_chat_api["Chat handler<br/>[chat_api.php]"]
  node_db_layer["Database connection<br/>[db.php]"]
  node_mysql[("Portal database")]
  node_audit["Audit logging<br/>[audit_helper.php]"]
  node_sheets["Sheets synchronization"]
end

node_staff(("Staff member"))
node_supervisor(("Supervisor"))
node_google_sheets[("Google Sheets")]
node_discord["Discord API"]

node_staff -->|"signs in"| node_gateway
node_supervisor -->|"signs in"| node_gateway
node_gateway -->|"checks access"| node_auth
node_gateway -->|"queries"| node_db_layer
node_gateway -->|"logs login"| node_audit
node_gateway -.->|"starts OAuth"| node_discord_login
node_discord_login -.->|"requests proxy"| node_discord_worker
node_discord_worker -.->|"exchanges token"| node_discord
node_discord_login -.->|"resolves user"| node_db_layer
node_staff -->|"starts interview"| node_interview_setup
node_interview_setup -->|"begins session"| node_interview_session
node_supervisor -->|"manages portal"| node_admin
node_admin -->|"reads and writes"| node_db_layer
node_admin -->|"records actions"| node_audit
node_staff -->|"opens hub"| node_portal
node_portal -->|"checks permissions"| node_auth
node_portal -->|"loads modules"| node_db_layer
node_portal -->|"renders page"| node_roster
node_portal -->|"renders page"| node_attendance
node_portal -->|"renders page"| node_salary
node_portal -->|"renders page"| node_leave
node_portal -->|"renders page"| node_chat
node_portal -->|"renders page"| node_notifications
node_salary -->|"submits decisions"| node_api
node_chat -->|"sends requests"| node_chat_api
node_chat_api -->|"reads and writes"| node_db_layer
node_api -->|"updates records"| node_db_layer
node_db_layer -->|"queries"| node_mysql
node_audit -->|"stores events"| node_db_layer
node_audit -.->|"syncs events"| node_sheets
node_sheets -.->|"posts records"| node_google_sheets

click node_gateway "https://github.com/falconbhai/admin-managment/blob/main/index.php"
click node_auth "https://github.com/falconbhai/admin-managment/blob/main/auth.php"
click node_discord_login "https://github.com/falconbhai/admin-managment/blob/main/discord_callback.php"
click node_discord_worker "https://github.com/falconbhai/admin-managment/blob/main/cloudflare_worker.js"
click node_interview_setup "https://github.com/falconbhai/admin-managment/blob/main/setup.php"
click node_interview_session "https://github.com/falconbhai/admin-managment/blob/main/interview.php"
click node_admin "https://github.com/falconbhai/admin-managment/blob/main/admin.php"
click node_api "https://github.com/falconbhai/admin-managment/blob/main/api.php"
click node_portal "https://github.com/falconbhai/admin-managment/blob/main/auditlogs/index.php"
click node_roster "https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/roster.php"
click node_attendance "https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/attendance.php"
click node_salary "https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/salary.php"
click node_leave "https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/loa.php"
click node_chat "https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/chat.php"
click node_notifications "https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/notifications.php"
click node_chat_api "https://github.com/falconbhai/admin-managment/blob/main/chat_api.php"
click node_db_layer "https://github.com/falconbhai/admin-managment/blob/main/db.php"
click node_audit "https://github.com/falconbhai/admin-managment/blob/main/audit_helper.php"
click node_sheets "https://github.com/falconbhai/admin-managment/blob/main/google_sheets_helper.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_gateway,node_auth,node_discord_login,node_discord_worker toneBlue
class node_interview_setup,node_interview_session,node_admin,node_google_sheets toneAmber
class node_portal,node_roster,node_attendance,node_salary,node_leave,node_chat,node_notifications,node_discord toneMint
class node_api,node_chat_api,node_db_layer,node_mysql,node_audit,node_sheets toneRose
class node_staff,node_supervisor toneIndigo
```

## Components

### Entry and Access

- [Login gateway](https://github.com/falconbhai/admin-managment/blob/main/index.php): `index.php`
- [Sessions and permissions](https://github.com/falconbhai/admin-managment/blob/main/auth.php): `auth.php`
- [Discord OAuth callback](https://github.com/falconbhai/admin-managment/blob/main/discord_callback.php): `discord_callback.php`
- [Discord proxy](https://github.com/falconbhai/admin-managment/blob/main/cloudflare_worker.js): `cloudflare_worker.js`

### Interview Operations

- [Interview setup](https://github.com/falconbhai/admin-managment/blob/main/setup.php): `setup.php`
- [Interview session](https://github.com/falconbhai/admin-managment/blob/main/interview.php): `interview.php`
- [Supervisor dashboard](https://github.com/falconbhai/admin-managment/blob/main/admin.php): `admin.php`

### Personnel Operations

- [Personnel hub](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/index.php): `auditlogs/index.php`
- [Roster and ranks](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/roster.php): `auditlogs/modules/roster.php`
- [Attendance](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/attendance.php): `auditlogs/modules/attendance.php`
- [Salary payouts](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/salary.php): `auditlogs/modules/salary.php`
- [Leave requests](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/loa.php): `auditlogs/modules/loa.php`
- [Staff chat](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/chat.php): `auditlogs/modules/chat.php`
- [Notifications](https://github.com/falconbhai/admin-managment/blob/main/auditlogs/modules/notifications.php): `auditlogs/modules/notifications.php`

### Shared Services

- [System action handler](https://github.com/falconbhai/admin-managment/blob/main/api.php): `api.php`
- [Chat handler](https://github.com/falconbhai/admin-managment/blob/main/chat_api.php): `chat_api.php`
- [Database connection](https://github.com/falconbhai/admin-managment/blob/main/db.php): `db.php`
- **Portal database**
- [Audit logging](https://github.com/falconbhai/admin-managment/blob/main/audit_helper.php): `audit_helper.php`
- [Sheets synchronization](https://github.com/falconbhai/admin-managment/blob/main/google_sheets_helper.php): `google_sheets_helper.php`

### Other components

- **Staff member**
- **Supervisor**
- **Google Sheets**
- **Discord API**

## Connections

- Staff member → Login gateway: signs in
- Supervisor → Login gateway: signs in
- Login gateway → Sessions and permissions: checks access
- Login gateway → Database connection: queries
- Login gateway → Audit logging: logs login
- Login gateway → Discord OAuth callback: starts OAuth
- Discord OAuth callback → Discord proxy: requests proxy
- Discord proxy → Discord API: exchanges token
- Discord OAuth callback → Database connection: resolves user
- Staff member → Interview setup: starts interview
- Interview setup → Interview session: begins session
- Supervisor → Supervisor dashboard: manages portal
- Supervisor dashboard → Database connection: reads and writes
- Supervisor dashboard → Audit logging: records actions
- Staff member → Personnel hub: opens hub
- Personnel hub → Sessions and permissions: checks permissions
- Personnel hub → Database connection: loads modules
- Personnel hub → Roster and ranks: renders page
- Personnel hub → Attendance: renders page
- Personnel hub → Salary payouts: renders page
- Personnel hub → Leave requests: renders page
- Personnel hub → Staff chat: renders page
- Personnel hub → Notifications: renders page
- Salary payouts → System action handler: submits decisions
- Staff chat → Chat handler: sends requests
- Chat handler → Database connection: reads and writes
- System action handler → Database connection: updates records
- Database connection → Portal database: queries
- Audit logging → Database connection: stores events
- Audit logging → Sheets synchronization: syncs events
- Sheets synchronization → Google Sheets: posts records
