# gerobankenz-beep/security-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/gerobankenz-beep/security-management-system
- Repository: https://github.com/gerobankenz-beep/security-management-system

## Overview

SM-SYS is a security-guard operations platform: staff use a web console to manage sites, staffing, attendance, incidents and business reporting, while guards use a mobile app for shifts and checkpoint scans. The backend provides authenticated, role-restricted API modules backed by PostgreSQL. The graph preserves the principal operational domains and the mobile sync path. Evidence is limited to the supplied excerpts and SOURCE INDEX; unsampled runtime connections are omitted rather than inferred.

Main entry points: [`mobile/App.js`](https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/App.js) (Mobile navigation), [`backend/src/utils/response.js`](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/utils/response.js) (API response helpers), [`backend/src/modules/sites/routes.js`](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/modules/sites/routes.js) (Clients and sites), [`backend/src/modules/auth/routes.js`](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/modules/auth/routes.js) (Authentication and users)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web console"]
  node_webapp["Web routing<br/>[App.jsx]"]
  node_webpages["Operations pages"]
  node_webclients["Client management<br/>[Clients.jsx]"]
  node_webauth["Web authentication<br/>[AuthContext.jsx]"]
  node_webapi["Web API access"]
end

subgraph group_mobile["Guard mobile"]
  node_mobileapp["Mobile navigation<br/>[App.js]"]
  node_mobilescreens["Shift and scan"]
  node_mobileauth["Mobile authentication<br/>[AuthContext.jsx]"]
  node_mobilesync["Offline sync<br/>[SyncContext.jsx]"]
  node_mobileapi["Mobile API client<br/>[client.js]"]
end

subgraph group_backend["Operations API"]
  node_backendapp["API application<br/>[app.js]"]
  node_authroutes["Authentication and users<br/>[routes.js]"]
  node_sites["Clients and sites<br/>[routes.js]"]
  node_rosters["Roster planning"]
  node_attendance["Attendance tracking"]
  node_patrol["Patrol rounds"]
  node_incidents["Incidents and anomalies"]
  node_workforce["Guards and payroll"]
  node_insights["Dashboard and reports"]
end

subgraph group_shared["Platform services"]
  node_db[("PostgreSQL<br/>[db.js]")]
  node_middleware["Request controls"]
  node_responses["API response helpers<br/>[response.js]"]
end

node_staff(("Staff and clients"))
node_guards(("Guards"))

node_staff -->|"uses"| node_webapp
node_guards -->|"uses"| node_mobileapp
node_webapp -->|"routes to"| node_webpages
node_webpages -->|"includes"| node_webclients
node_webclients -->|"calls client APIs"| node_webapi
node_webauth -->|"uses"| node_webapi
node_mobileapp -->|"provides auth"| node_mobileauth
node_mobileapp -->|"provides sync"| node_mobilesync
node_mobileapp -->|"navigates to"| node_mobilescreens
node_mobileauth -->|"uses endpoints"| node_mobileapi
node_mobilesync -->|"submits sync"| node_mobileapi
node_backendapp -.->|"mounts routes"| node_authroutes
node_sites -->|"queries"| node_db
node_sites -->|"checks access"| node_middleware
node_sites -->|"formats results"| node_responses
node_authroutes -->|"uses controls"| node_middleware
node_authroutes -->|"formats results"| node_responses
node_rosters -->|"queries"| node_db
node_attendance -->|"formats results"| node_responses
node_patrol -->|"uses controls"| node_middleware
node_incidents -->|"queries"| node_db
node_workforce -->|"formats results"| node_responses
node_insights -->|"shown in"| node_webpages

