# audeoinc/ccp architecture

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

- Interactive diagram: https://gitdiagram.com/audeoinc/ccp
- Repository: https://github.com/audeoinc/ccp

## Overview

CCP is a bilingual campaign-content planning app: teams plan email and push campaigns, develop content with AI, review and approve weekly plans, then inspect delivery results and alerts. The React client edits campaign cards and accesses table-oriented data and AI APIs; the FastAPI server validates and persists data and coordinates cloud services. The graph preserves the README’s documented calendar, card editing, templates, review, results, alerts, and localization capabilities. Some UI links are documented rather than source-sampled; those edges cite the README.

Main entry points: [`src/App.tsx`](https://github.com/audeoinc/ccp/blob/main/src/App.tsx) (Application shell), [`src/data`](https://github.com/audeoinc/ccp/tree/main/src/data) (Table data services), [`src/CardDetail.tsx`](https://github.com/audeoinc/ccp/blob/main/src/CardDetail.tsx) (Campaign editor), [`server/ccp/main.py`](https://github.com/audeoinc/ccp/blob/main/server/ccp/main.py) (FastAPI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Planning UI"]
  node_app["Application shell<br/>[App.tsx]"]
  node_calendar["Campaign calendar<br/>[Calendar.tsx]"]
  node_list["Campaign list<br/>[ListView.tsx]"]
end

subgraph group_content["Content authoring"]
  node_card["Campaign editor<br/>[CardDetail.tsx]"]
  node_templates["Template manager"]
  node_template_rules["Template definitions<br/>[templates.ts]"]
  node_ai_drafts["AI drafting workflow<br/>[useAiDrafts.ts]"]
  node_ai_selection["AI content proposals<br/>[aiSelect.ts]"]
  node_ai_copy["AI copy proposals<br/>[aiDraft.ts]"]
  node_preview["Campaign preview<br/>[Preview.tsx]"]
end

subgraph group_insights["Review and insights"]
  node_weekly_review["Weekly review<br/>[WeekReviewBar.tsx]"]
  node_results["Delivery results<br/>[ResultsPage.tsx]"]
  node_alerts["Inventory alerts<br/>[AlertsPage.tsx]"]
end

subgraph group_platform["Data and services"]
  node_models["Domain models"]
  node_data_services["Table data services"]
  node_client_api["API client<br/>[services.ts]"]
  node_server["FastAPI application<br/>[main.py]"]
  node_data_api["Data API<br/>[data_api.py]"]
  node_schema["Schema validation<br/>[schema.py]"]
  node_database_access["Database access<br/>[db.py]"]
  node_database[("PostgreSQL")]
  node_db_control["Database lifecycle<br/>[dbctl.py]"]
  node_cloud_storage[("Cloud Storage state")]
  node_ai_api["AI API<br/>[ai.py]"]
  node_gemini{{"Gemini Vertex AI"}}
end

node_user(("Campaign planner"))

node_user -->|"plans campaigns"| node_app
node_app -->|"shows calendar"| node_calendar
node_app -->|"shows list"| node_list
node_app -->|"edits campaign"| node_card
node_card -->|"renders preview"| node_preview
node_card -->|"requests drafts"| node_ai_drafts
node_ai_drafts -->|"proposes content"| node_ai_selection
node_ai_drafts -->|"proposes copy"| node_ai_copy
node_templates -->|"saves template"| node_template_rules
node_app -->|"reviews week"| node_weekly_review
node_app -->|"opens results"| node_results
node_app -->|"opens alerts"| node_alerts
node_calendar -->|"loads campaigns"| node_data_services
node_card -->|"edits campaign data"| node_data_services
node_results -->|"loads results"| node_data_services
node_alerts -->|"loads alert data"| node_data_services
node_data_services -->|"uses row types"| node_models
node_data_services -->|"calls API client"| node_client_api
node_client_api -->|"requests endpoints"| node_server
node_server -->|"registers router"| node_data_api
node_server -->|"registers router"| node_ai_api
node_data_api -->|"validates table fields"| node_schema
node_data_api -->|"queries database"| node_database_access
node_database_access -->|"reads and writes"| node_database
node_server -->|"checks database state"| node_db_control
node_db_control -->|"stores activity state"| node_cloud_storage
node_db_control -->|"starts and stops"| node_database
node_ai_api -->|"generates suggestions"| node_gemini
node_client_api -.->|"requests AI"| node_ai_api

click node_app "https://github.com/audeoinc/ccp/blob/main/src/App.tsx"
click node_calendar "https://github.com/audeoinc/ccp/blob/main/src/Calendar.tsx"
click node_list "https://github.com/audeoinc/ccp/blob/main/src/ListView.tsx"
click node_card "https://github.com/audeoinc/ccp/blob/main/src/CardDetail.tsx"
click node_templates "https://github.com/audeoinc/ccp/blob/main/src/TemplateManager.tsx"
click node_template_rules "https://github.com/audeoinc/ccp/blob/main/src/templates.ts"
click node_ai_drafts "https://github.com/audeoinc/ccp/blob/main/src/useAiDrafts.ts"
click node_ai_selection "https://github.com/audeoinc/ccp/blob/main/src/aiSelect.ts"
click node_ai_copy "https://github.com/audeoinc/ccp/blob/main/src/aiDraft.ts"
click node_preview "https://github.com/audeoinc/ccp/blob/main/src/Preview.tsx"
click node_weekly_review "https://github.com/audeoinc/ccp/blob/main/src/WeekReviewBar.tsx"
click node_results "https://github.com/audeoinc/ccp/blob/main/src/ResultsPage.tsx"
click node_alerts "https://github.com/audeoinc/ccp/blob/main/src/AlertsPage.tsx"
click node_models "https://github.com/audeoinc/ccp/tree/main/src/models"
click node_data_services "https://github.com/audeoinc/ccp/tree/main/src/data"
click node_client_api "https://github.com/audeoinc/ccp/blob/main/src/gcp/services.ts"
click node_server "https://github.com/audeoinc/ccp/blob/main/server/ccp/main.py"
click node_data_api "https://github.com/audeoinc/ccp/blob/main/server/ccp/data_api.py"
click node_schema "https://github.com/audeoinc/ccp/blob/main/server/ccp/schema.py"
click node_database_access "https://github.com/audeoinc/ccp/blob/main/server/ccp/db.py"
click node_db_control "https://github.com/audeoinc/ccp/blob/main/server/ccp/dbctl.py"
click node_ai_api "https://github.com/audeoinc/ccp/blob/main/server/ccp/ai.py"

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_calendar,node_list toneBlue
class node_card,node_templates,node_template_rules,node_ai_drafts,node_ai_selection,node_ai_copy,node_preview toneAmber
class node_weekly_review,node_results,node_alerts toneMint
class node_models,node_data_services,node_client_api,node_server,node_data_api,node_schema,node_database_access,node_database,node_db_control,node_cloud_storage,node_ai_api,node_gemini toneRose
class node_user toneIndigo
```

## Components

### Planning UI

- [Application shell](https://github.com/audeoinc/ccp/blob/main/src/App.tsx): `src/App.tsx`
- [Campaign calendar](https://github.com/audeoinc/ccp/blob/main/src/Calendar.tsx): `src/Calendar.tsx`
- [Campaign list](https://github.com/audeoinc/ccp/blob/main/src/ListView.tsx): `src/ListView.tsx`

### Content authoring

- [Campaign editor](https://github.com/audeoinc/ccp/blob/main/src/CardDetail.tsx): `src/CardDetail.tsx`
- [Template manager](https://github.com/audeoinc/ccp/blob/main/src/TemplateManager.tsx): `src/TemplateManager.tsx`
- [Template definitions](https://github.com/audeoinc/ccp/blob/main/src/templates.ts): `src/templates.ts`
- [AI drafting workflow](https://github.com/audeoinc/ccp/blob/main/src/useAiDrafts.ts): `src/useAiDrafts.ts`
- [AI content proposals](https://github.com/audeoinc/ccp/blob/main/src/aiSelect.ts): `src/aiSelect.ts`
- [AI copy proposals](https://github.com/audeoinc/ccp/blob/main/src/aiDraft.ts): `src/aiDraft.ts`
- [Campaign preview](https://github.com/audeoinc/ccp/blob/main/src/Preview.tsx): `src/Preview.tsx`

### Review and insights

- [Weekly review](https://github.com/audeoinc/ccp/blob/main/src/WeekReviewBar.tsx): `src/WeekReviewBar.tsx`
- [Delivery results](https://github.com/audeoinc/ccp/blob/main/src/ResultsPage.tsx): `src/ResultsPage.tsx`
- [Inventory alerts](https://github.com/audeoinc/ccp/blob/main/src/AlertsPage.tsx): `src/AlertsPage.tsx`

### Data and services

- [Domain models](https://github.com/audeoinc/ccp/tree/main/src/models): `src/models`
- [Table data services](https://github.com/audeoinc/ccp/tree/main/src/data): `src/data`
- [API client](https://github.com/audeoinc/ccp/blob/main/src/gcp/services.ts): `src/gcp/services.ts`
- [FastAPI application](https://github.com/audeoinc/ccp/blob/main/server/ccp/main.py): `server/ccp/main.py`
- [Data API](https://github.com/audeoinc/ccp/blob/main/server/ccp/data_api.py): `server/ccp/data_api.py`
- [Schema validation](https://github.com/audeoinc/ccp/blob/main/server/ccp/schema.py): `server/ccp/schema.py`
- [Database access](https://github.com/audeoinc/ccp/blob/main/server/ccp/db.py): `server/ccp/db.py`
- **PostgreSQL**
- [Database lifecycle](https://github.com/audeoinc/ccp/blob/main/server/ccp/dbctl.py): `server/ccp/dbctl.py`
- **Cloud Storage state**
- [AI API](https://github.com/audeoinc/ccp/blob/main/server/ccp/ai.py): `server/ccp/ai.py`
- **Gemini Vertex AI**

### Other components

- **Campaign planner**

## Connections

- Campaign planner → Application shell: plans campaigns (evidence: `README.md`)
- Application shell → Campaign calendar: shows calendar (evidence: `src/App.tsx`)
- Application shell → Campaign list: shows list (evidence: `src/App.tsx`)
- Application shell → Campaign editor: edits campaign (evidence: `README.md`)
- Campaign editor → Campaign preview: renders preview (evidence: `README.md`)
- Campaign editor → AI drafting workflow: requests drafts (evidence: `README.md`)
- AI drafting workflow → AI content proposals: proposes content (evidence: `src/useAiDrafts.ts`)
- AI drafting workflow → AI copy proposals: proposes copy (evidence: `src/useAiDrafts.ts`)
- Template manager → Template definitions: saves template (evidence: `src/TemplateManager.tsx`)
- Application shell → Weekly review: reviews week (evidence: `README.md`)
- Application shell → Delivery results: opens results (evidence: `src/App.tsx`)
- Application shell → Inventory alerts: opens alerts (evidence: `src/App.tsx`)
- Campaign calendar → Table data services: loads campaigns (evidence: `README.md`)
- Campaign editor → Table data services: edits campaign data (evidence: `README.md`)
- Delivery results → Table data services: loads results (evidence: `README.md`)
- Inventory alerts → Table data services: loads alert data (evidence: `src/AlertsPage.tsx`)
- Table data services → Domain models: uses row types (evidence: `src/data/deliveryProducts.ts`)
- Table data services → API client: calls API client (evidence: `src/data/cardNotes.ts`)
- API client → FastAPI application: requests endpoints (evidence: `src/gcp/services.ts`)
- FastAPI application → Data API: registers router (evidence: `server/ccp/main.py`)
- FastAPI application → AI API: registers router (evidence: `server/ccp/main.py`)
- Data API → Schema validation: validates table fields (evidence: `server/ccp/data_api.py`)
- Data API → Database access: queries database (evidence: `server/ccp/data_api.py`)
- Database access → PostgreSQL: reads and writes (evidence: `README.md`)
- FastAPI application → Database lifecycle: checks database state (evidence: `server/ccp/main.py`)
- Database lifecycle → Cloud Storage state: stores activity state (evidence: `server/ccp/dbctl.py`)
- Database lifecycle → PostgreSQL: starts and stops (evidence: `server/ccp/dbctl.py`)
- AI API → Gemini Vertex AI: generates suggestions (evidence: `README.md`)
- API client → AI API: requests AI
