# debagithub567/packmanage architecture

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

- Interactive diagram: https://gitdiagram.com/debagithub567/packmanage
- Repository: https://github.com/debagithub567/packmanage

## Overview

PackManage turns uploaded packaging artwork and a change-request email into AI-proposed revisions, then guides a manager through location confirmation, clarification, conflict resolution, approval and finalization before producing designer-ready PDFs. The graph follows the documented workflow and source-index references; several review panels and artwork-processing details are represented at their exact tree paths because their implementation was not excerpted.

Main entry points: [`hooks/useWorkspace.ts`](https://github.com/debagithub567/packmanage/blob/main/hooks/useWorkspace.ts) (Workspace controller), [`frontend/components/review/ReviewWorkspace.tsx`](https://github.com/debagithub567/packmanage/blob/main/frontend/components/review/ReviewWorkspace.tsx) (Revision review), [`lib/ai/gemini.ts`](https://github.com/debagithub567/packmanage/blob/main/lib/ai/gemini.ts) (Gemini integration), [`frontend/PackManageFrontend.tsx`](https://github.com/debagithub567/packmanage/blob/main/frontend/PackManageFrontend.tsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["Application shell"]
  node_workspace["Workspace controller<br/>[useWorkspace.ts]"]
  node_inputs["Artwork and request inputs"]
  node_artwork["Artwork processing<br/>[artwork-service.ts]"]
end

subgraph group_analysis["AI analysis"]
  node_analysis_service["Analysis client"]
  node_api["Analysis API<br/>[route.ts]"]
  node_gemini["Gemini integration<br/>[gemini.ts]"]
  node_prompt["Analysis prompt<br/>[prompt.ts]"]
  node_schema["AI response schema<br/>[schema.ts]"]
  node_normalize["Analysis normalization<br/>[normalize.ts]"]
end

subgraph group_review["Review and validation"]
  node_contracts["Shared data contracts<br/>[contracts.ts]"]
  node_review_ui["Revision review"]
  node_review_panels["Review issue panels<br/>[ReviewPanels.tsx]"]
  node_domain["Review rules<br/>[workspace.ts]"]
  node_viewer["Artwork viewer<br/>[ArtworkCanvas.tsx]"]
  node_annotations["Annotation geometry<br/>[annotations.ts]"]
  node_location["Location confirmation<br/>[LocationReview.tsx]"]
  node_conflicts["Conflict review<br/>[ConflictPanel.tsx]"]
  node_clarifications["Clarification review"]
  node_preservation["Protected elements"]
  node_finalization["Finalization checks"]
end

subgraph group_handoff["Designer handoff"]
  node_handoff_ui["Designer handoff"]
  node_package_data["Package contents<br/>[package-data.ts]"]
  node_export_service["PDF export service<br/>[export-service.ts]"]
  node_pdf["PDF generation<br/>[designer-pdf.ts]"]
end

node_manager(("Product manager"))
node_gemini_service{{"Gemini API"}}

node_manager -->|"provides inputs"| node_app
node_app -->|"opens workflow"| node_inputs
node_app -->|"uses state"| node_workspace
node_inputs -.->|"submits inputs"| node_workspace
node_workspace -->|"processes artwork"| node_artwork
node_workspace -->|"requests analysis"| node_analysis_service
node_analysis_service -->|"posts request"| node_api
node_api -->|"invokes analysis"| node_gemini
node_gemini -->|"uses prompt"| node_prompt
node_gemini -->|"validates output"| node_schema
node_gemini -->|"sends request"| node_gemini_service
node_gemini -->|"normalizes result"| node_normalize
node_normalize -->|"checks proposal"| node_schema
node_normalize -->|"uses workspace rules"| node_domain
node_api -->|"validates request"| node_contracts
node_workspace -->|"supplies review state"| node_review_ui
node_review_ui -->|"renders artwork"| node_viewer
node_viewer -->|"maps markers"| node_annotations
node_review_ui -.->|"presents issues"| node_review_panels
node_workspace -->|"applies decisions"| node_domain
node_review_ui -->|"confirms locations"| node_location
node_review_ui -->|"resolves conflicts"| node_conflicts
node_review_ui -->|"resolves questions"| node_clarifications
node_review_ui -->|"reviews preservation"| node_preservation
node_workspace -->|"checks blockers"| node_finalization
node_workspace -->|"opens package"| node_handoff_ui
node_handoff_ui -->|"selects contents"| node_package_data
node_workspace -->|"requests export"| node_export_service
node_export_service -->|"creates PDF"| node_pdf
node_pdf -->|"builds deliverables"| node_package_data

click node_app "https://github.com/debagithub567/packmanage/blob/main/frontend/PackManageFrontend.tsx"
click node_workspace "https://github.com/debagithub567/packmanage/blob/main/hooks/useWorkspace.ts"
click node_inputs "https://github.com/debagithub567/packmanage/blob/main/frontend/components/create/CreateWorkspace.tsx"
click node_artwork "https://github.com/debagithub567/packmanage/blob/main/lib/artwork-service.ts"
click node_analysis_service "https://github.com/debagithub567/packmanage/blob/main/lib/analysis-service.ts"
click node_api "https://github.com/debagithub567/packmanage/blob/main/app/api/analyze/route.ts"
click node_gemini "https://github.com/debagithub567/packmanage/blob/main/lib/ai/gemini.ts"
click node_prompt "https://github.com/debagithub567/packmanage/blob/main/lib/ai/prompt.ts"
click node_schema "https://github.com/debagithub567/packmanage/blob/main/lib/ai/schema.ts"
click node_normalize "https://github.com/debagithub567/packmanage/blob/main/lib/ai/normalize.ts"
click node_contracts "https://github.com/debagithub567/packmanage/blob/main/lib/contracts.ts"
click node_review_ui "https://github.com/debagithub567/packmanage/blob/main/frontend/components/review/ReviewWorkspace.tsx"
click node_review_panels "https://github.com/debagithub567/packmanage/blob/main/frontend/components/review/ReviewPanels.tsx"
click node_domain "https://github.com/debagithub567/packmanage/blob/main/lib/workspace.ts"
click node_viewer "https://github.com/debagithub567/packmanage/blob/main/frontend/components/shared/ArtworkCanvas.tsx"
click node_annotations "https://github.com/debagithub567/packmanage/blob/main/lib/artwork/annotations.ts"
click node_location "https://github.com/debagithub567/packmanage/blob/main/components/artwork/LocationReview.tsx"
click node_conflicts "https://github.com/debagithub567/packmanage/blob/main/components/review/ConflictPanel.tsx"
click node_clarifications "https://github.com/debagithub567/packmanage/blob/main/components/review/ClarificationPanel.tsx"
click node_preservation "https://github.com/debagithub567/packmanage/blob/main/components/review/ProtectedElementsPanel.tsx"
click node_finalization "https://github.com/debagithub567/packmanage/blob/main/components/review/FinalizationPanel.tsx"
click node_handoff_ui "https://github.com/debagithub567/packmanage/blob/main/frontend/components/package/DesignerHandoff.tsx"
click node_package_data "https://github.com/debagithub567/packmanage/blob/main/lib/export/package-data.ts"
click node_export_service "https://github.com/debagithub567/packmanage/blob/main/lib/export-service.ts"
click node_pdf "https://github.com/debagithub567/packmanage/blob/main/lib/export/designer-pdf.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_app,node_workspace,node_inputs,node_artwork toneBlue
class node_analysis_service,node_api,node_gemini,node_prompt,node_schema,node_normalize toneAmber
class node_contracts,node_review_ui,node_review_panels,node_domain,node_viewer,node_annotations,node_location,node_conflicts,node_clarifications,node_preservation,node_finalization,node_gemini_service toneMint
class node_handoff_ui,node_package_data,node_export_service,node_pdf toneRose
class node_manager toneIndigo
```

## Components

### User experience

- [Application shell](https://github.com/debagithub567/packmanage/blob/main/frontend/PackManageFrontend.tsx): `frontend/PackManageFrontend.tsx`
- [Workspace controller](https://github.com/debagithub567/packmanage/blob/main/hooks/useWorkspace.ts): `hooks/useWorkspace.ts`
- [Artwork and request inputs](https://github.com/debagithub567/packmanage/blob/main/frontend/components/create/CreateWorkspace.tsx): `frontend/components/create/CreateWorkspace.tsx`
- [Artwork processing](https://github.com/debagithub567/packmanage/blob/main/lib/artwork-service.ts): `lib/artwork-service.ts`

### AI analysis

- [Analysis client](https://github.com/debagithub567/packmanage/blob/main/lib/analysis-service.ts): `lib/analysis-service.ts`
- [Analysis API](https://github.com/debagithub567/packmanage/blob/main/app/api/analyze/route.ts): `app/api/analyze/route.ts`
- [Gemini integration](https://github.com/debagithub567/packmanage/blob/main/lib/ai/gemini.ts): `lib/ai/gemini.ts`
- [Analysis prompt](https://github.com/debagithub567/packmanage/blob/main/lib/ai/prompt.ts): `lib/ai/prompt.ts`
- [AI response schema](https://github.com/debagithub567/packmanage/blob/main/lib/ai/schema.ts): `lib/ai/schema.ts`
- [Analysis normalization](https://github.com/debagithub567/packmanage/blob/main/lib/ai/normalize.ts): `lib/ai/normalize.ts`

### Review and validation

- [Shared data contracts](https://github.com/debagithub567/packmanage/blob/main/lib/contracts.ts): `lib/contracts.ts`
- [Revision review](https://github.com/debagithub567/packmanage/blob/main/frontend/components/review/ReviewWorkspace.tsx): `frontend/components/review/ReviewWorkspace.tsx`
- [Review issue panels](https://github.com/debagithub567/packmanage/blob/main/frontend/components/review/ReviewPanels.tsx): `frontend/components/review/ReviewPanels.tsx`
- [Review rules](https://github.com/debagithub567/packmanage/blob/main/lib/workspace.ts): `lib/workspace.ts`
- [Artwork viewer](https://github.com/debagithub567/packmanage/blob/main/frontend/components/shared/ArtworkCanvas.tsx): `frontend/components/shared/ArtworkCanvas.tsx`
- [Annotation geometry](https://github.com/debagithub567/packmanage/blob/main/lib/artwork/annotations.ts): `lib/artwork/annotations.ts`
- [Location confirmation](https://github.com/debagithub567/packmanage/blob/main/components/artwork/LocationReview.tsx): `components/artwork/LocationReview.tsx`
- [Conflict review](https://github.com/debagithub567/packmanage/blob/main/components/review/ConflictPanel.tsx): `components/review/ConflictPanel.tsx`
- [Clarification review](https://github.com/debagithub567/packmanage/blob/main/components/review/ClarificationPanel.tsx): `components/review/ClarificationPanel.tsx`
- [Protected elements](https://github.com/debagithub567/packmanage/blob/main/components/review/ProtectedElementsPanel.tsx): `components/review/ProtectedElementsPanel.tsx`
- [Finalization checks](https://github.com/debagithub567/packmanage/blob/main/components/review/FinalizationPanel.tsx): `components/review/FinalizationPanel.tsx`

### Designer handoff

- [Designer handoff](https://github.com/debagithub567/packmanage/blob/main/frontend/components/package/DesignerHandoff.tsx): `frontend/components/package/DesignerHandoff.tsx`
- [Package contents](https://github.com/debagithub567/packmanage/blob/main/lib/export/package-data.ts): `lib/export/package-data.ts`
- [PDF export service](https://github.com/debagithub567/packmanage/blob/main/lib/export-service.ts): `lib/export-service.ts`
- [PDF generation](https://github.com/debagithub567/packmanage/blob/main/lib/export/designer-pdf.ts): `lib/export/designer-pdf.ts`

### Other components

- **Product manager**
- **Gemini API**

## Connections

- Product manager → Application shell: provides inputs (evidence: `README.md`)
- Application shell → Artwork and request inputs: opens workflow (evidence: `frontend/PackManageFrontend.tsx`)
- Application shell → Workspace controller: uses state (evidence: `frontend/integration/PackManageApp.tsx`)
- Artwork and request inputs → Workspace controller: submits inputs
- Workspace controller → Artwork processing: processes artwork (evidence: `frontend/integration/PackManageApp.tsx`)
- Workspace controller → Analysis client: requests analysis (evidence: `frontend/integration/PackManageApp.tsx`)
- Analysis client → Analysis API: posts request (evidence: `lib/analysis-service.ts`)
- Analysis API → Gemini integration: invokes analysis (evidence: `app/api/analyze/route.ts`)
- Gemini integration → Analysis prompt: uses prompt (evidence: `lib/ai/gemini.ts`)
- Gemini integration → AI response schema: validates output (evidence: `lib/ai/gemini.ts`)
- Gemini integration → Gemini API: sends request (evidence: `README.md`)
- Gemini integration → Analysis normalization: normalizes result (evidence: `lib/ai/gemini.ts`)
- Analysis normalization → AI response schema: checks proposal (evidence: `lib/ai/normalize.ts`)
- Analysis normalization → Review rules: uses workspace rules (evidence: `lib/ai/normalize.ts`)
- Analysis API → Shared data contracts: validates request (evidence: `app/api/analyze/route.ts`)
- Workspace controller → Revision review: supplies review state (evidence: `frontend/components/review/ReviewWorkspace.tsx`)
- Revision review → Artwork viewer: renders artwork (evidence: `frontend/components/review/ReviewWorkspace.tsx`)
- Artwork viewer → Annotation geometry: maps markers (evidence: `frontend/components/shared/ArtworkCanvas.tsx`)
- Revision review → Review issue panels: presents issues
- Workspace controller → Review rules: applies decisions (evidence: `hooks/useWorkspace.ts`)
- Revision review → Location confirmation: confirms locations (evidence: `README.md`)
- Revision review → Conflict review: resolves conflicts (evidence: `README.md`)
- Revision review → Clarification review: resolves questions (evidence: `README.md`)
- Revision review → Protected elements: reviews preservation (evidence: `README.md`)
- Workspace controller → Finalization checks: checks blockers (evidence: `hooks/useWorkspace.ts`)
- Workspace controller → Designer handoff: opens package (evidence: `hooks/useWorkspace.ts`)
- Designer handoff → Package contents: selects contents (evidence: `frontend/components/package/DesignerHandoff.tsx`)
- Workspace controller → PDF export service: requests export (evidence: `lib/export-service.ts`)
- PDF export service → PDF generation: creates PDF (evidence: `lib/export-service.ts`)
- PDF generation → Package contents: builds deliverables (evidence: `lib/export/designer-pdf.ts`)
