# nznazmul/cha-adda architecture

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

- Interactive diagram: https://gitdiagram.com/nznazmul/cha-adda
- Repository: https://github.com/nznazmul/cha-adda

## Overview

CHA ADDA is a mobile-first adult dating and matchmaking application. Members register, complete an age-checked profile, discover and swipe on candidates, form mutual matches, and chat; profile, safety, subscription, and location features support that journey. Moderators use a separate dashboard for metrics, user and photo review, reports, verification, settings, and audit history. The sampled source confirms key discovery, matching, authentication, and data-access calls; other major capabilities and their links are retained where the README documents them. Several route and service implementations were not sampled, so their detailed wiring is not asserted.

Main entry points: [`lib/services/matching-service.ts`](https://github.com/nznazmul/cha-adda/blob/main/lib/services/matching-service.ts) (Matching engine), [`components/providers/auth-context.tsx`](https://github.com/nznazmul/cha-adda/blob/main/components/providers/auth-context.tsx) (Auth context), [`lib/services/dev-store.ts`](https://github.com/nznazmul/cha-adda/blob/main/lib/services/dev-store.ts) (Local dev store), [`app/onboarding/page.tsx`](https://github.com/nznazmul/cha-adda/blob/main/app/onboarding/page.tsx) (Profile onboarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_member["Member experience"]
  node_registration["Register and login<br/>[page.tsx]"]
  node_onboarding["Profile onboarding<br/>[page.tsx]"]
  node_profile["Profile management<br/>[page.tsx]"]
  node_verification["Member verification"]
end

subgraph group_matching["Discovery and matching"]
  node_discovery["Swipe discovery<br/>[page.tsx]"]
  node_likes["Likes and matches<br/>[page.tsx]"]
  node_matchlist["Match list<br/>[page.tsx]"]
  node_matchingservice["Matching engine"]
  node_geo["Location distance<br/>[geo-service.ts]"]
  node_preferences["Discovery preferences"]
end

subgraph group_conversation["Conversation and safety"]
  node_chat["Live conversation<br/>[page.tsx]"]
  node_chatservice["Chat service<br/>[chat-service.ts]"]
  node_encryption["Message encryption<br/>[e2ee.ts]"]
  node_safety["Safety and reports<br/>[safety-service.ts]"]
end

subgraph group_admin["Administration"]
  node_adminui["Admin dashboard<br/>[page.tsx]"]
  node_adminservice["Admin operations<br/>[admin-service.ts]"]
  node_adminroutes["Admin API<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth["Auth context<br/>[auth-context.tsx]"]
  node_devstore[("Local dev store<br/>[dev-store.ts]")]
  node_supabase[("Supabase platform")]
  node_schema["Domain data types<br/>[database.ts]"]
end

node_member(("Member"))

node_member -->|"registers"| node_registration
node_registration -->|"authenticates"| node_auth
node_member -->|"creates profile"| node_onboarding
node_onboarding -->|"uses session"| node_auth
node_member -->|"swipes candidates"| node_discovery
node_discovery -->|"loads candidates"| node_matchingservice
node_discovery -->|"saves filters"| node_preferences
node_matchingservice -->|"calculates distance"| node_geo
node_matchingservice -->|"loads preferences"| node_preferences
node_matchingservice -->|"uses local fallback"| node_devstore
node_matchingservice -->|"records swipes"| node_supabase
node_likes -->|"loads likes"| node_matchingservice
node_matchlist -->|"loads matches"| node_matchingservice
node_member -->|"opens match chat"| node_chat
node_chat -->|"sends messages"| node_chatservice
node_chatservice -->|"encrypts messages"| node_encryption
node_chatservice -->|"uses realtime"| node_supabase
node_chat -->|"invokes safety actions"| node_safety
node_profile -->|"requests verification"| node_verification
node_member -->|"edits profile"| node_profile
node_member -->|"moderates"| node_adminui
node_adminui -->|"manages accounts"| node_adminservice
node_adminui -.->|"loads admin data"| node_adminroutes
node_adminroutes -->|"uses local fallback"| node_devstore
node_adminroutes -.->|"queries platform data"| node_supabase
node_auth -->|"loads local user"| node_devstore
node_auth -->|"checks session"| node_supabase
node_onboarding -.->|"stores profile"| node_supabase
node_profile -->|"persists profile"| node_devstore
node_matchingservice -->|"uses domain types"| node_schema

click node_registration "https://github.com/nznazmul/cha-adda/blob/main/app/register/page.tsx"
click node_onboarding "https://github.com/nznazmul/cha-adda/blob/main/app/onboarding/page.tsx"
click node_profile "https://github.com/nznazmul/cha-adda/blob/main/app/profile/page.tsx"
click node_discovery "https://github.com/nznazmul/cha-adda/blob/main/app/discover/page.tsx"
click node_likes "https://github.com/nznazmul/cha-adda/blob/main/app/likes/page.tsx"
click node_matchlist "https://github.com/nznazmul/cha-adda/blob/main/app/matches/page.tsx"
click node_matchingservice "https://github.com/nznazmul/cha-adda/blob/main/lib/services/matching-service.ts"
click node_geo "https://github.com/nznazmul/cha-adda/blob/main/lib/services/geo-service.ts"
click node_preferences "https://github.com/nznazmul/cha-adda/blob/main/lib/services/preferences-service.ts"
click node_chat "https://github.com/nznazmul/cha-adda/blob/main/app/chat/%5BmatchId%5D/page.tsx"
click node_chatservice "https://github.com/nznazmul/cha-adda/blob/main/lib/services/chat-service.ts"
click node_encryption "https://github.com/nznazmul/cha-adda/blob/main/lib/security/e2ee.ts"
click node_safety "https://github.com/nznazmul/cha-adda/blob/main/lib/services/safety-service.ts"
click node_verification "https://github.com/nznazmul/cha-adda/blob/main/lib/services/verification-service.ts"
click node_adminui "https://github.com/nznazmul/cha-adda/blob/main/app/admin/page.tsx"
click node_adminservice "https://github.com/nznazmul/cha-adda/blob/main/lib/services/admin-service.ts"
click node_adminroutes "https://github.com/nznazmul/cha-adda/blob/main/app/api/admin/users/route.ts"
click node_auth "https://github.com/nznazmul/cha-adda/blob/main/components/providers/auth-context.tsx"
click node_devstore "https://github.com/nznazmul/cha-adda/blob/main/lib/services/dev-store.ts"
click node_schema "https://github.com/nznazmul/cha-adda/blob/main/types/database.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_registration,node_onboarding,node_profile,node_verification toneBlue
class node_discovery,node_likes,node_matchlist,node_matchingservice,node_geo,node_preferences toneAmber
class node_chat,node_chatservice,node_encryption,node_safety toneMint
class node_adminui,node_adminservice,node_adminroutes toneRose
class node_auth,node_devstore,node_supabase,node_schema,node_member toneIndigo
```

## Components

### Member experience

- [Register and login](https://github.com/nznazmul/cha-adda/blob/main/app/register/page.tsx): `app/register/page.tsx`
- [Profile onboarding](https://github.com/nznazmul/cha-adda/blob/main/app/onboarding/page.tsx): `app/onboarding/page.tsx`
- [Profile management](https://github.com/nznazmul/cha-adda/blob/main/app/profile/page.tsx): `app/profile/page.tsx`
- [Member verification](https://github.com/nznazmul/cha-adda/blob/main/lib/services/verification-service.ts): `lib/services/verification-service.ts`

### Discovery and matching

- [Swipe discovery](https://github.com/nznazmul/cha-adda/blob/main/app/discover/page.tsx): `app/discover/page.tsx`
- [Likes and matches](https://github.com/nznazmul/cha-adda/blob/main/app/likes/page.tsx): `app/likes/page.tsx`
- [Match list](https://github.com/nznazmul/cha-adda/blob/main/app/matches/page.tsx): `app/matches/page.tsx`
- [Matching engine](https://github.com/nznazmul/cha-adda/blob/main/lib/services/matching-service.ts): `lib/services/matching-service.ts`
- [Location distance](https://github.com/nznazmul/cha-adda/blob/main/lib/services/geo-service.ts): `lib/services/geo-service.ts`
- [Discovery preferences](https://github.com/nznazmul/cha-adda/blob/main/lib/services/preferences-service.ts): `lib/services/preferences-service.ts`

### Conversation and safety

- [Live conversation](https://github.com/nznazmul/cha-adda/blob/main/app/chat/%5BmatchId%5D/page.tsx): `app/chat/[matchId]/page.tsx`
- [Chat service](https://github.com/nznazmul/cha-adda/blob/main/lib/services/chat-service.ts): `lib/services/chat-service.ts`
- [Message encryption](https://github.com/nznazmul/cha-adda/blob/main/lib/security/e2ee.ts): `lib/security/e2ee.ts`
- [Safety and reports](https://github.com/nznazmul/cha-adda/blob/main/lib/services/safety-service.ts): `lib/services/safety-service.ts`

### Administration

- [Admin dashboard](https://github.com/nznazmul/cha-adda/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Admin operations](https://github.com/nznazmul/cha-adda/blob/main/lib/services/admin-service.ts): `lib/services/admin-service.ts`
- [Admin API](https://github.com/nznazmul/cha-adda/blob/main/app/api/admin/users/route.ts): `app/api/admin/users/route.ts`

### Platform services

- [Auth context](https://github.com/nznazmul/cha-adda/blob/main/components/providers/auth-context.tsx): `components/providers/auth-context.tsx`
- [Local dev store](https://github.com/nznazmul/cha-adda/blob/main/lib/services/dev-store.ts): `lib/services/dev-store.ts`
- **Supabase platform**
- [Domain data types](https://github.com/nznazmul/cha-adda/blob/main/types/database.ts): `types/database.ts`

### Other components

- **Member**

## Connections

- Member → Register and login: registers
- Register and login → Auth context: authenticates (evidence: `app/register/page.tsx`)
- Member → Profile onboarding: creates profile
- Profile onboarding → Auth context: uses session (evidence: `app/onboarding/page.tsx`)
- Member → Swipe discovery: swipes candidates
- Swipe discovery → Matching engine: loads candidates (evidence: `app/discover/page.tsx`)
- Swipe discovery → Discovery preferences: saves filters (evidence: `app/discover/page.tsx`)
- Matching engine → Location distance: calculates distance (evidence: `lib/services/matching-service.ts`)
- Matching engine → Discovery preferences: loads preferences (evidence: `lib/services/matching-service.ts`)
- Matching engine → Local dev store: uses local fallback (evidence: `lib/services/matching-service.ts`)
- Matching engine → Supabase platform: records swipes
- Likes and matches → Matching engine: loads likes (evidence: `app/likes/page.tsx`)
- Match list → Matching engine: loads matches (evidence: `app/matches/page.tsx`)
- Member → Live conversation: opens match chat
- Live conversation → Chat service: sends messages (evidence: `app/chat/[matchId]/page.tsx`)
- Chat service → Message encryption: encrypts messages (evidence: `lib/services/chat-service.ts`)
- Chat service → Supabase platform: uses realtime
- Live conversation → Safety and reports: invokes safety actions (evidence: `app/chat/[matchId]/page.tsx`)
- Profile management → Member verification: requests verification (evidence: `app/profile/page.tsx`)
- Member → Profile management: edits profile
- Member → Admin dashboard: moderates
- Admin dashboard → Admin operations: manages accounts
- Admin dashboard → Admin API: loads admin data
- Admin API → Local dev store: uses local fallback (evidence: `app/api/admin/users/route.ts`)
- Admin API → Supabase platform: queries platform data
- Auth context → Local dev store: loads local user (evidence: `components/providers/auth-context.tsx`)
- Auth context → Supabase platform: checks session (evidence: `components/providers/auth-context.tsx`)
- Profile onboarding → Supabase platform: stores profile
- Profile management → Local dev store: persists profile (evidence: `app/profile/page.tsx`)
- Matching engine → Domain data types: uses domain types (evidence: `lib/services/matching-service.ts`)