click node_webapp "https://github.com/gerobankenz-beep/security-management-system/blob/main/web/src/App.jsx"
click node_webpages "https://github.com/gerobankenz-beep/security-management-system/tree/main/web/src/pages"
click node_webclients "https://github.com/gerobankenz-beep/security-management-system/blob/main/web/src/pages/Clients.jsx"
click node_webauth "https://github.com/gerobankenz-beep/security-management-system/blob/main/web/src/auth/AuthContext.jsx"
click node_webapi "https://github.com/gerobankenz-beep/security-management-system/tree/main/web/src/api"
click node_mobileapp "https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/App.js"
click node_mobilescreens "https://github.com/gerobankenz-beep/security-management-system/tree/main/mobile/src/screens"
click node_mobileauth "https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/src/auth/AuthContext.jsx"
click node_mobilesync "https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/src/sync/SyncContext.jsx"
click node_mobileapi "https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/src/api/client.js"
click node_backendapp "https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/app.js"
click node_authroutes "https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/modules/auth/routes.js"
click node_sites "https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/modules/sites/routes.js"
click node_rosters "https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/roster"
click node_attendance "https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/attendance"
click node_patrol "https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/patrol"
click node_incidents "https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/incidents"
click node_workforce "https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/guards"
click node_insights "https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/dashboard"
click node_db "https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/config/db.js"
click node_middleware "https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/middleware"
click node_responses "https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/utils/response.js"

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_webapp,node_webpages,node_webclients,node_webauth,node_webapi,node_staff toneBlue
class node_mobileapp,node_mobilescreens,node_mobileauth,node_mobilesync,node_mobileapi toneAmber
class node_backendapp,node_authroutes,node_sites,node_rosters,node_attendance,node_patrol,node_incidents,node_workforce,node_insights toneMint
class node_db,node_middleware,node_responses toneRose
class node_guards toneIndigo
```

## Components

### Web console

- [Web routing](https://github.com/gerobankenz-beep/security-management-system/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Operations pages](https://github.com/gerobankenz-beep/security-management-system/tree/main/web/src/pages): `web/src/pages`
- [Client management](https://github.com/gerobankenz-beep/security-management-system/blob/main/web/src/pages/Clients.jsx): `web/src/pages/Clients.jsx`
- [Web authentication](https://github.com/gerobankenz-beep/security-management-system/blob/main/web/src/auth/AuthContext.jsx): `web/src/auth/AuthContext.jsx`
- [Web API access](https://github.com/gerobankenz-beep/security-management-system/tree/main/web/src/api): `web/src/api`

### Guard mobile

- [Mobile navigation](https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/App.js): `mobile/App.js`
- [Shift and scan](https://github.com/gerobankenz-beep/security-management-system/tree/main/mobile/src/screens): `mobile/src/screens`
- [Mobile authentication](https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/src/auth/AuthContext.jsx): `mobile/src/auth/AuthContext.jsx`
- [Offline sync](https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/src/sync/SyncContext.jsx): `mobile/src/sync/SyncContext.jsx`
- [Mobile API client](https://github.com/gerobankenz-beep/security-management-system/blob/main/mobile/src/api/client.js): `mobile/src/api/client.js`

### Operations API

- [API application](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication and users](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/modules/auth/routes.js): `backend/src/modules/auth/routes.js`
- [Clients and sites](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/modules/sites/routes.js): `backend/src/modules/sites/routes.js`
- [Roster planning](https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/roster): `backend/src/modules/roster`
- [Attendance tracking](https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/attendance): `backend/src/modules/attendance`
- [Patrol rounds](https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/patrol): `backend/src/modules/patrol`
- [Incidents and anomalies](https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/incidents): `backend/src/modules/incidents`
- [Guards and payroll](https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/guards): `backend/src/modules/guards`
- [Dashboard and reports](https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/modules/dashboard): `backend/src/modules/dashboard`

### Platform services

- [PostgreSQL](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [Request controls](https://github.com/gerobankenz-beep/security-management-system/tree/main/backend/src/middleware): `backend/src/middleware`
- [API response helpers](https://github.com/gerobankenz-beep/security-management-system/blob/main/backend/src/utils/response.js): `backend/src/utils/response.js`

### Other components

- **Staff and clients**
- **Guards**

## Connections

- Staff and clients → Web routing: uses (evidence: `web/src/App.jsx`)
- Guards → Mobile navigation: uses (evidence: `mobile/App.js`)
- Web routing → Operations pages: routes to (evidence: `web/src/App.jsx`)
- Operations pages → Client management: includes (evidence: `web/src/App.jsx`)
- Client management → Web API access: calls client APIs (evidence: `web/src/pages/Clients.jsx`)
- Web authentication → Web API access: uses (evidence: `web/src/auth/AuthContext.jsx`)
- Mobile navigation → Mobile authentication: provides auth (evidence: `mobile/App.js`)
- Mobile navigation → Offline sync: provides sync (evidence: `mobile/App.js`)
- Mobile navigation → Shift and scan: navigates to (evidence: `mobile/App.js`)
- Mobile authentication → Mobile API client: uses endpoints (evidence: `mobile/src/auth/AuthContext.jsx`)
- Offline sync → Mobile API client: submits sync (evidence: `mobile/src/sync/SyncContext.jsx`)
- API application → Authentication and users: mounts routes
- Clients and sites → PostgreSQL: queries (evidence: `backend/src/modules/sites/routes.js`)
- Clients and sites → Request controls: checks access (evidence: `backend/src/modules/sites/routes.js`)
- Clients and sites → API response helpers: formats results (evidence: `backend/src/modules/sites/routes.js`)
- Authentication and users → Request controls: uses controls (evidence: `backend/src/modules/auth/routes.js`)
- Authentication and users → API response helpers: formats results (evidence: `backend/src/modules/auth/routes.js`)
- Roster planning → PostgreSQL: queries (evidence: `backend/src/modules/roster/routes.js`)
- Attendance tracking → API response helpers: formats results (evidence: `backend/src/modules/attendance/routes.js`)
- Patrol rounds → Request controls: uses controls (evidence: `backend/src/modules/patrol/routes.js`)
- Incidents and anomalies → PostgreSQL: queries (evidence: `backend/src/modules/incidents/routes.js`)
- Guards and payroll → API response helpers: formats results (evidence: `backend/src/modules/guards/routes.js`)
- Dashboard and reports → Operations pages: shown in
