# wyattocai-cpu/clearpath architecture

> Architecture diagram of the GitHub repository wyattocai-cpu/clearpath, 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/wyattocai-cpu/clearpath
- Repository: https://github.com/wyattocai-cpu/clearpath

## Overview

Clearpath is an internal marketing-compliance review application. Users sign in, submit an asset, move it through triage and product-specific checklist review, resolve revisions and approvals, and retain an audit trail. The queue, library, pitfalls guidance, profile, workspace, and permission administration support that workflow. Source excerpts show the Supabase access and mapping layers; some feature implementations are unsampled, so their workflow links rely on README documentation rather than inspected calls.

Main entry points: [`src/components/shell/shell.tsx`](https://github.com/wyattocai-cpu/clearpath/blob/main/src/components/shell/shell.tsx) (App shell), [`src/lib/data/queries.ts`](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/data/queries.ts) (Data queries), [`src/lib/supabase/server.ts`](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/supabase/server.ts) (Supabase client), [`src/app/(app)/submit/submit-form.tsx`](https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/submit/submit-form.tsx) (Asset submission)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_login["Sign-in<br/>[login-form.tsx]"]
  node_shell["App shell<br/>[shell.tsx]"]
  node_queue["Review queue<br/>[queue-view.tsx]"]
  node_library["Asset library"]
  node_workspace["Review workspace"]
  node_pitfalls["Compliance pitfalls<br/>[pitfalls-view.tsx]"]
end

subgraph group_workflow["Review workflow"]
  node_submission["Asset submission<br/>[submit-form.tsx]"]
  node_precheck["Submission precheck<br/>[precheck.ts]"]
  node_triage["Triage and assignment<br/>[review.ts]"]
  node_checklist["Checklist review<br/>[review.ts]"]
  node_approvals["Sign-off and publish<br/>[review.ts]"]
end

subgraph group_data["Data and identity"]
  node_session["Session and roles<br/>[session.ts]"]
  node_queries["Data queries<br/>[queries.ts]"]
  node_mapping["Row mapping<br/>[map.ts]"]
  node_domain["Workflow domain<br/>[domain.ts]"]
  node_supabase["Supabase client<br/>[server.ts]"]
end

subgraph group_governance["Governance"]
  node_audit["Audit trail<br/>[route.ts]"]
  node_permissions["Permissions admin"]
end

node_user(("Staff user"))
node_database[("Supabase database")]

node_user -->|"signs in"| node_login
node_login -->|"authenticates"| node_session
node_user -.->|"uses"| node_shell
node_shell -.->|"opens queue"| node_queue
node_shell -.->|"opens library"| node_library
node_shell -.->|"opens workspace"| node_workspace
node_shell -.->|"opens guidance"| node_pitfalls
node_user -->|"submits asset"| node_submission
node_submission -->|"requests precheck"| node_precheck
node_submission -->|"creates review"| node_triage
node_triage -->|"advances review"| node_checklist
node_checklist -->|"routes sign-off"| node_approvals
node_approvals -->|"records decisions"| node_audit
node_user -.->|"administers access"| node_permissions
node_queue -->|"loads assets"| node_queries
node_queries -->|"creates client"| node_supabase
node_session -->|"creates client"| node_supabase
node_queries -->|"maps rows"| node_mapping
node_mapping -->|"builds assets"| node_domain
node_supabase -.->|"queries"| node_database
node_permissions -->|"loads permissions"| node_queries
node_workspace -->|"opens asset"| node_shell
node_audit -->|"creates client"| node_supabase

click node_login "https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/login/login-form.tsx"
click node_shell "https://github.com/wyattocai-cpu/clearpath/blob/main/src/components/shell/shell.tsx"
click node_queue "https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/queue-view.tsx"
click node_library "https://github.com/wyattocai-cpu/clearpath/tree/main/src/app/(app)/library"
click node_workspace "https://github.com/wyattocai-cpu/clearpath/tree/main/src/app/(app)/workspace"
click node_pitfalls "https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/pitfalls/pitfalls-view.tsx"
click node_submission "https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/submit/submit-form.tsx"
click node_precheck "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/ai/precheck.ts"
click node_triage "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/actions/review.ts"
click node_checklist "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/actions/review.ts"
click node_approvals "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/actions/review.ts"
click node_audit "https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/api/audit/%5BassetId%5D/route.ts"
click node_permissions "https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/admin/permissions/permissions-view.tsx"
click node_session "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/auth/session.ts"
click node_queries "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/data/queries.ts"
click node_mapping "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/data/map.ts"
click node_domain "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/domain.ts"
click node_supabase "https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/supabase/server.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_login,node_shell,node_queue,node_library,node_workspace,node_pitfalls,node_user toneBlue
class node_submission,node_precheck,node_triage,node_checklist,node_approvals,node_database toneAmber
class node_session,node_queries,node_mapping,node_domain,node_supabase toneMint
class node_audit,node_permissions toneRose
```

## Components

### User experience

- [Sign-in](https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/login/login-form.tsx): `src/app/login/login-form.tsx`
- [App shell](https://github.com/wyattocai-cpu/clearpath/blob/main/src/components/shell/shell.tsx): `src/components/shell/shell.tsx`
- [Review queue](https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/queue-view.tsx): `src/app/(app)/queue-view.tsx`
- [Asset library](https://github.com/wyattocai-cpu/clearpath/tree/main/src/app/(app)/library): `src/app/(app)/library`
- [Review workspace](https://github.com/wyattocai-cpu/clearpath/tree/main/src/app/(app)/workspace): `src/app/(app)/workspace`
- [Compliance pitfalls](https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/pitfalls/pitfalls-view.tsx): `src/app/(app)/pitfalls/pitfalls-view.tsx`

### Review workflow

- [Asset submission](https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/submit/submit-form.tsx): `src/app/(app)/submit/submit-form.tsx`
- [Submission precheck](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/ai/precheck.ts): `src/lib/ai/precheck.ts`
- [Triage and assignment](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/actions/review.ts): `src/lib/actions/review.ts`
- [Checklist review](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/actions/review.ts): `src/lib/actions/review.ts`
- [Sign-off and publish](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/actions/review.ts): `src/lib/actions/review.ts`

### Data and identity

- [Session and roles](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/auth/session.ts): `src/lib/auth/session.ts`
- [Data queries](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/data/queries.ts): `src/lib/data/queries.ts`
- [Row mapping](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/data/map.ts): `src/lib/data/map.ts`
- [Workflow domain](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/domain.ts): `src/lib/domain.ts`
- [Supabase client](https://github.com/wyattocai-cpu/clearpath/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`

### Governance

- [Audit trail](https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/api/audit/%5BassetId%5D/route.ts): `src/app/api/audit/[assetId]/route.ts`
- [Permissions admin](https://github.com/wyattocai-cpu/clearpath/blob/main/src/app/(app)/admin/permissions/permissions-view.tsx): `src/app/(app)/admin/permissions/permissions-view.tsx`

### Other components

- **Staff user**
- **Supabase database**

## Connections

- Staff user → Sign-in: signs in
- Sign-in → Session and roles: authenticates (evidence: `src/app/login/login-form.tsx`)
- Staff user → App shell: uses
- App shell → Review queue: opens queue
- App shell → Asset library: opens library
- App shell → Review workspace: opens workspace
- App shell → Compliance pitfalls: opens guidance
- Staff user → Asset submission: submits asset
- Asset submission → Submission precheck: requests precheck (evidence: `src/app/(app)/submit/submit-form.tsx`)
- Asset submission → Triage and assignment: creates review
- Triage and assignment → Checklist review: advances review (evidence: `src/lib/actions/review.ts`)
- Checklist review → Sign-off and publish: routes sign-off (evidence: `src/lib/actions/review.ts`)
- Sign-off and publish → Audit trail: records decisions
- Staff user → Permissions admin: administers access
- Review queue → Data queries: loads assets (evidence: `src/app/(app)/page.tsx`)
- Data queries → Supabase client: creates client (evidence: `src/lib/data/queries.ts`)
- Session and roles → Supabase client: creates client (evidence: `src/lib/auth/session.ts`)
- Data queries → Row mapping: maps rows (evidence: `src/lib/data/queries.ts`)
- Row mapping → Workflow domain: builds assets (evidence: `src/lib/data/map.ts`)
- Supabase client → Supabase database: queries
- Permissions admin → Data queries: loads permissions (evidence: `src/app/(app)/admin/permissions/page.tsx`)
- Review workspace → App shell: opens asset (evidence: `src/app/(app)/workspace/workspace-home.tsx`)
- Audit trail → Supabase client: creates client (evidence: `src/app/api/audit/[assetId]/route.ts`)
