# pjn2work/cdc architecture

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

- Interactive diagram: https://gitdiagram.com/pjn2work/cdc
- Repository: https://github.com/pjn2work/cdc

## Overview

CDC is a membership and community-commerce application: users manage members and dues, record donations and member purchases, and track sellers, expenses, and inventory. Its main workflow enters through authenticated web pages or REST endpoints, validates and authorizes requests, applies domain operations, and persists records in SQLite; web pages and API responses return results to the user. The tree and excerpts confirm the item API/CRUD and parts of member web handling, while several other routes and domain implementations are unsampled, so their internal links are kept broad. A payment dashboard is also present, but its runtime wiring is only partly evidenced.

Main entry points: [`app/web`](https://github.com/pjn2work/cdc/tree/main/app/web) (Web pages), [`app/main.py`](https://github.com/pjn2work/cdc/blob/main/app/main.py) (FastAPI application), [`app/api`](https://github.com/pjn2work/cdc/tree/main/app/api) (REST endpoints), [`app/web/members.py`](https://github.com/pjn2work/cdc/blob/main/app/web/members.py) (Member management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_app["FastAPI application<br/>[main.py]"]
  node_web["Web pages"]
  node_api["REST endpoints"]
end

subgraph group_access["Access and security"]
  node_oauth["OAuth routes<br/>[security.py]"]
  node_security["Token and scopes<br/>[security.py]"]
end

subgraph group_domains["Business domains"]
  node_members["Member management<br/>[members.py]"]
  node_dues["Dues payments<br/>[dues_payments.py]"]
  node_member_due["Member payment links"]
  node_donations["Member donations<br/>[members.py]"]
  node_items["Items and categories<br/>[items.py]"]
  node_member_items["Member purchases<br/>[members_items.py]"]
  node_seller_items["Seller purchases<br/>[sellers_items.py]"]
  node_sellers["Sellers and expenses<br/>[sellers.py]"]
  node_domain_routes["Other domain pages"]
end

subgraph group_persistence["Persistence and reporting"]
  node_member_crud["Member operations<br/>[crud_member.py]"]
  node_item_crud["Item operations<br/>[crud_items.py]"]
  node_schemas["Data schemas"]
  node_models["Domain models"]
  node_database[("SQLite database<br/>[database.py]")]
  node_dashboard["Payment dashboard<br/>[callbacks.py]"]
end

node_user(("Application user"))

node_user -->|"sends requests"| node_app
node_app -->|"dispatches pages"| node_web
node_app -->|"dispatches API"| node_api
node_app -->|"mounts routes"| node_oauth
node_web -->|"checks web token"| node_security
node_api -->|"checks API token"| node_security
node_oauth -->|"issues tokens"| node_security
node_web -->|"routes member pages"| node_members
node_web -->|"routes dues pages"| node_dues
node_web -->|"routes payment links"| node_member_due
node_web -->|"routes donation pages"| node_donations
node_web -->|"routes purchase pages"| node_member_items
node_web -->|"routes purchase pages"| node_seller_items
node_web -->|"routes seller pages"| node_sellers
node_web -->|"routes other pages"| node_domain_routes
node_api -->|"routes item API"| node_items
node_members -->|"calls operations"| node_member_crud
node_items -->|"calls operations"| node_item_crud
node_member_crud -->|"queries and writes"| node_database
node_item_crud -->|"queries and writes"| node_database
node_dashboard -->|"reads payments"| node_database
node_item_crud -->|"uses models"| node_models
node_member_crud -->|"uses models"| node_models
node_items -->|"validates payloads"| node_schemas
node_members -->|"validates forms"| node_schemas

click node_app "https://github.com/pjn2work/cdc/blob/main/app/main.py"
click node_web "https://github.com/pjn2work/cdc/tree/main/app/web"
click node_api "https://github.com/pjn2work/cdc/tree/main/app/api"
click node_oauth "https://github.com/pjn2work/cdc/blob/main/app/sec/security.py"
click node_security "https://github.com/pjn2work/cdc/blob/main/app/sec/security.py"
click node_members "https://github.com/pjn2work/cdc/blob/main/app/web/members.py"
click node_dues "https://github.com/pjn2work/cdc/blob/main/app/web/dues_payments.py"
click node_member_due "https://github.com/pjn2work/cdc/blob/main/app/web/member_due_payment.py"
click node_donations "https://github.com/pjn2work/cdc/blob/main/app/web/members.py"
click node_items "https://github.com/pjn2work/cdc/blob/main/app/api/items.py"
click node_member_items "https://github.com/pjn2work/cdc/blob/main/app/web/members_items.py"
click node_seller_items "https://github.com/pjn2work/cdc/blob/main/app/web/sellers_items.py"
click node_sellers "https://github.com/pjn2work/cdc/blob/main/app/web/sellers.py"
click node_domain_routes "https://github.com/pjn2work/cdc/tree/main/app/web"
click node_member_crud "https://github.com/pjn2work/cdc/blob/main/app/db/crud_member.py"
click node_item_crud "https://github.com/pjn2work/cdc/blob/main/app/db/crud_items.py"
click node_schemas "https://github.com/pjn2work/cdc/tree/main/app/db/schemas"
click node_models "https://github.com/pjn2work/cdc/tree/main/app/db/models"
click node_database "https://github.com/pjn2work/cdc/blob/main/app/db/database.py"
click node_dashboard "https://github.com/pjn2work/cdc/blob/main/app/dash_app/callbacks.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_web,node_api,node_user toneBlue
class node_oauth,node_security toneAmber
class node_members,node_dues,node_member_due,node_donations,node_items,node_member_items,node_seller_items,node_sellers,node_domain_routes toneMint
class node_member_crud,node_item_crud,node_schemas,node_models,node_database,node_dashboard toneRose
```

## Components

### Application entry

- [FastAPI application](https://github.com/pjn2work/cdc/blob/main/app/main.py): `app/main.py`
- [Web pages](https://github.com/pjn2work/cdc/tree/main/app/web): `app/web`
- [REST endpoints](https://github.com/pjn2work/cdc/tree/main/app/api): `app/api`

### Access and security

- [OAuth routes](https://github.com/pjn2work/cdc/blob/main/app/sec/security.py): `app/sec/security.py`
- [Token and scopes](https://github.com/pjn2work/cdc/blob/main/app/sec/security.py): `app/sec/security.py`

### Business domains

- [Member management](https://github.com/pjn2work/cdc/blob/main/app/web/members.py): `app/web/members.py`
- [Dues payments](https://github.com/pjn2work/cdc/blob/main/app/web/dues_payments.py): `app/web/dues_payments.py`
- [Member payment links](https://github.com/pjn2work/cdc/blob/main/app/web/member_due_payment.py): `app/web/member_due_payment.py`
- [Member donations](https://github.com/pjn2work/cdc/blob/main/app/web/members.py): `app/web/members.py`
- [Items and categories](https://github.com/pjn2work/cdc/blob/main/app/api/items.py): `app/api/items.py`
- [Member purchases](https://github.com/pjn2work/cdc/blob/main/app/web/members_items.py): `app/web/members_items.py`
- [Seller purchases](https://github.com/pjn2work/cdc/blob/main/app/web/sellers_items.py): `app/web/sellers_items.py`
- [Sellers and expenses](https://github.com/pjn2work/cdc/blob/main/app/web/sellers.py): `app/web/sellers.py`
- [Other domain pages](https://github.com/pjn2work/cdc/tree/main/app/web): `app/web`

### Persistence and reporting

- [Member operations](https://github.com/pjn2work/cdc/blob/main/app/db/crud_member.py): `app/db/crud_member.py`
- [Item operations](https://github.com/pjn2work/cdc/blob/main/app/db/crud_items.py): `app/db/crud_items.py`
- [Data schemas](https://github.com/pjn2work/cdc/tree/main/app/db/schemas): `app/db/schemas`
- [Domain models](https://github.com/pjn2work/cdc/tree/main/app/db/models): `app/db/models`
- [SQLite database](https://github.com/pjn2work/cdc/blob/main/app/db/database.py): `app/db/database.py`
- [Payment dashboard](https://github.com/pjn2work/cdc/blob/main/app/dash_app/callbacks.py): `app/dash_app/callbacks.py`

### Other components

- **Application user**

## Connections

- Application user → FastAPI application: sends requests
- FastAPI application → Web pages: dispatches pages
- FastAPI application → REST endpoints: dispatches API
- FastAPI application → OAuth routes: mounts routes
- Web pages → Token and scopes: checks web token
- REST endpoints → Token and scopes: checks API token
- OAuth routes → Token and scopes: issues tokens
- Web pages → Member management: routes member pages
- Web pages → Dues payments: routes dues pages
- Web pages → Member payment links: routes payment links
- Web pages → Member donations: routes donation pages
- Web pages → Member purchases: routes purchase pages
- Web pages → Seller purchases: routes purchase pages
- Web pages → Sellers and expenses: routes seller pages
- Web pages → Other domain pages: routes other pages
- REST endpoints → Items and categories: routes item API
- Member management → Member operations: calls operations
- Items and categories → Item operations: calls operations
- Member operations → SQLite database: queries and writes
- Item operations → SQLite database: queries and writes
- Payment dashboard → SQLite database: reads payments
- Item operations → Domain models: uses models
- Member operations → Domain models: uses models
- Items and categories → Data schemas: validates payloads
- Member management → Data schemas: validates forms
