# jwaajh/jwa-management architecture

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

- Interactive diagram: https://gitdiagram.com/jwaajh/jwa-management
- Repository: https://github.com/jwaajh/jwa-management

## Overview

This is a multi-tenant quality, safety, and compliance management web application. Users enter through the client to work with operational registers and modules; server routes handle requests, with authentication, domain services, and persistence supporting them. The tree also shows health-and-safety records, notifications, file handling, and tenant backup/restore capabilities. Source excerpts are partial and there is no README, so links between client feature pages and server endpoints are left unverified rather than inferred.

Main entry points: [`server/routes.ts`](https://github.com/jwaajh/jwa-management/blob/main/server/routes.ts) (API routes), [`server/db.ts`](https://github.com/jwaajh/jwa-management/blob/main/server/db.ts) (PostgreSQL), [`server/backup-service.ts`](https://github.com/jwaajh/jwa-management/blob/main/server/backup-service.ts) (Tenant backup), [`client/src/App.tsx`](https://github.com/jwaajh/jwa-management/blob/main/client/src/App.tsx) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_client_app["Web application<br/>[App.tsx]"]
  node_feature_pages["Feature pages"]
  node_api_client["API client<br/>[queryClient.ts]"]
end

subgraph group_api["API and identity"]
  node_api_routes["API routes<br/>[routes.ts]"]
  node_auth["Local authentication<br/>[localAuth.ts]"]
  node_rate_limits["Rate limiting<br/>[rateLimiter.ts]"]
end

subgraph group_domains["Compliance domains"]
  node_hs_routes["Health-safety routes"]
  node_hs_service["Health-safety records"]
  node_ncr_qr["NCR QR workflows<br/>[ncr-qr-routes.ts]"]
  node_standards["Standards register"]
  node_notifications["Notification dispatch<br/>[run.ts]"]
end

subgraph group_platform["Persistence and operations"]
  node_notification_data["Notification repository<br/>[repository.ts]"]
  node_storage_routes["File endpoints<br/>[storage-routes.ts]"]
  node_malware_scan["Malware scanning<br/>[avScanner.ts]"]
  node_storage[("Tenant data and files<br/>[storage.ts]")]
  node_database[("PostgreSQL<br/>[db.ts]")]
  node_backup["Tenant backup<br/>[backup-service.ts]"]
  node_backup_slots["Backup concurrency"]
  node_hs_backup["Safety archive safeguards<br/>[hs-backup.ts]"]
  node_shared_schema["Shared data schema<br/>[schema.ts]"]
end

node_user(("User"))
node_http_service{{"HTTP service"}}

node_user -->|"uses"| node_client_app
node_client_app -->|"uses"| node_api_client
node_client_app -.->|"routes to"| node_feature_pages
node_api_client -->|"sends requests"| node_http_service
node_http_service -.->|"routes requests"| node_api_routes
node_api_routes -->|"uses"| node_auth
node_api_routes -->|"mounts"| node_hs_routes
node_api_routes -->|"mounts"| node_ncr_qr
node_api_routes -->|"mounts"| node_standards
node_api_routes -->|"mounts"| node_storage_routes
node_hs_routes -->|"calls"| node_hs_service
node_hs_routes -->|"reads users"| node_notification_data
node_storage_routes -->|"scans uploads"| node_malware_scan
node_storage_routes -->|"checks access"| node_hs_service
node_notifications -->|"reads records"| node_notification_data
node_notifications -.->|"sends email"| node_database
node_storage -->|"reads and writes"| node_database
node_notification_data -->|"queries"| node_database
node_backup -->|"backs up data"| node_database
node_backup -->|"claims slots"| node_backup_slots
node_backup -->|"preserves archives"| node_hs_backup
node_storage -->|"checks generation"| node_hs_backup
node_hs_service -->|"queries records"| node_database
node_auth -.->|"checks limits"| node_rate_limits

click node_client_app "https://github.com/jwaajh/jwa-management/blob/main/client/src/App.tsx"
click node_feature_pages "https://github.com/jwaajh/jwa-management/tree/main/client/src/pages"
click node_api_client "https://github.com/jwaajh/jwa-management/blob/main/client/src/lib/queryClient.ts"
click node_api_routes "https://github.com/jwaajh/jwa-management/blob/main/server/routes.ts"
click node_auth "https://github.com/jwaajh/jwa-management/blob/main/server/localAuth.ts"
click node_rate_limits "https://github.com/jwaajh/jwa-management/blob/main/server/rateLimiter.ts"
click node_hs_routes "https://github.com/jwaajh/jwa-management/blob/main/server/hs-module-routes.ts"
click node_hs_service "https://github.com/jwaajh/jwa-management/blob/main/server/hs-module-service.ts"
click node_ncr_qr "https://github.com/jwaajh/jwa-management/blob/main/server/ncr-qr-routes.ts"
click node_standards "https://github.com/jwaajh/jwa-management/blob/main/server/standards-register-routes.ts"
click node_notifications "https://github.com/jwaajh/jwa-management/blob/main/server/notifications/run.ts"
click node_notification_data "https://github.com/jwaajh/jwa-management/blob/main/server/notifications/repository.ts"
click node_storage_routes "https://github.com/jwaajh/jwa-management/blob/main/server/storage-routes.ts"
click node_malware_scan "https://github.com/jwaajh/jwa-management/blob/main/server/avScanner.ts"
click node_storage "https://github.com/jwaajh/jwa-management/blob/main/server/storage.ts"
click node_database "https://github.com/jwaajh/jwa-management/blob/main/server/db.ts"
click node_backup "https://github.com/jwaajh/jwa-management/blob/main/server/backup-service.ts"
click node_backup_slots "https://github.com/jwaajh/jwa-management/blob/main/server/backupConcurrency.ts"
click node_hs_backup "https://github.com/jwaajh/jwa-management/blob/main/server/hs-backup.ts"
click node_shared_schema "https://github.com/jwaajh/jwa-management/blob/main/shared/schema.ts"

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_client_app,node_feature_pages,node_api_client,node_user toneBlue
class node_api_routes,node_auth,node_rate_limits toneAmber
class node_hs_routes,node_hs_service,node_ncr_qr,node_standards,node_notifications toneMint
class node_notification_data,node_storage_routes,node_malware_scan,node_storage,node_database,node_backup,node_backup_slots,node_hs_backup,node_shared_schema toneRose
class node_http_service toneIndigo
```

## Components

### Client experience

- [Web application](https://github.com/jwaajh/jwa-management/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Feature pages](https://github.com/jwaajh/jwa-management/tree/main/client/src/pages): `client/src/pages`
- [API client](https://github.com/jwaajh/jwa-management/blob/main/client/src/lib/queryClient.ts): `client/src/lib/queryClient.ts`

### API and identity

- [API routes](https://github.com/jwaajh/jwa-management/blob/main/server/routes.ts): `server/routes.ts`
- [Local authentication](https://github.com/jwaajh/jwa-management/blob/main/server/localAuth.ts): `server/localAuth.ts`
- [Rate limiting](https://github.com/jwaajh/jwa-management/blob/main/server/rateLimiter.ts): `server/rateLimiter.ts`

### Compliance domains

- [Health-safety routes](https://github.com/jwaajh/jwa-management/blob/main/server/hs-module-routes.ts): `server/hs-module-routes.ts`
- [Health-safety records](https://github.com/jwaajh/jwa-management/blob/main/server/hs-module-service.ts): `server/hs-module-service.ts`
- [NCR QR workflows](https://github.com/jwaajh/jwa-management/blob/main/server/ncr-qr-routes.ts): `server/ncr-qr-routes.ts`
- [Standards register](https://github.com/jwaajh/jwa-management/blob/main/server/standards-register-routes.ts): `server/standards-register-routes.ts`
- [Notification dispatch](https://github.com/jwaajh/jwa-management/blob/main/server/notifications/run.ts): `server/notifications/run.ts`

### Persistence and operations

- [Notification repository](https://github.com/jwaajh/jwa-management/blob/main/server/notifications/repository.ts): `server/notifications/repository.ts`
- [File endpoints](https://github.com/jwaajh/jwa-management/blob/main/server/storage-routes.ts): `server/storage-routes.ts`
- [Malware scanning](https://github.com/jwaajh/jwa-management/blob/main/server/avScanner.ts): `server/avScanner.ts`
- [Tenant data and files](https://github.com/jwaajh/jwa-management/blob/main/server/storage.ts): `server/storage.ts`
- [PostgreSQL](https://github.com/jwaajh/jwa-management/blob/main/server/db.ts): `server/db.ts`
- [Tenant backup](https://github.com/jwaajh/jwa-management/blob/main/server/backup-service.ts): `server/backup-service.ts`
- [Backup concurrency](https://github.com/jwaajh/jwa-management/blob/main/server/backupConcurrency.ts): `server/backupConcurrency.ts`
- [Safety archive safeguards](https://github.com/jwaajh/jwa-management/blob/main/server/hs-backup.ts): `server/hs-backup.ts`
- [Shared data schema](https://github.com/jwaajh/jwa-management/blob/main/shared/schema.ts): `shared/schema.ts`

### Other components

- **User**
- **HTTP service**

## Connections

- User → Web application: uses
- Web application → API client: uses (evidence: `client/src/App.tsx`)
- Web application → Feature pages: routes to
- API client → HTTP service: sends requests (evidence: `client/src/lib/queryClient.ts`)
- HTTP service → API routes: routes requests
- API routes → Local authentication: uses (evidence: `server/routes.ts`)
- API routes → Health-safety routes: mounts (evidence: `server/routes.ts`)
- API routes → NCR QR workflows: mounts (evidence: `server/routes.ts`)
- API routes → Standards register: mounts (evidence: `server/routes.ts`)
- API routes → File endpoints: mounts (evidence: `server/routes.ts`)
- Health-safety routes → Health-safety records: calls (evidence: `server/hs-module-routes.ts`)
- Health-safety routes → Notification repository: reads users (evidence: `server/hs-module-routes.ts`)
- File endpoints → Malware scanning: scans uploads (evidence: `server/storage-routes.ts`)
- File endpoints → Health-safety records: checks access (evidence: `server/storage-routes.ts`)
- Notification dispatch → Notification repository: reads records (evidence: `server/notifications/run.ts`)
- Notification dispatch → PostgreSQL: sends email
- Tenant data and files → PostgreSQL: reads and writes (evidence: `server/storage.ts`)
- Notification repository → PostgreSQL: queries (evidence: `server/notifications/repository.ts`)
- Tenant backup → PostgreSQL: backs up data (evidence: `server/backup-service.ts`)
- Tenant backup → Backup concurrency: claims slots (evidence: `server/storage.ts`)
- Tenant backup → Safety archive safeguards: preserves archives (evidence: `server/backup-service.ts`)
- Tenant data and files → Safety archive safeguards: checks generation (evidence: `server/storage.ts`)
- Health-safety records → PostgreSQL: queries records (evidence: `server/hs-module-service.ts`)
- Local authentication → Rate limiting: checks limits (evidence: `server/localAuth.ts`)
