# jun8k2003/chatransceiver architecture

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

- Interactive diagram: https://gitdiagram.com/jun8k2003/chatransceiver
- Repository: https://github.com/jun8k2003/chatransceiver

## Overview

Chatransceiver is a browser-based, PWA-capable push-to-talk chat app. A user signs in, joins a community, selects a person or group, then sends a short recording or text; incoming messages can be replayed or spoken aloud, and background notifications support receiving messages when the app is closed. The graph includes the documented group, audio, notification, and customization capabilities. Some backend wiring is documented only at a high level; dashed edges mark relationships not verified in the shown source.

Main entry points: [`src/app.ts`](https://github.com/jun8k2003/chatransceiver/blob/main/src/app.ts) (App orchestration), [`src/ui/controller.ts`](https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/controller.ts) (UI controller), [`src/services/FCMService.ts`](https://github.com/jun8k2003/chatransceiver/blob/main/src/services/FCMService.ts) (Push client), [`supabase/functions/send-push-notification/index.ts`](https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/send-push-notification/index.ts) (Push notification function)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Chat experience"]
  node_app["App orchestration<br/>[app.ts]"]
  node_controller["UI controller<br/>[controller.ts]"]
  node_community["Community menu<br/>[community.ts]"]
  node_list["Chat list<br/>[list.ts]"]
  node_chat["Chat window<br/>[chat.ts]"]
end

subgraph group_audio["Audio interaction"]
  node_audio_manager["Audio manager<br/>[manager.ts]"]
  node_playback_queue["Playback queue<br/>[queue.ts]"]
  node_media_ptt["Media-button PTT<br/>[mediabutton.ts]"]
end

subgraph group_platform["Platform services"]
  node_wake_lock["Screen wake lock<br/>[wakelock.ts]"]
  node_fcm["Push client<br/>[FCMService.ts]"]
  node_badge["Unread badge<br/>[appbadge.ts]"]
  node_local_db[("Background image store<br/>[db.ts]")]
end

subgraph group_backend["Backend services"]
  node_supabase_service["Supabase service<br/>[supabase.ts]"]
  node_supabase[("Supabase")]
  node_register_token["Token registration<br/>[index.ts]"]
  node_push_function["Push notification function<br/>[index.ts]"]
  node_delete_audio["Audio cleanup function<br/>[index.ts]"]
  node_transcribe["Transcription function<br/>[index.ts]"]
end

node_user(("User"))
node_firebase["Firebase messaging"]
node_discord["Discord webhook"]
node_speech_api["Browser speech APIs"]

node_user -->|"uses"| node_app
node_app -->|"initializes"| node_controller
node_controller -->|"initializes"| node_community
node_controller -->|"initializes"| node_list
node_controller -->|"renders"| node_chat
node_app -->|"loads chat data"| node_supabase_service
node_supabase_service -->|"reads and writes"| node_supabase
node_app -->|"controls recording"| node_audio_manager
node_app -->|"queues playback"| node_playback_queue
node_playback_queue -->|"plays audio and speech"| node_audio_manager
node_audio_manager -->|"recognizes and speaks"| node_speech_api
node_app -->|"controls PTT"| node_media_ptt
node_app -->|"controls wake lock"| node_wake_lock
node_app -->|"configures notifications"| node_fcm
node_app -->|"updates badge"| node_badge
node_app -->|"stores background image"| node_local_db
node_fcm -->|"gets session"| node_supabase_service
node_fcm -->|"registers token"| node_register_token
node_register_token -.->|"stores token"| node_supabase
node_push_function -->|"sends push"| node_firebase
node_push_function -->|"sends webhook"| node_discord
node_delete_audio -.->|"deletes stored audio"| node_supabase
node_transcribe -.->|"transcribes audio"| node_speech_api
node_supabase -.->|"triggers on messages"| node_push_function
node_supabase -->|"triggers on deletion"| node_delete_audio
node_app -.->|"requests transcription"| node_transcribe

click node_app "https://github.com/jun8k2003/chatransceiver/blob/main/src/app.ts"
click node_controller "https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/controller.ts"
click node_community "https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/community.ts"
click node_list "https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/list.ts"
click node_chat "https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/chat.ts"
click node_audio_manager "https://github.com/jun8k2003/chatransceiver/blob/main/src/audio/manager.ts"
click node_playback_queue "https://github.com/jun8k2003/chatransceiver/blob/main/src/audio/queue.ts"
click node_media_ptt "https://github.com/jun8k2003/chatransceiver/blob/main/src/services/mediabutton.ts"
click node_wake_lock "https://github.com/jun8k2003/chatransceiver/blob/main/src/services/wakelock.ts"
click node_fcm "https://github.com/jun8k2003/chatransceiver/blob/main/src/services/FCMService.ts"
click node_badge "https://github.com/jun8k2003/chatransceiver/blob/main/src/services/appbadge.ts"
click node_local_db "https://github.com/jun8k2003/chatransceiver/blob/main/src/utils/db.ts"
click node_supabase_service "https://github.com/jun8k2003/chatransceiver/blob/main/src/services/supabase.ts"
click node_register_token "https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/register-fcm-token/index.ts"
click node_push_function "https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/send-push-notification/index.ts"
click node_delete_audio "https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/delete-audio-on-message-delete/index.ts"
click node_transcribe "https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/transcribe-audio-message/index.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_app,node_controller,node_community,node_list,node_chat,node_user,node_speech_api toneBlue
class node_audio_manager,node_playback_queue,node_media_ptt toneAmber
class node_wake_lock,node_fcm,node_badge,node_local_db,node_discord toneMint
class node_supabase_service,node_supabase,node_register_token,node_push_function,node_delete_audio,node_transcribe toneRose
class node_firebase toneIndigo
```

## Components

### Chat experience

- [App orchestration](https://github.com/jun8k2003/chatransceiver/blob/main/src/app.ts): `src/app.ts`
- [UI controller](https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/controller.ts): `src/ui/controller.ts`
- [Community menu](https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/community.ts): `src/ui/community.ts`
- [Chat list](https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/list.ts): `src/ui/list.ts`
- [Chat window](https://github.com/jun8k2003/chatransceiver/blob/main/src/ui/chat.ts): `src/ui/chat.ts`

### Audio interaction

- [Audio manager](https://github.com/jun8k2003/chatransceiver/blob/main/src/audio/manager.ts): `src/audio/manager.ts`
- [Playback queue](https://github.com/jun8k2003/chatransceiver/blob/main/src/audio/queue.ts): `src/audio/queue.ts`
- [Media-button PTT](https://github.com/jun8k2003/chatransceiver/blob/main/src/services/mediabutton.ts): `src/services/mediabutton.ts`

### Platform services

- [Screen wake lock](https://github.com/jun8k2003/chatransceiver/blob/main/src/services/wakelock.ts): `src/services/wakelock.ts`
- [Push client](https://github.com/jun8k2003/chatransceiver/blob/main/src/services/FCMService.ts): `src/services/FCMService.ts`
- [Unread badge](https://github.com/jun8k2003/chatransceiver/blob/main/src/services/appbadge.ts): `src/services/appbadge.ts`
- [Background image store](https://github.com/jun8k2003/chatransceiver/blob/main/src/utils/db.ts): `src/utils/db.ts`

### Backend services

- [Supabase service](https://github.com/jun8k2003/chatransceiver/blob/main/src/services/supabase.ts): `src/services/supabase.ts`
- **Supabase**
- [Token registration](https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/register-fcm-token/index.ts): `supabase/functions/register-fcm-token/index.ts`
- [Push notification function](https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/send-push-notification/index.ts): `supabase/functions/send-push-notification/index.ts`
- [Audio cleanup function](https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/delete-audio-on-message-delete/index.ts): `supabase/functions/delete-audio-on-message-delete/index.ts`
- [Transcription function](https://github.com/jun8k2003/chatransceiver/blob/main/supabase/functions/transcribe-audio-message/index.ts): `supabase/functions/transcribe-audio-message/index.ts`

### Other components

- **User**
- **Firebase messaging**
- **Discord webhook**
- **Browser speech APIs**

## Connections

- User → App orchestration: uses (evidence: `README.md`)
- App orchestration → UI controller: initializes (evidence: `src/app.ts`)
- UI controller → Community menu: initializes (evidence: `src/ui/controller.ts`)
- UI controller → Chat list: initializes (evidence: `src/ui/controller.ts`)
- UI controller → Chat window: renders (evidence: `src/ui/controller.ts`)
- App orchestration → Supabase service: loads chat data (evidence: `src/app.ts`)
- Supabase service → Supabase: reads and writes (evidence: `src/services/supabase.ts`)
- App orchestration → Audio manager: controls recording (evidence: `src/app.ts`)
- App orchestration → Playback queue: queues playback (evidence: `src/app.ts`)
- Playback queue → Audio manager: plays audio and speech (evidence: `src/audio/queue.ts`)
- Audio manager → Browser speech APIs: recognizes and speaks (evidence: `README.md`)
- App orchestration → Media-button PTT: controls PTT (evidence: `src/app.ts`)
- App orchestration → Screen wake lock: controls wake lock (evidence: `src/app.ts`)
- App orchestration → Push client: configures notifications (evidence: `src/app.ts`)
- App orchestration → Unread badge: updates badge (evidence: `src/app.ts`)
- App orchestration → Background image store: stores background image (evidence: `src/app.ts`)
- Push client → Supabase service: gets session (evidence: `src/services/FCMService.ts`)
- Push client → Token registration: registers token (evidence: `src/services/FCMService.ts`)
- Token registration → Supabase: stores token · Inferred; not shown in the code that was read.
- Push notification function → Firebase messaging: sends push (evidence: `README.md`)
- Push notification function → Discord webhook: sends webhook (evidence: `README.md`)
- Audio cleanup function → Supabase: deletes stored audio · Inferred; not shown in the code that was read.
- Transcription function → Browser speech APIs: transcribes audio · Inferred; not shown in the code that was read.
- Supabase → Push notification function: triggers on messages · Inferred; not shown in the code that was read.
- Supabase → Audio cleanup function: triggers on deletion (evidence: `README.md`)
- App orchestration → Transcription function: requests transcription · Inferred; not shown in the code that was read.
