# tharns1999-cmyk/qms_latest architecture

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

- Interactive diagram: https://gitdiagram.com/tharns1999-cmyk/qms_latest
- Repository: https://github.com/tharns1999-cmyk/qms_latest

## Overview

QMS Portal is a modular ISO 9001 quality-management application with DCC document control, VCC calibration/verification, and system administration. Users enter through the web app, authenticate and navigate module routes, then perform document, review, task, or calibration workflows; the web client can communicate with a Cloudflare Workers API backed by D1 and R2. The graph preserves documented periodic-review, controlled-document, VCC planning/work-order, notification, and governance capabilities. Some frontend-to-backend wiring is not visible in the excerpts, so those links are marked unverified.

Main entry points: [`apps/web/src/app/App.jsx`](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/app/App.jsx) (App routes), [`apps/api/src/vcc.js`](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vcc.js) (VCC route dispatch), [`apps/web/src/api/client.js`](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/api/client.js) (API client), [`apps/web/src/modules/dcc/pages/Tasks/TaskReview.jsx`](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/pages/Tasks/TaskReview.jsx) (Review and task workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Portal and access"]
  node_app["App routes<br/>[App.jsx]"]
  node_portal["Module portal"]
  node_adminui["Governance admin"]
end

subgraph group_dcc["Document control"]
  node_dccdocs["Document control<br/>[DarNewForm.jsx]"]
  node_dcctasks["Review and task workflow<br/>[TaskReview.jsx]"]
  node_dccperiodic["Periodic reviews"]
  node_dccservices["Review scheduling"]
  node_dccmaster["Master data and distribution"]
  node_dccfiles["Document file storage<br/>[fileStorage.js]"]
  node_dccadmin["DCC administration<br/>[MasterDataHub.jsx]"]
end

subgraph group_vcc["Calibration center"]
  node_vccui["VCC interface"]
end

subgraph group_backend["API and governance"]
  node_vccapi["VCC route dispatch<br/>[vcc.js]"]
  node_vccplans["Plans and approvals<br/>[vccPlans.js]"]
  node_vccorders["Work orders<br/>[vccWorkOrders.js]"]
  node_vccdash["VCC dashboard<br/>[vccDashboard.js]"]
  node_vccnotify["Notifications"]
  node_vccauth["VCC access control<br/>[vccAuth.js]"]
  node_governance["Module governance API"]
  node_api["API entry and DCC<br/>[index.js]"]
  node_db[("D1 database")]
  node_r2[("R2 file storage")]
end

subgraph group_shared["Shared state and services"]
  node_webclient["API client<br/>[client.js]"]
  node_store["Application state<br/>[useStore.js]"]
end

node_user(("Portal user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_portal
node_app -->|"routes to"| node_adminui
node_app -->|"reads state"| node_store
node_app -->|"routes to"| node_dccdocs
node_app -->|"routes to"| node_dcctasks
node_app -->|"initializes"| node_dccperiodic
node_app -->|"routes to"| node_vccui
node_dcctasks -->|"uses files"| node_dccfiles
node_dcctasks -->|"uses master data"| node_dccmaster
node_dccperiodic -->|"generates schedules"| node_dccservices
node_dccservices -.->|"normalizes domain"| node_dccmaster
node_dccfiles -->|"fetches file"| node_webclient
node_dccadmin -.->|"calls API"| node_webclient
node_webclient -.->|"sends requests"| node_api
node_vccui -.->|"calls API"| node_webclient
node_api -->|"dispatches governance"| node_governance
node_api -->|"dispatches VCC"| node_vccapi
node_governance -->|"uses access rules"| node_vccauth
node_vccapi -->|"dispatches plans"| node_vccplans
node_vccapi -->|"dispatches work orders"| node_vccorders
node_vccapi -->|"dispatches dashboard"| node_vccdash
node_vccapi -->|"dispatches notifications"| node_vccnotify
node_vccplans -->|"fetches tasks"| node_vccnotify
node_vccplans -.->|"queries data"| node_db
node_vccorders -.->|"persists records"| node_db
node_vccnotify -->|"queries alerts"| node_db
node_vccapi -.->|"checks access"| node_vccauth
node_dccfiles -.->|"retrieves files"| node_r2

click node_app "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/app/App.jsx"
click node_portal "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/portal/pages/PortalLandingPage.jsx"
click node_adminui "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/admin/pages/ModuleGovernancePage.jsx"
click node_webclient "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/api/client.js"
click node_store "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/store/useStore.js"
click node_dccdocs "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/pages/DarWorkflow/DarNewForm.jsx"
click node_dcctasks "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/pages/Tasks/TaskReview.jsx"
click node_dccperiodic "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/store/periodicReviewSlice.js"
click node_dccservices "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/services/PeriodicReviewService.js"
click node_dccmaster "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/services/MasterDataService.js"
click node_dccfiles "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/utils/fileStorage.js"
click node_dccadmin "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/pages/Admin/MasterDataHub.jsx"
click node_vccui "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/vcc/pages/AssetRegisterPage.jsx"
click node_vccapi "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vcc.js"
click node_vccplans "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccPlans.js"
click node_vccorders "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccWorkOrders.js"
click node_vccdash "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccDashboard.js"
click node_vccnotify "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccNotifications.js"
click node_vccauth "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccAuth.js"
click node_governance "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/moduleGovernance.js"
click node_api "https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/index.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_portal,node_adminui,node_user toneBlue
class node_dccdocs,node_dcctasks,node_dccperiodic,node_dccservices,node_dccmaster,node_dccfiles,node_dccadmin toneAmber
class node_vccui toneMint
class node_vccapi,node_vccplans,node_vccorders,node_vccdash,node_vccnotify,node_vccauth,node_governance,node_api,node_db,node_r2 toneRose
class node_webclient,node_store toneIndigo
```

## Components

### Portal and access

- [App routes](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/app/App.jsx): `apps/web/src/app/App.jsx`
- [Module portal](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/portal/pages/PortalLandingPage.jsx): `apps/web/src/modules/portal/pages/PortalLandingPage.jsx`
- [Governance admin](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/admin/pages/ModuleGovernancePage.jsx): `apps/web/src/modules/admin/pages/ModuleGovernancePage.jsx`

### Document control

- [Document control](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/pages/DarWorkflow/DarNewForm.jsx): `apps/web/src/modules/dcc/pages/DarWorkflow/DarNewForm.jsx`
- [Review and task workflow](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/pages/Tasks/TaskReview.jsx): `apps/web/src/modules/dcc/pages/Tasks/TaskReview.jsx`
- [Periodic reviews](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/store/periodicReviewSlice.js): `apps/web/src/modules/dcc/store/periodicReviewSlice.js`
- [Review scheduling](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/services/PeriodicReviewService.js): `apps/web/src/modules/dcc/services/PeriodicReviewService.js`
- [Master data and distribution](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/services/MasterDataService.js): `apps/web/src/modules/dcc/services/MasterDataService.js`
- [Document file storage](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/utils/fileStorage.js): `apps/web/src/modules/dcc/utils/fileStorage.js`
- [DCC administration](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/dcc/pages/Admin/MasterDataHub.jsx): `apps/web/src/modules/dcc/pages/Admin/MasterDataHub.jsx`

### Calibration center

- [VCC interface](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/modules/vcc/pages/AssetRegisterPage.jsx): `apps/web/src/modules/vcc/pages/AssetRegisterPage.jsx`

### API and governance

- [VCC route dispatch](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vcc.js): `apps/api/src/vcc.js`
- [Plans and approvals](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccPlans.js): `apps/api/src/vccPlans.js`
- [Work orders](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccWorkOrders.js): `apps/api/src/vccWorkOrders.js`
- [VCC dashboard](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccDashboard.js): `apps/api/src/vccDashboard.js`
- [Notifications](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccNotifications.js): `apps/api/src/vccNotifications.js`
- [VCC access control](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/vccAuth.js): `apps/api/src/vccAuth.js`
- [Module governance API](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/moduleGovernance.js): `apps/api/src/moduleGovernance.js`
- [API entry and DCC](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/api/src/index.js): `apps/api/src/index.js`
- **D1 database**
- **R2 file storage**

### Shared state and services

- [API client](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/api/client.js): `apps/web/src/api/client.js`
- [Application state](https://github.com/tharns1999-cmyk/qms_latest/blob/develop/apps/web/src/store/useStore.js): `apps/web/src/store/useStore.js`

### Other components

- **Portal user**

## Connections

- Portal user → App routes: uses (evidence: `README.md`)
- App routes → Module portal: routes to (evidence: `apps/web/src/app/App.jsx`)
- App routes → Governance admin: routes to (evidence: `apps/web/src/app/App.jsx`)
- App routes → Application state: reads state (evidence: `apps/web/src/app/App.jsx`)
- App routes → Document control: routes to (evidence: `apps/web/src/app/App.jsx`)
- App routes → Review and task workflow: routes to (evidence: `apps/web/src/app/App.jsx`)
- App routes → Periodic reviews: initializes (evidence: `apps/web/src/app/App.jsx`)
- App routes → VCC interface: routes to (evidence: `apps/web/src/app/App.jsx`)
- Review and task workflow → Document file storage: uses files (evidence: `apps/web/src/modules/dcc/pages/Tasks/TaskReview.jsx`)
- Review and task workflow → Master data and distribution: uses master data (evidence: `apps/web/src/modules/dcc/pages/Tasks/TaskReview.jsx`)
- Periodic reviews → Review scheduling: generates schedules (evidence: `apps/web/src/modules/dcc/store/periodicReviewSlice.js`)
- Review scheduling → Master data and distribution: normalizes domain
- Document file storage → API client: fetches file (evidence: `apps/web/src/modules/dcc/utils/fileStorage.js`)
- DCC administration → API client: calls API
- API client → API entry and DCC: sends requests
- VCC interface → API client: calls API
- API entry and DCC → Module governance API: dispatches governance (evidence: `apps/api/src/index.js`)
- API entry and DCC → VCC route dispatch: dispatches VCC (evidence: `apps/api/src/index.js`)
- Module governance API → VCC access control: uses access rules (evidence: `apps/api/src/moduleGovernance.js`)
- VCC route dispatch → Plans and approvals: dispatches plans (evidence: `apps/api/src/vcc.js`)
- VCC route dispatch → Work orders: dispatches work orders (evidence: `apps/api/src/vcc.js`)
- VCC route dispatch → VCC dashboard: dispatches dashboard (evidence: `apps/api/src/vcc.js`)
- VCC route dispatch → Notifications: dispatches notifications (evidence: `apps/api/src/vcc.js`)
- Plans and approvals → Notifications: fetches tasks (evidence: `apps/api/src/vccPlans.js`)
- Plans and approvals → D1 database: queries data
- Work orders → D1 database: persists records
- Notifications → D1 database: queries alerts (evidence: `apps/api/src/vccNotifications.js`)
- VCC route dispatch → VCC access control: checks access (evidence: `apps/api/src/vcc.js`)
- Document file storage → R2 file storage: retrieves files
