# tharns1999-cmyk/qms-portal_newversion architecture

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

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

## Overview

This repository appears to be a document-control application: users manage controlled documents, route document action requests (DARs) for review and approval, and handle periodic reviews and controlled copies. The React app routes users to these workflows and keeps application state in a persisted Zustand store; a separate Express backend exposes controlled-copy operations. The README is only a Vite template and documents no product capabilities. Several routes and services are unsampled, so those branches are included from the tree, while edges are limited to relationships evidenced by excerpts or the SOURCE INDEX.

Main entry points: [`src/App.jsx`](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/App.jsx) (React application), [`src/store/useStore.js`](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/store/useStore.js) (Workflow state), [`backend/index.js`](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/index.js) (HTTP API and reports), [`src/services/PeriodicReviewService.js`](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/PeriodicReviewService.js) (Schedule and task rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_app["React application<br/>[App.jsx]"]
  node_layout["Navigation shell<br/>[Layout.jsx]"]
  node_auth["Route access<br/>[ProtectedRoute.jsx]"]
  node_store[("Workflow state<br/>[useStore.js]")]
  node_sla["SLA lifecycle timer<br/>[SLAEngine.jsx]"]
  node_dashboard["Operations dashboard<br/>[Dashboard.jsx]"]
end

subgraph group_dar["Document Actions"]
  node_darforms["DAR authoring<br/>[DarNewForm.jsx]"]
  node_darrevision["DAR revision and obsolescence"]
  node_taskinbox["Task inbox<br/>[TaskInbox.jsx]"]
  node_taskreview["Task review<br/>[TaskReview.jsx]"]
  node_reviewmodal["DAR inspection<br/>[DarReviewModal.jsx]"]
  node_workflow["Reviewer resolution"]
end

subgraph group_reviews["Periodic Reviews"]
  node_reviewdash["Review dashboard"]
  node_reviewtasks["My review tasks<br/>[MyReviewTasks.jsx]"]
  node_reviewdetail["Review detail"]
  node_reviewservice["Schedule and task rules"]
  node_reviewaccess["Review permissions"]
  node_darlink["Review-to-DAR linkage"]
end

subgraph group_library["Document Control"]
  node_library["Document library<br/>[Library.jsx]"]
  node_controlled["Controlled-copy register"]
  node_externaldocs["External documents"]
  node_masterdata["Master data administration<br/>[MasterDataHub.jsx]"]
  node_watermark["PDF watermarking"]
end

subgraph group_server["Controlled Copy Backend"]
  node_backend["HTTP API and reports<br/>[index.js]"]
  node_ccnumbers["Copy number allocation<br/>[CcNumberService.js]"]
  node_pdfservice["Copy PDF issuance<br/>[PdfService.js]"]
  node_replacement["Copy replacement"]
  node_stamper["PDF stamping<br/>[PdfStamper.js]"]
  node_effectivejob["Effective-date job"]
  node_recalljob["Recall escalation job"]
end

node_user(("Staff user"))
node_pg[("PostgreSQL")]

node_user -->|"uses"| node_app
node_app -->|"routes through"| node_layout
node_app -->|"mounts"| node_sla
node_app -->|"initializes reviews"| node_store
node_app -->|"guards routes"| node_auth
node_auth -->|"reads user state"| node_store
node_sla -->|"checks SLA"| node_store
node_app -->|"routes to"| node_darforms
node_app -->|"routes to"| node_darrevision
node_app -->|"routes to"| node_taskinbox
node_app -->|"routes to"| node_taskreview
node_taskreview -->|"renders"| node_reviewmodal
node_taskreview -->|"reads and updates"| node_store
node_store -->|"resolves reviewers"| node_workflow
node_user -->|"opens"| node_reviewdash
node_reviewdash -->|"checks access"| node_reviewaccess
node_reviewdash -->|"uses schedules"| node_reviewservice
node_reviewdash -->|"opens detail"| node_reviewdetail
node_reviewtasks -->|"uses review rules"| node_reviewservice
node_reviewdetail -->|"checks access"| node_reviewaccess
node_reviewdetail -->|"uses review rules"| node_reviewservice
node_store -->|"generates schedules"| node_reviewservice
node_store -->|"syncs completed DARs"| node_darlink
node_darlink -->|"calculates next date"| node_reviewservice
node_app -->|"routes to"| node_library
node_app -->|"routes to"| node_controlled
node_app -->|"routes to"| node_externaldocs
node_app -->|"routes to"| node_masterdata
node_controlled -->|"uses watermarking"| node_watermark
node_backend -->|"allocates numbers"| node_ccnumbers
node_backend -->|"issues copy PDF"| node_pdfservice
node_backend -->|"configures service"| node_replacement
node_replacement -->|"fetches original PDF"| node_pdfservice
node_replacement -->|"stamps replacement"| node_stamper
node_pdfservice -->|"uses stamper"| node_stamper
node_backend -->|"queries"| node_pg
node_replacement -->|"reads and writes"| node_pg
node_backend -->|"loads job"| node_effectivejob
node_backend -->|"loads job"| node_recalljob

click node_app "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/App.jsx"
click node_layout "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/layout/Layout.jsx"
click node_auth "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/auth/ProtectedRoute.jsx"
click node_store "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/store/useStore.js"
click node_sla "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/SLAEngine.jsx"
click node_darforms "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/DarWorkflow/DarNewForm.jsx"
click node_darrevision "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/DarWorkflow/DarRevisionForm.jsx"
click node_taskinbox "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Tasks/TaskInbox.jsx"
click node_taskreview "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Tasks/TaskReview.jsx"
click node_reviewmodal "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/workflow/DarReviewModal.jsx"
click node_workflow "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/utils/workflowResolver.js"
click node_dashboard "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Dashboard/Dashboard.jsx"
click node_reviewdash "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/PeriodicReviews/PeriodicReviewDashboard.jsx"
click node_reviewtasks "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/PeriodicReviews/MyReviewTasks.jsx"
click node_reviewdetail "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/PeriodicReviews/PeriodicReviewDetail.jsx"
click node_reviewservice "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/PeriodicReviewService.js"
click node_reviewaccess "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/PeriodicReviewAccessService.js"
click node_darlink "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/PeriodicReviewDarLinkService.js"
click node_library "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Library/Library.jsx"
click node_controlled "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/ControlledCopy/ControlledCopyRegister.jsx"
click node_externaldocs "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/ExternalDocs/ExternalDocsList.jsx"
click node_masterdata "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Admin/MasterDataHub.jsx"
click node_watermark "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/UniversalWatermarkService.js"
click node_backend "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/index.js"
click node_ccnumbers "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/services/CcNumberService.js"
click node_pdfservice "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/services/PdfService.js"
click node_replacement "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/services/ReplacementService.js"
click node_stamper "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/utils/PdfStamper.js"
click node_effectivejob "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/jobs/AutoEffectiveJob.js"
click node_recalljob "https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/jobs/RecallEscalationJob.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_layout,node_auth,node_store,node_sla,node_dashboard,node_user toneBlue
class node_darforms,node_darrevision,node_taskinbox,node_taskreview,node_reviewmodal,node_workflow,node_pg toneAmber
class node_reviewdash,node_reviewtasks,node_reviewdetail,node_reviewservice,node_reviewaccess,node_darlink toneMint
class node_library,node_controlled,node_externaldocs,node_masterdata,node_watermark toneRose
class node_backend,node_ccnumbers,node_pdfservice,node_replacement,node_stamper,node_effectivejob,node_recalljob toneIndigo
```

## Components

### Application Shell

- [React application](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/App.jsx): `src/App.jsx`
- [Navigation shell](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/layout/Layout.jsx): `src/components/layout/Layout.jsx`
- [Route access](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/auth/ProtectedRoute.jsx): `src/components/auth/ProtectedRoute.jsx`
- [Workflow state](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/store/useStore.js): `src/store/useStore.js`
- [SLA lifecycle timer](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/SLAEngine.jsx): `src/components/SLAEngine.jsx`
- [Operations dashboard](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Dashboard/Dashboard.jsx): `src/pages/Dashboard/Dashboard.jsx`

### Document Actions

- [DAR authoring](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/DarWorkflow/DarNewForm.jsx): `src/pages/DarWorkflow/DarNewForm.jsx`
- [DAR revision and obsolescence](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/DarWorkflow/DarRevisionForm.jsx): `src/pages/DarWorkflow/DarRevisionForm.jsx`
- [Task inbox](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Tasks/TaskInbox.jsx): `src/pages/Tasks/TaskInbox.jsx`
- [Task review](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Tasks/TaskReview.jsx): `src/pages/Tasks/TaskReview.jsx`
- [DAR inspection](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/components/workflow/DarReviewModal.jsx): `src/components/workflow/DarReviewModal.jsx`
- [Reviewer resolution](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/utils/workflowResolver.js): `src/utils/workflowResolver.js`

### Periodic Reviews

- [Review dashboard](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/PeriodicReviews/PeriodicReviewDashboard.jsx): `src/pages/PeriodicReviews/PeriodicReviewDashboard.jsx`
- [My review tasks](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/PeriodicReviews/MyReviewTasks.jsx): `src/pages/PeriodicReviews/MyReviewTasks.jsx`
- [Review detail](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/PeriodicReviews/PeriodicReviewDetail.jsx): `src/pages/PeriodicReviews/PeriodicReviewDetail.jsx`
- [Schedule and task rules](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/PeriodicReviewService.js): `src/services/PeriodicReviewService.js`
- [Review permissions](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/PeriodicReviewAccessService.js): `src/services/PeriodicReviewAccessService.js`
- [Review-to-DAR linkage](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/PeriodicReviewDarLinkService.js): `src/services/PeriodicReviewDarLinkService.js`

### Document Control

- [Document library](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Library/Library.jsx): `src/pages/Library/Library.jsx`
- [Controlled-copy register](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/ControlledCopy/ControlledCopyRegister.jsx): `src/pages/ControlledCopy/ControlledCopyRegister.jsx`
- [External documents](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/ExternalDocs/ExternalDocsList.jsx): `src/pages/ExternalDocs/ExternalDocsList.jsx`
- [Master data administration](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/pages/Admin/MasterDataHub.jsx): `src/pages/Admin/MasterDataHub.jsx`
- [PDF watermarking](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/src/services/UniversalWatermarkService.js): `src/services/UniversalWatermarkService.js`

### Controlled Copy Backend

- [HTTP API and reports](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/index.js): `backend/index.js`
- [Copy number allocation](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/services/CcNumberService.js): `backend/services/CcNumberService.js`
- [Copy PDF issuance](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/services/PdfService.js): `backend/services/PdfService.js`
- [Copy replacement](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/services/ReplacementService.js): `backend/services/ReplacementService.js`
- [PDF stamping](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/utils/PdfStamper.js): `backend/utils/PdfStamper.js`
- [Effective-date job](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/jobs/AutoEffectiveJob.js): `backend/jobs/AutoEffectiveJob.js`
- [Recall escalation job](https://github.com/tharns1999-cmyk/qms-portal_newversion/blob/main/backend/jobs/RecallEscalationJob.js): `backend/jobs/RecallEscalationJob.js`

### Other components

- **Staff user**
- **PostgreSQL**

## Connections

- Staff user → React application: uses (evidence: `src/App.jsx`)
- React application → Navigation shell: routes through (evidence: `src/App.jsx`)
- React application → SLA lifecycle timer: mounts (evidence: `src/App.jsx`)
- React application → Workflow state: initializes reviews (evidence: `src/App.jsx`)
- React application → Route access: guards routes (evidence: `src/App.jsx`)
- Route access → Workflow state: reads user state (evidence: `src/components/auth/ProtectedRoute.jsx`)
- SLA lifecycle timer → Workflow state: checks SLA (evidence: `src/components/SLAEngine.jsx`)
- React application → DAR authoring: routes to (evidence: `src/App.jsx`)
- React application → DAR revision and obsolescence: routes to (evidence: `src/App.jsx`)
- React application → Task inbox: routes to (evidence: `src/App.jsx`)
- React application → Task review: routes to (evidence: `src/App.jsx`)
- Task review → DAR inspection: renders (evidence: `src/pages/Tasks/TaskReview.jsx`)
- Task review → Workflow state: reads and updates (evidence: `src/pages/Tasks/TaskReview.jsx`)
- Workflow state → Reviewer resolution: resolves reviewers (evidence: `src/store/useStore.js`)
- Staff user → Review dashboard: opens
- Review dashboard → Review permissions: checks access (evidence: `src/pages/PeriodicReviews/PeriodicReviewDashboard.jsx`)
- Review dashboard → Schedule and task rules: uses schedules (evidence: `src/pages/PeriodicReviews/PeriodicReviewDashboard.jsx`)
- Review dashboard → Review detail: opens detail (evidence: `src/pages/PeriodicReviews/PeriodicReviewDashboard.jsx`)
- My review tasks → Schedule and task rules: uses review rules (evidence: `src/pages/PeriodicReviews/MyReviewTasks.jsx`)
- Review detail → Review permissions: checks access (evidence: `src/pages/PeriodicReviews/PeriodicReviewDetail.jsx`)
- Review detail → Schedule and task rules: uses review rules (evidence: `src/pages/PeriodicReviews/PeriodicReviewDetail.jsx`)
- Workflow state → Schedule and task rules: generates schedules (evidence: `src/store/useStore.js`)
- Workflow state → Review-to-DAR linkage: syncs completed DARs (evidence: `src/store/useStore.js`)
- Review-to-DAR linkage → Schedule and task rules: calculates next date (evidence: `src/services/PeriodicReviewDarLinkService.js`)
- React application → Document library: routes to (evidence: `src/App.jsx`)
- React application → Controlled-copy register: routes to (evidence: `src/App.jsx`)
- React application → External documents: routes to (evidence: `src/App.jsx`)
- React application → Master data administration: routes to (evidence: `src/App.jsx`)
- Controlled-copy register → PDF watermarking: uses watermarking (evidence: `src/pages/ControlledCopy/ControlledCopyRegister.jsx`)
- HTTP API and reports → Copy number allocation: allocates numbers (evidence: `backend/index.js`)
- HTTP API and reports → Copy PDF issuance: issues copy PDF (evidence: `backend/index.js`)
- HTTP API and reports → Copy replacement: configures service (evidence: `backend/index.js`)
- Copy replacement → Copy PDF issuance: fetches original PDF (evidence: `backend/services/ReplacementService.js`)
- Copy replacement → PDF stamping: stamps replacement (evidence: `backend/services/ReplacementService.js`)
- Copy PDF issuance → PDF stamping: uses stamper (evidence: `backend/services/PdfService.js`)
- HTTP API and reports → PostgreSQL: queries (evidence: `backend/index.js`)
- Copy replacement → PostgreSQL: reads and writes (evidence: `backend/services/ReplacementService.js`)
- HTTP API and reports → Effective-date job: loads job (evidence: `backend/index.js`)
- HTTP API and reports → Recall escalation job: loads job (evidence: `backend/index.js`)
