# yourfzz/yapping architecture

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

- Interactive diagram: https://gitdiagram.com/yourfzz/yapping
- Repository: https://github.com/yourfzz/yapping

## Overview

Yapping is an anonymous, real-time chat web app. Users set a display name, create or join a room, then exchange messages while seeing online presence; leaving can trigger deletion of an empty room. The page handles room discovery and selection, while the chat component owns message, presence, and cleanup behavior through the Supabase client. The README documents realtime, anonymous use, room lifecycle, and UI features; source excerpts confirm the main calls. UI primitives are grouped to keep the graph focused.

Main entry points: [`components/ChatRoom.tsx`](https://github.com/yourfzz/yapping/blob/master/components/ChatRoom.tsx) (Chat Room), [`app/page.tsx`](https://github.com/yourfzz/yapping/blob/master/app/page.tsx) (Room Discovery), [`lib/supabase.ts`](https://github.com/yourfzz/yapping/blob/master/lib/supabase.ts) (Supabase Client), [`components/ui`](https://github.com/yourfzz/yapping/tree/master/components/ui) (UI Primitives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Room Entry"]
  node_room_entry["Room Discovery<br/>[page.tsx]"]
end

subgraph group_chat["Chat Session"]
  node_chat_room["Chat Room<br/>[ChatRoom.tsx]"]
end

subgraph group_backend["Backend"]
  node_supabase_client["Supabase Client<br/>[supabase.ts]"]
  node_supabase[("Supabase")]
  node_rooms_table[("Rooms Table")]
  node_messages_table[("Messages Table")]
end

subgraph group_ui["UI Components"]
  node_ui_primitives["UI Primitives"]
  node_layout["App Layout<br/>[layout.tsx]"]
end

node_visitor(("Visitor"))

node_visitor -->|"sets identity"| node_room_entry
node_room_entry -->|"loads rooms"| node_supabase_client
node_room_entry -->|"creates rooms"| node_rooms_table
node_room_entry -->|"opens selected room"| node_chat_room
node_room_entry -->|"renders controls"| node_ui_primitives
node_chat_room -->|"uses client"| node_supabase_client
node_chat_room -->|"loads and sends"| node_messages_table
node_chat_room -->|"subscribes realtime"| node_supabase
node_chat_room -->|"tracks presence"| node_supabase
node_chat_room -->|"deletes empty room"| node_rooms_table
node_chat_room -->|"renders chat UI"| node_ui_primitives
node_supabase_client -->|"connects to"| node_supabase
node_supabase -->|"stores room data"| node_rooms_table
node_supabase -->|"stores messages"| node_messages_table
node_room_entry -->|"returns to list"| node_visitor
node_layout -.->|"wraps page"| node_room_entry

click node_room_entry "https://github.com/yourfzz/yapping/blob/master/app/page.tsx"
click node_chat_room "https://github.com/yourfzz/yapping/blob/master/components/ChatRoom.tsx"
click node_supabase_client "https://github.com/yourfzz/yapping/blob/master/lib/supabase.ts"
click node_ui_primitives "https://github.com/yourfzz/yapping/tree/master/components/ui"
click node_layout "https://github.com/yourfzz/yapping/blob/master/app/layout.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_room_entry toneBlue
class node_chat_room toneAmber
class node_supabase_client,node_supabase,node_rooms_table,node_messages_table toneMint
class node_ui_primitives,node_layout toneRose
class node_visitor toneIndigo
```

## Components

### Room Entry

- [Room Discovery](https://github.com/yourfzz/yapping/blob/master/app/page.tsx): `app/page.tsx`

### Chat Session

- [Chat Room](https://github.com/yourfzz/yapping/blob/master/components/ChatRoom.tsx): `components/ChatRoom.tsx`

### Backend

- [Supabase Client](https://github.com/yourfzz/yapping/blob/master/lib/supabase.ts): `lib/supabase.ts`
- **Supabase**
- **Rooms Table**
- **Messages Table**

### UI Components

- [UI Primitives](https://github.com/yourfzz/yapping/tree/master/components/ui): `components/ui`
- [App Layout](https://github.com/yourfzz/yapping/blob/master/app/layout.tsx): `app/layout.tsx`

### Other components

- **Visitor**

## Connections

- Visitor → Room Discovery: sets identity (evidence: `README.md`)
- Room Discovery → Supabase Client: loads rooms (evidence: `app/page.tsx`)
- Room Discovery → Rooms Table: creates rooms (evidence: `app/page.tsx`)
- Room Discovery → Chat Room: opens selected room (evidence: `app/page.tsx`)
- Room Discovery → UI Primitives: renders controls (evidence: `app/page.tsx`)
- Chat Room → Supabase Client: uses client (evidence: `components/ChatRoom.tsx`)
- Chat Room → Messages Table: loads and sends (evidence: `components/ChatRoom.tsx`)
- Chat Room → Supabase: subscribes realtime (evidence: `README.md`)
- Chat Room → Supabase: tracks presence (evidence: `components/ChatRoom.tsx`)
- Chat Room → Rooms Table: deletes empty room (evidence: `components/ChatRoom.tsx`)
- Chat Room → UI Primitives: renders chat UI (evidence: `components/ChatRoom.tsx`)
- Supabase Client → Supabase: connects to (evidence: `lib/supabase.ts`)
- Supabase → Rooms Table: stores room data (evidence: `README.md`)
- Supabase → Messages Table: stores messages (evidence: `README.md`)
- Room Discovery → Visitor: returns to list (evidence: `app/page.tsx`)
- App Layout → Room Discovery: wraps page
