# riemarseruelas/work-force architecture

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

- Interactive diagram: https://gitdiagram.com/riemarseruelas/work-force
- Repository: https://github.com/riemarseruelas/work-force

## Overview

This is a passcode-protected workforce monitoring dashboard. Authorized personnel review workforce totals and scans, then investigate daily attendance, compliance, population, and site-area distribution; administrators can configure map assignments. React pages use a shared Zustand store for workforce data requests and refresh checks, while the Express backend serves the API and uses PostgreSQL plus the People Accounting REST API. The README documents the backend integrations; some backend internals and page-to-store calls are not shown in source excerpts, so the graph avoids inferring their detailed implementation.

Main entry points: [`src/App.jsx`](https://github.com/riemarseruelas/work-force/blob/main/src/App.jsx) (App routing), [`server.js`](https://github.com/riemarseruelas/work-force/blob/main/server.js) (Workforce API), [`src/store/useWorkforceStore.js`](https://github.com/riemarseruelas/work-force/blob/main/src/store/useWorkforceStore.js) (Workforce data store), [`src/components/AppShell.jsx`](https://github.com/riemarseruelas/work-force/blob/main/src/components/AppShell.jsx) (Dashboard shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and navigation"]
  node_app["App routing<br/>[App.jsx]"]
  node_passcode["Passcode access<br/>[PasscodePage.jsx]"]
  node_routeguard["Route protection<br/>[ProtectedRoute.jsx]"]
  node_shell["Dashboard shell<br/>[AppShell.jsx]"]
end

subgraph group_monitoring["Workforce monitoring"]
  node_overview["Workforce overview"]
  node_daily["Daily attendance"]
  node_compliance["Compliance review"]
  node_population["Population summaries"]
  node_map["Site workforce map"]
end

subgraph group_configuration["Map administration"]
  node_shortcut["Map shortcut"]
  node_admin["Map assignments"]
end

subgraph group_services["Data services"]
  node_store["Workforce data store"]
  node_backend["Workforce API<br/>[server.js]"]
  node_postgres[("PostgreSQL")]
  node_peopleapi["People Accounting API"]
end

node_personnel(("Authorized personnel"))

node_personnel -->|"opens dashboard"| node_app
node_app -->|"routes to"| node_passcode
node_app -->|"protects pages"| node_routeguard
node_app -->|"routes to"| node_overview
node_app -->|"routes to"| node_daily
node_app -->|"routes to"| node_compliance
node_app -->|"routes to"| node_population
node_app -->|"routes to"| node_map
node_app -->|"routes to"| node_admin
node_app -->|"requests usage log"| node_backend
node_app -->|"requests warmup"| node_backend
node_overview -->|"renders in"| node_shell
node_daily -->|"renders in"| node_shell
node_compliance -->|"renders in"| node_shell
node_population -->|"renders in"| node_shell
node_map -->|"renders in"| node_shell
node_shell -->|"checks for updates"| node_store
node_overview -->|"reads workforce data"| node_store
node_daily -->|"reads and fetches records"| node_store
node_compliance -->|"reads compliance data"| node_store
node_population -->|"fetches population"| node_store
node_map -->|"reads map data"| node_store
node_store -->|"requests workforce data"| node_backend
node_backend -->|"reads and writes"| node_postgres
node_backend -->|"retrieves scan data"| node_peopleapi
node_map -->|"shows configuration shortcut"| node_shortcut
node_shortcut -->|"navigates to"| node_admin
node_admin -->|"updates map assignments"| node_backend
node_passcode -.->|"validates passcode"| node_backend

click node_app "https://github.com/riemarseruelas/work-force/blob/main/src/App.jsx"
click node_passcode "https://github.com/riemarseruelas/work-force/blob/main/src/pages/PasscodePage.jsx"
click node_routeguard "https://github.com/riemarseruelas/work-force/blob/main/src/components/ProtectedRoute.jsx"
click node_shell "https://github.com/riemarseruelas/work-force/blob/main/src/components/AppShell.jsx"
click node_shortcut "https://github.com/riemarseruelas/work-force/blob/main/src/components/AdminMapShortcut.jsx"
click node_overview "https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceDashboardPage.jsx"
click node_daily "https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceDailyRecordPage.jsx"
click node_compliance "https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceCompliancePage.jsx"
click node_population "https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforcePopulationPage.jsx"
click node_map "https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceMapPage.jsx"
click node_admin "https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceAdminPage.jsx"
click node_store "https://github.com/riemarseruelas/work-force/blob/main/src/store/useWorkforceStore.js"
click node_backend "https://github.com/riemarseruelas/work-force/blob/main/server.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_app,node_passcode,node_routeguard,node_shell toneBlue
class node_overview,node_daily,node_compliance,node_population,node_map toneAmber
class node_shortcut,node_admin toneMint
class node_store,node_backend,node_postgres,node_peopleapi toneRose
class node_personnel toneIndigo
```

## Components

### Access and navigation

- [App routing](https://github.com/riemarseruelas/work-force/blob/main/src/App.jsx): `src/App.jsx`
- [Passcode access](https://github.com/riemarseruelas/work-force/blob/main/src/pages/PasscodePage.jsx): `src/pages/PasscodePage.jsx`
- [Route protection](https://github.com/riemarseruelas/work-force/blob/main/src/components/ProtectedRoute.jsx): `src/components/ProtectedRoute.jsx`
- [Dashboard shell](https://github.com/riemarseruelas/work-force/blob/main/src/components/AppShell.jsx): `src/components/AppShell.jsx`

### Workforce monitoring

- [Workforce overview](https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceDashboardPage.jsx): `src/pages/WorkforceDashboardPage.jsx`
- [Daily attendance](https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceDailyRecordPage.jsx): `src/pages/WorkforceDailyRecordPage.jsx`
- [Compliance review](https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceCompliancePage.jsx): `src/pages/WorkforceCompliancePage.jsx`
- [Population summaries](https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforcePopulationPage.jsx): `src/pages/WorkforcePopulationPage.jsx`
- [Site workforce map](https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceMapPage.jsx): `src/pages/WorkforceMapPage.jsx`

### Map administration

- [Map shortcut](https://github.com/riemarseruelas/work-force/blob/main/src/components/AdminMapShortcut.jsx): `src/components/AdminMapShortcut.jsx`
- [Map assignments](https://github.com/riemarseruelas/work-force/blob/main/src/pages/WorkforceAdminPage.jsx): `src/pages/WorkforceAdminPage.jsx`

### Data services

- [Workforce data store](https://github.com/riemarseruelas/work-force/blob/main/src/store/useWorkforceStore.js): `src/store/useWorkforceStore.js`
- [Workforce API](https://github.com/riemarseruelas/work-force/blob/main/server.js): `server.js`
- **PostgreSQL**
- **People Accounting API**

### Other components

- **Authorized personnel**

## Connections

- Authorized personnel → App routing: opens dashboard (evidence: `README.md`)
- App routing → Passcode access: routes to (evidence: `src/App.jsx`)
- App routing → Route protection: protects pages (evidence: `src/App.jsx`)
- App routing → Workforce overview: routes to (evidence: `src/App.jsx`)
- App routing → Daily attendance: routes to (evidence: `src/App.jsx`)
- App routing → Compliance review: routes to (evidence: `src/App.jsx`)
- App routing → Population summaries: routes to (evidence: `src/App.jsx`)
- App routing → Site workforce map: routes to (evidence: `src/App.jsx`)
- App routing → Map assignments: routes to (evidence: `src/App.jsx`)
- App routing → Workforce API: requests usage log (evidence: `src/App.jsx`)
- App routing → Workforce API: requests warmup (evidence: `src/App.jsx`)
- Workforce overview → Dashboard shell: renders in (evidence: `src/pages/WorkforceDashboardPage.jsx`)
- Daily attendance → Dashboard shell: renders in (evidence: `src/pages/WorkforceDailyRecordPage.jsx`)
- Compliance review → Dashboard shell: renders in (evidence: `src/pages/WorkforceCompliancePage.jsx`)
- Population summaries → Dashboard shell: renders in (evidence: `src/pages/WorkforcePopulationPage.jsx`)
- Site workforce map → Dashboard shell: renders in (evidence: `src/pages/WorkforceMapPage.jsx`)
- Dashboard shell → Workforce data store: checks for updates (evidence: `src/components/AppShell.jsx`)
- Workforce overview → Workforce data store: reads workforce data (evidence: `src/pages/WorkforceDashboardPage.jsx`)
- Daily attendance → Workforce data store: reads and fetches records (evidence: `src/pages/WorkforceDailyRecordPage.jsx`)
- Compliance review → Workforce data store: reads compliance data (evidence: `src/pages/WorkforceCompliancePage.jsx`)
- Population summaries → Workforce data store: fetches population (evidence: `src/pages/WorkforcePopulationPage.jsx`)
- Site workforce map → Workforce data store: reads map data (evidence: `src/pages/WorkforceMapPage.jsx`)
- Workforce data store → Workforce API: requests workforce data (evidence: `src/store/useWorkforceStore.js`)
- Workforce API → PostgreSQL: reads and writes (evidence: `README.md`)
- Workforce API → People Accounting API: retrieves scan data (evidence: `README.md`)
- Site workforce map → Map shortcut: shows configuration shortcut (evidence: `src/components/AdminMapShortcut.jsx`)
- Map shortcut → Map assignments: navigates to (evidence: `src/components/AdminMapShortcut.jsx`)
- Map assignments → Workforce API: updates map assignments (evidence: `src/pages/WorkforceAdminPage.jsx`)
- Passcode access → Workforce API: validates passcode
