# dinh-huu-phuc/couple architecture

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

- Interactive diagram: https://gitdiagram.com/dinh-huu-phuc/couple
- Repository: https://github.com/dinh-huu-phuc/couple

## Overview

Couple is a private shared space for partners to connect, write wishes, draw a partner’s wish, respond, and save completed moments as memories. The main user journey is documented in the README; the sampled source confirms the web app’s Supabase client and key admin and deletion flows. Several feature implementations and their runtime wiring were not sampled, so those workflow links are attributed to the README rather than inferred from imports.

Main entry points: [`fe/apps/admin/src/admin/dashboard.tsx`](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/dashboard.tsx) (Admin console), [`fe/apps/admin/src/admin/server.ts`](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/server.ts) (Admin actions), [`fe/apps/admin/src/app/api/inactivity-cleanup/route.ts`](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/app/api/inactivity-cleanup/route.ts) (Inactivity cleanup), [`be/supabase/functions/delete-account/index.ts`](https://github.com/dinh-huu-phuc/couple/blob/main/be/supabase/functions/delete-account/index.ts) (Deletion endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Couple web app"]
  node_webapp["Couple app"]
  node_auth["Account access<br/>[auth-form.tsx]"]
  node_connect["Partner connection<br/>[connect-page.tsx]"]
  node_wishes["Wish box<br/>[wishes-page.tsx]"]
  node_draws["Wish draws<br/>[draw-card.tsx]"]
  node_chat["Gentle responses<br/>[chat-page.tsx]"]
  node_memories["Shared memories<br/>[memories-page.tsx]"]
  node_settings["Profile settings<br/>[settings-page.tsx]"]
  node_support["User support<br/>[support-page.tsx]"]
  node_websupabase["Server Supabase client<br/>[server.ts]"]
end

subgraph group_admin["Administration"]
  node_adminui["Admin console<br/>[dashboard.tsx]"]
  node_adminapi["Admin actions<br/>[server.ts]"]
  node_adminaccounts["Account operations<br/>[accounts.tsx]"]
  node_adminfeedback["Feedback moderation<br/>[feedback.tsx]"]
  node_operations["Operations data<br/>[operations-data.ts]"]
  node_cleanup["Inactivity cleanup<br/>[route.ts]"]
end

subgraph group_landing["Public landing"]
  node_landingpage["Product landing<br/>[page.tsx]"]
  node_landingmotion["Landing motion<br/>[landing-motion.tsx]"]
end

subgraph group_services["Backend services"]
  node_adminauth["Admin credentials<br/>[auth.mjs]"]
  node_erasure["Account erasure<br/>[erasure.ts]"]
  node_deleteendpoint["Deletion endpoint<br/>[index.ts]"]
end

node_partner(("Partner"))
node_adminuser(("Administrator"))
node_supabase[("Supabase")]
node_visitor(("Site visitor"))

node_partner -->|"uses"| node_webapp
node_webapp -->|"opens account"| node_auth
node_auth -->|"then connects"| node_connect
node_connect -->|"then writes"| node_wishes
node_wishes -->|"partner discovers"| node_draws
node_draws -->|"responds to"| node_chat
node_chat -->|"records moment"| node_memories
node_partner -->|"manages profile"| node_settings
node_partner -.->|"requests help"| node_support
node_websupabase -->|"creates client"| node_supabase
node_adminuser -->|"uses"| node_adminui
node_adminui -->|"requests actions"| node_adminapi
node_adminapi -->|"checks credentials"| node_adminauth
node_adminapi -->|"calls admin RPCs"| node_supabase
node_adminapi -->|"uses operations data"| node_operations
node_adminui -->|"renders accounts"| node_adminaccounts
node_adminui -->|"renders feedback"| node_adminfeedback
node_cleanup -->|"cleans inactive"| node_erasure
node_cleanup -->|"uses backend client"| node_supabase
node_deleteendpoint -->|"runs erasure"| node_erasure
node_deleteendpoint -->|"uses auth and storage"| node_supabase
node_visitor -->|"views"| node_landingpage
node_landingpage -->|"renders motion"| node_landingmotion

click node_webapp "https://github.com/dinh-huu-phuc/couple/tree/main/fe/apps/web/src/app"
click node_auth "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/auth/auth-form.tsx"
click node_connect "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/connect/connect-page.tsx"
click node_wishes "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/wishes/wishes-page.tsx"
click node_draws "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/draws/draw-card.tsx"
click node_chat "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/chat/chat-page.tsx"
click node_memories "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/memories/memories-page.tsx"
click node_settings "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/settings/settings-page.tsx"
click node_support "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/support/support-page.tsx"
click node_websupabase "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/lib/supabase/server.ts"
click node_adminui "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/dashboard.tsx"
click node_adminapi "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/server.ts"
click node_adminauth "https://github.com/dinh-huu-phuc/couple/blob/main/be/admin/auth.mjs"
click node_adminaccounts "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/accounts.tsx"
click node_adminfeedback "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/feedback.tsx"
click node_operations "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/operations-data.ts"
click node_cleanup "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/app/api/inactivity-cleanup/route.ts"
click node_erasure "https://github.com/dinh-huu-phuc/couple/blob/main/be/supabase/functions/delete-account/erasure.ts"
click node_deleteendpoint "https://github.com/dinh-huu-phuc/couple/blob/main/be/supabase/functions/delete-account/index.ts"
click node_landingpage "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/landing/src/app/page.tsx"
click node_landingmotion "https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/landing/src/components/landing-motion.tsx"

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_webapp,node_auth,node_connect,node_wishes,node_draws,node_chat,node_memories,node_settings,node_support,node_websupabase toneBlue
class node_adminui,node_adminapi,node_adminaccounts,node_adminfeedback,node_operations,node_cleanup,node_supabase toneAmber
class node_landingpage,node_landingmotion toneMint
class node_adminauth,node_erasure,node_deleteendpoint toneRose
class node_partner,node_adminuser,node_visitor toneIndigo
```

## Components

### Couple web app

- [Couple app](https://github.com/dinh-huu-phuc/couple/tree/main/fe/apps/web/src/app): `fe/apps/web/src/app`
- [Account access](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/auth/auth-form.tsx): `fe/apps/web/src/features/auth/auth-form.tsx`
- [Partner connection](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/connect/connect-page.tsx): `fe/apps/web/src/features/connect/connect-page.tsx`
- [Wish box](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/wishes/wishes-page.tsx): `fe/apps/web/src/features/wishes/wishes-page.tsx`
- [Wish draws](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/draws/draw-card.tsx): `fe/apps/web/src/features/draws/draw-card.tsx`
- [Gentle responses](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/chat/chat-page.tsx): `fe/apps/web/src/features/chat/chat-page.tsx`
- [Shared memories](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/memories/memories-page.tsx): `fe/apps/web/src/features/memories/memories-page.tsx`
- [Profile settings](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/settings/settings-page.tsx): `fe/apps/web/src/features/settings/settings-page.tsx`
- [User support](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/features/support/support-page.tsx): `fe/apps/web/src/features/support/support-page.tsx`
- [Server Supabase client](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/web/src/lib/supabase/server.ts): `fe/apps/web/src/lib/supabase/server.ts`

### Administration

- [Admin console](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/dashboard.tsx): `fe/apps/admin/src/admin/dashboard.tsx`
- [Admin actions](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/server.ts): `fe/apps/admin/src/admin/server.ts`
- [Account operations](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/accounts.tsx): `fe/apps/admin/src/admin/accounts.tsx`
- [Feedback moderation](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/feedback.tsx): `fe/apps/admin/src/admin/feedback.tsx`
- [Operations data](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/admin/operations-data.ts): `fe/apps/admin/src/admin/operations-data.ts`
- [Inactivity cleanup](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/admin/src/app/api/inactivity-cleanup/route.ts): `fe/apps/admin/src/app/api/inactivity-cleanup/route.ts`

### Public landing

- [Product landing](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/landing/src/app/page.tsx): `fe/apps/landing/src/app/page.tsx`
- [Landing motion](https://github.com/dinh-huu-phuc/couple/blob/main/fe/apps/landing/src/components/landing-motion.tsx): `fe/apps/landing/src/components/landing-motion.tsx`

### Backend services

- [Admin credentials](https://github.com/dinh-huu-phuc/couple/blob/main/be/admin/auth.mjs): `be/admin/auth.mjs`
- [Account erasure](https://github.com/dinh-huu-phuc/couple/blob/main/be/supabase/functions/delete-account/erasure.ts): `be/supabase/functions/delete-account/erasure.ts`
- [Deletion endpoint](https://github.com/dinh-huu-phuc/couple/blob/main/be/supabase/functions/delete-account/index.ts): `be/supabase/functions/delete-account/index.ts`

### Other components

- **Partner**
- **Administrator**
- **Supabase**
- **Site visitor**

## Connections

- Partner → Couple app: uses (evidence: `README.md`)
- Couple app → Account access: opens account (evidence: `README.md`)
- Account access → Partner connection: then connects (evidence: `README.md`)
- Partner connection → Wish box: then writes (evidence: `README.md`)
- Wish box → Wish draws: partner discovers (evidence: `README.md`)
- Wish draws → Gentle responses: responds to (evidence: `README.md`)
- Gentle responses → Shared memories: records moment (evidence: `README.md`)
- Partner → Profile settings: manages profile (evidence: `README.md`)
- Partner → User support: requests help
- Server Supabase client → Supabase: creates client (evidence: `fe/apps/web/src/lib/supabase/server.ts`)
- Administrator → Admin console: uses
- Admin console → Admin actions: requests actions (evidence: `fe/apps/admin/src/admin/dashboard.tsx`)
- Admin actions → Admin credentials: checks credentials (evidence: `fe/apps/admin/src/admin/server.ts`)
- Admin actions → Supabase: calls admin RPCs (evidence: `fe/apps/admin/src/admin/server.ts`)
- Admin actions → Operations data: uses operations data (evidence: `fe/apps/admin/src/admin/server.ts`)
- Admin console → Account operations: renders accounts (evidence: `fe/apps/admin/src/admin/dashboard.tsx`)
- Admin console → Feedback moderation: renders feedback (evidence: `fe/apps/admin/src/admin/dashboard.tsx`)
- Inactivity cleanup → Account erasure: cleans inactive (evidence: `fe/apps/admin/src/app/api/inactivity-cleanup/route.ts`)
- Inactivity cleanup → Supabase: uses backend client (evidence: `fe/apps/admin/src/app/api/inactivity-cleanup/route.ts`)
- Deletion endpoint → Account erasure: runs erasure (evidence: `be/supabase/functions/delete-account/index.ts`)
- Deletion endpoint → Supabase: uses auth and storage (evidence: `be/supabase/functions/delete-account/index.ts`)
- Site visitor → Product landing: views (evidence: `fe/apps/landing/src/app/page.tsx`)
- Product landing → Landing motion: renders motion (evidence: `fe/apps/landing/src/app/page.tsx`)
