# veeresh-math/chama-ai architecture

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

- Interactive diagram: https://gitdiagram.com/veeresh-math/chama-ai
- Repository: https://github.com/veeresh-math/chama-ai

## Overview

Cham.ai is a community savings and collective-wealth platform. Members use the Next.js app to access community management, analytics, an AI copilot, and gig features; its API supports account and community operations, while database and payment services handle persistence and payouts. The sampled source confirms authentication, community creation and retrieval, and distribution behavior. Other product areas are represented from the README and repository tree; their internal wiring was not sampled, so those connections are omitted.

Main entry points: [`src/db/index.ts`](https://github.com/veeresh-math/chama-ai/blob/main/src/db/index.ts) (Database client), [`src/lib/supabase.ts`](https://github.com/veeresh-math/chama-ai/blob/main/src/lib/supabase.ts) (Supabase auth), [`src/app/api/communities/[id]/distribute/route.ts`](https://github.com/veeresh-math/chama-ai/blob/main/src/app/api/communities/%5Bid%5D/distribute/route.ts) (Distribution API), [`src/app/api/auth`](https://github.com/veeresh-math/chama-ai/tree/main/src/app/api/auth) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["Landing page<br/>[page.tsx]"]
  node_dashboard["Dashboard shell"]
  node_communities_ui["Community management<br/>[page.tsx]"]
  node_analytics["Analytics<br/>[page.tsx]"]
  node_copilot_ui["AI copilot<br/>[page.tsx]"]
  node_gigs_ui["Gig marketplace<br/>[page.tsx]"]
  node_ui_components["UI components"]
end

subgraph group_api["Application API"]
  node_auth_api["Authentication API"]
  node_community_api["Community API<br/>[route.ts]"]
  node_community_detail_api["Community detail API<br/>[route.ts]"]
  node_distribution_api["Distribution API<br/>[route.ts]"]
end

subgraph group_finance["Financial services"]
  node_agent["Financial agent<br/>[agent.ts]"]
  node_paypal["PayPal payments<br/>[paypal.ts]"]
  node_queue["Job queue<br/>[queue.ts]"]
end

subgraph group_data["Identity and data"]
  node_supabase["Supabase auth<br/>[supabase.ts]"]
  node_db_client["Database client<br/>[index.ts]"]
  node_schema[("Financial records<br/>[schema.ts]")]
end

node_member(("Community member"))

node_member -->|"opens"| node_home
node_member -.->|"authenticates"| node_auth_api
node_member -.->|"manages groups"| node_communities_ui
node_member -.->|"reviews trends"| node_analytics
node_member -.->|"requests insights"| node_copilot_ui
node_member -.->|"uses gigs"| node_gigs_ui
node_auth_api -->|"verifies users"| node_supabase
node_auth_api -->|"reads and writes"| node_db_client
node_community_api -->|"verifies users"| node_supabase
node_community_api -->|"reads and writes"| node_db_client
node_community_detail_api -->|"verifies users"| node_supabase
node_community_detail_api -->|"reads records"| node_db_client
node_distribution_api -->|"verifies users"| node_supabase
node_distribution_api -->|"records payout"| node_db_client
node_distribution_api -->|"sends payouts"| node_paypal
node_agent -->|"queries finances"| node_db_client
node_agent -->|"creates payments"| node_paypal
node_db_client -->|"loads schema"| node_schema

click node_home "https://github.com/veeresh-math/chama-ai/blob/main/src/app/page.tsx"
click node_dashboard "https://github.com/veeresh-math/chama-ai/blob/main/src/components/dashboard-layout.tsx"
click node_communities_ui "https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/communities/page.tsx"
click node_analytics "https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/analytics/page.tsx"
click node_copilot_ui "https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/copilot/page.tsx"
click node_gigs_ui "https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/gigs/page.tsx"
click node_ui_components "https://github.com/veeresh-math/chama-ai/tree/main/src/components/ui"
click node_auth_api "https://github.com/veeresh-math/chama-ai/tree/main/src/app/api/auth"
click node_community_api "https://github.com/veeresh-math/chama-ai/blob/main/src/app/api/communities/route.ts"
click node_community_detail_api "https://github.com/veeresh-math/chama-ai/blob/main/src/app/api/communities/%5Bid%5D/route.ts"
click node_distribution_api "https://github.com/veeresh-math/chama-ai/blob/main/src/app/api/communities/%5Bid%5D/distribute/route.ts"
click node_agent "https://github.com/veeresh-math/chama-ai/blob/main/src/lib/agent.ts"
click node_paypal "https://github.com/veeresh-math/chama-ai/blob/main/src/lib/paypal.ts"
click node_queue "https://github.com/veeresh-math/chama-ai/blob/main/src/lib/queue.ts"
click node_supabase "https://github.com/veeresh-math/chama-ai/blob/main/src/lib/supabase.ts"
click node_db_client "https://github.com/veeresh-math/chama-ai/blob/main/src/db/index.ts"
click node_schema "https://github.com/veeresh-math/chama-ai/blob/main/src/db/schema.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_home,node_dashboard,node_communities_ui,node_analytics,node_copilot_ui,node_gigs_ui,node_ui_components toneBlue
class node_auth_api,node_community_api,node_community_detail_api,node_distribution_api toneAmber
class node_agent,node_paypal,node_queue toneMint
class node_supabase,node_db_client,node_schema toneRose
class node_member toneIndigo
```

## Components

### User experience

- [Landing page](https://github.com/veeresh-math/chama-ai/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Dashboard shell](https://github.com/veeresh-math/chama-ai/blob/main/src/components/dashboard-layout.tsx): `src/components/dashboard-layout.tsx`
- [Community management](https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/communities/page.tsx): `src/app/(dashboard)/communities/page.tsx`
- [Analytics](https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/analytics/page.tsx): `src/app/(dashboard)/analytics/page.tsx`
- [AI copilot](https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/copilot/page.tsx): `src/app/(dashboard)/copilot/page.tsx`
- [Gig marketplace](https://github.com/veeresh-math/chama-ai/blob/main/src/app/(dashboard)/gigs/page.tsx): `src/app/(dashboard)/gigs/page.tsx`
- [UI components](https://github.com/veeresh-math/chama-ai/tree/main/src/components/ui): `src/components/ui`

### Application API

- [Authentication API](https://github.com/veeresh-math/chama-ai/tree/main/src/app/api/auth): `src/app/api/auth`
- [Community API](https://github.com/veeresh-math/chama-ai/blob/main/src/app/api/communities/route.ts): `src/app/api/communities/route.ts`
- [Community detail API](https://github.com/veeresh-math/chama-ai/blob/main/src/app/api/communities/%5Bid%5D/route.ts): `src/app/api/communities/[id]/route.ts`
- [Distribution API](https://github.com/veeresh-math/chama-ai/blob/main/src/app/api/communities/%5Bid%5D/distribute/route.ts): `src/app/api/communities/[id]/distribute/route.ts`

### Financial services

- [Financial agent](https://github.com/veeresh-math/chama-ai/blob/main/src/lib/agent.ts): `src/lib/agent.ts`
- [PayPal payments](https://github.com/veeresh-math/chama-ai/blob/main/src/lib/paypal.ts): `src/lib/paypal.ts`
- [Job queue](https://github.com/veeresh-math/chama-ai/blob/main/src/lib/queue.ts): `src/lib/queue.ts`

### Identity and data

- [Supabase auth](https://github.com/veeresh-math/chama-ai/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Database client](https://github.com/veeresh-math/chama-ai/blob/main/src/db/index.ts): `src/db/index.ts`
- [Financial records](https://github.com/veeresh-math/chama-ai/blob/main/src/db/schema.ts): `src/db/schema.ts`

### Other components

- **Community member**

## Connections

- Community member → Landing page: opens (evidence: `README.md`)
- Community member → Authentication API: authenticates
- Community member → Community management: manages groups
- Community member → Analytics: reviews trends
- Community member → AI copilot: requests insights
- Community member → Gig marketplace: uses gigs
- Authentication API → Supabase auth: verifies users (evidence: `src/app/api/auth/me/route.ts`)
- Authentication API → Database client: reads and writes (evidence: `src/app/api/auth/signup/route.ts`)
- Community API → Supabase auth: verifies users (evidence: `src/app/api/communities/route.ts`)
- Community API → Database client: reads and writes (evidence: `src/app/api/communities/route.ts`)
- Community detail API → Supabase auth: verifies users (evidence: `src/app/api/communities/[id]/route.ts`)
- Community detail API → Database client: reads records (evidence: `src/app/api/communities/[id]/route.ts`)
- Distribution API → Supabase auth: verifies users (evidence: `src/app/api/communities/[id]/distribute/route.ts`)
- Distribution API → Database client: records payout (evidence: `src/app/api/communities/[id]/distribute/route.ts`)
- Distribution API → PayPal payments: sends payouts (evidence: `src/app/api/communities/[id]/distribute/route.ts`)
- Financial agent → Database client: queries finances (evidence: `src/lib/agent.ts`)
- Financial agent → PayPal payments: creates payments (evidence: `src/lib/agent.ts`)
- Database client → Financial records: loads schema (evidence: `src/db/index.ts`)
