# limarich/broadcast-app architecture

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

- Interactive diagram: https://gitdiagram.com/limarich/broadcast-app
- Repository: https://github.com/limarich/broadcast-app

## Overview

Broadcast is a multi-account campaign manager: a user signs in, organizes contacts into connections, then sends messages immediately or schedules them for automatic status transition. The graph follows the documented route and the source-indexed calls between UI, Firestore services, and the scheduled function. Other documented pages and access controls are retained; unsampled implementation details and Firebase runtime wiring are not assumed.

Main entry points: [`web/src/App.tsx`](https://github.com/limarich/broadcast-app/blob/main/web/src/App.tsx) (Application routes), [`web/src/pages/MessagePage.tsx`](https://github.com/limarich/broadcast-app/blob/main/web/src/pages/MessagePage.tsx) (Campaign management), [`web/src/pages/ConnectionsPage.tsx`](https://github.com/limarich/broadcast-app/blob/main/web/src/pages/ConnectionsPage.tsx) (Connection management), [`web/src/pages/ContactsPage.tsx`](https://github.com/limarich/broadcast-app/blob/main/web/src/pages/ContactsPage.tsx) (Contact management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Account access"]
  node_routing["Application routes<br/>[App.tsx]"]
  node_auth_pages["Login and registration"]
  node_auth_context["Authentication state<br/>[AuthContext.tsx]"]
  node_private_route["Protected access<br/>[PrivateRoute.tsx]"]
  node_info_pages["Help and policies"]
end

subgraph group_workspace["Workspace management"]
  node_connections_page["Connection management"]
  node_connection_dialog["Connection editor"]
  node_connection_service["Connection operations"]
  node_connection_context["Active connection"]
  node_contacts_page["Contact management<br/>[ContactsPage.tsx]"]
  node_contact_dialog["Contact editor<br/>[ContactDialog.tsx]"]
  node_contact_service["Contact operations<br/>[contactService.ts]"]
  node_contact_feed["Live contacts<br/>[useContacts.ts]"]
end

subgraph group_campaigns["Message campaigns"]
  node_messages_page["Campaign management<br/>[MessagePage.tsx]"]
  node_message_dialog["Compose campaign<br/>[MessageDialog.tsx]"]
  node_message_detail["Campaign details"]
  node_message_service["Message operations<br/>[messageService.ts]"]
  node_message_feed["Live campaigns<br/>[useMessages.ts]"]
  node_dispatcher["Scheduled dispatcher<br/>[index.ts]"]
end

subgraph group_platform["Firebase platform"]
  node_firebase_client["Firebase client<br/>[firebase.ts]"]
  node_firestore[("Firestore data")]
  node_firebase_auth["Firebase Auth"]
end

node_user(("Account user"))

node_user -->|"opens app"| node_routing
node_routing -->|"routes auth"| node_auth_pages
node_routing -->|"guards workspace"| node_private_route
node_routing -->|"routes workspace"| node_connections_page
node_routing -->|"routes contacts"| node_contacts_page
node_routing -->|"routes campaigns"| node_messages_page
node_routing -->|"routes information"| node_info_pages
node_auth_pages -->|"uses auth"| node_auth_context
node_auth_context -->|"authenticates"| node_firebase_auth
node_private_route -->|"checks user"| node_auth_context
node_connections_page -->|"opens editor"| node_connection_dialog
node_connections_page -->|"manages connections"| node_connection_service
node_connections_page -->|"selects connection"| node_connection_context
node_connection_dialog -->|"saves connection"| node_connection_service
node_connection_service -->|"writes and deletes"| node_firestore
node_contacts_page -->|"opens editor"| node_contact_dialog
node_contacts_page -->|"manages contacts"| node_contact_service
node_contacts_page -->|"loads contacts"| node_contact_feed
node_contact_dialog -->|"saves contact"| node_contact_service
node_contact_service -->|"writes and queries"| node_firestore
node_contact_feed -->|"subscribes to contacts"| node_firestore
node_messages_page -->|"opens composer"| node_message_dialog
node_messages_page -->|"shows details"| node_message_detail
node_messages_page -->|"manages campaigns"| node_message_service
node_messages_page -->|"loads campaigns"| node_message_feed
node_message_dialog -->|"saves campaign"| node_message_service
node_message_service -->|"writes messages"| node_firestore
node_message_feed -->|"subscribes to messages"| node_firestore
node_dispatcher -->|"updates scheduled messages"| node_firestore
node_firebase_client -->|"initializes auth"| node_firebase_auth
node_firebase_client -->|"initializes database"| node_firestore

click node_routing "https://github.com/limarich/broadcast-app/blob/main/web/src/App.tsx"
click node_auth_pages "https://github.com/limarich/broadcast-app/tree/main/web/src/pages"
click node_auth_context "https://github.com/limarich/broadcast-app/blob/main/web/src/contexts/AuthContext.tsx"
click node_private_route "https://github.com/limarich/broadcast-app/blob/main/web/src/components/PrivateRoute.tsx"
click node_info_pages "https://github.com/limarich/broadcast-app/tree/main/web/src/pages"
click node_connections_page "https://github.com/limarich/broadcast-app/blob/main/web/src/pages/ConnectionsPage.tsx"
click node_connection_dialog "https://github.com/limarich/broadcast-app/blob/main/web/src/components/connections/ConnectionDialog.tsx"
click node_connection_service "https://github.com/limarich/broadcast-app/blob/main/web/src/services/connectionService.ts"
click node_connection_context "https://github.com/limarich/broadcast-app/blob/main/web/src/contexts/ConnectionContext.tsx"
click node_contacts_page "https://github.com/limarich/broadcast-app/blob/main/web/src/pages/ContactsPage.tsx"
click node_contact_dialog "https://github.com/limarich/broadcast-app/blob/main/web/src/components/contacts/ContactDialog.tsx"
click node_contact_service "https://github.com/limarich/broadcast-app/blob/main/web/src/services/contactService.ts"
click node_contact_feed "https://github.com/limarich/broadcast-app/blob/main/web/src/hooks/useContacts.ts"
click node_messages_page "https://github.com/limarich/broadcast-app/blob/main/web/src/pages/MessagePage.tsx"
click node_message_dialog "https://github.com/limarich/broadcast-app/blob/main/web/src/components/messages/MessageDialog.tsx"
click node_message_detail "https://github.com/limarich/broadcast-app/blob/main/web/src/components/messages/MessageDetailDialog.tsx"
click node_message_service "https://github.com/limarich/broadcast-app/blob/main/web/src/services/messageService.ts"
click node_message_feed "https://github.com/limarich/broadcast-app/blob/main/web/src/hooks/useMessages.ts"
click node_dispatcher "https://github.com/limarich/broadcast-app/blob/main/functions/src/index.ts"
click node_firebase_client "https://github.com/limarich/broadcast-app/blob/main/web/src/lib/firebase.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_routing,node_auth_pages,node_auth_context,node_private_route,node_info_pages,node_user toneBlue
class node_connections_page,node_connection_dialog,node_connection_service,node_connection_context,node_contacts_page,node_contact_dialog,node_contact_service,node_contact_feed toneAmber
class node_messages_page,node_message_dialog,node_message_detail,node_message_service,node_message_feed,node_dispatcher toneMint
class node_firebase_client,node_firestore,node_firebase_auth toneRose
```

## Components

### Account access

- [Application routes](https://github.com/limarich/broadcast-app/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Login and registration](https://github.com/limarich/broadcast-app/tree/main/web/src/pages): `web/src/pages`
- [Authentication state](https://github.com/limarich/broadcast-app/blob/main/web/src/contexts/AuthContext.tsx): `web/src/contexts/AuthContext.tsx`
- [Protected access](https://github.com/limarich/broadcast-app/blob/main/web/src/components/PrivateRoute.tsx): `web/src/components/PrivateRoute.tsx`
- [Help and policies](https://github.com/limarich/broadcast-app/tree/main/web/src/pages): `web/src/pages`

### Workspace management

- [Connection management](https://github.com/limarich/broadcast-app/blob/main/web/src/pages/ConnectionsPage.tsx): `web/src/pages/ConnectionsPage.tsx`
- [Connection editor](https://github.com/limarich/broadcast-app/blob/main/web/src/components/connections/ConnectionDialog.tsx): `web/src/components/connections/ConnectionDialog.tsx`
- [Connection operations](https://github.com/limarich/broadcast-app/blob/main/web/src/services/connectionService.ts): `web/src/services/connectionService.ts`
- [Active connection](https://github.com/limarich/broadcast-app/blob/main/web/src/contexts/ConnectionContext.tsx): `web/src/contexts/ConnectionContext.tsx`
- [Contact management](https://github.com/limarich/broadcast-app/blob/main/web/src/pages/ContactsPage.tsx): `web/src/pages/ContactsPage.tsx`
- [Contact editor](https://github.com/limarich/broadcast-app/blob/main/web/src/components/contacts/ContactDialog.tsx): `web/src/components/contacts/ContactDialog.tsx`
- [Contact operations](https://github.com/limarich/broadcast-app/blob/main/web/src/services/contactService.ts): `web/src/services/contactService.ts`
- [Live contacts](https://github.com/limarich/broadcast-app/blob/main/web/src/hooks/useContacts.ts): `web/src/hooks/useContacts.ts`

### Message campaigns

- [Campaign management](https://github.com/limarich/broadcast-app/blob/main/web/src/pages/MessagePage.tsx): `web/src/pages/MessagePage.tsx`
- [Compose campaign](https://github.com/limarich/broadcast-app/blob/main/web/src/components/messages/MessageDialog.tsx): `web/src/components/messages/MessageDialog.tsx`
- [Campaign details](https://github.com/limarich/broadcast-app/blob/main/web/src/components/messages/MessageDetailDialog.tsx): `web/src/components/messages/MessageDetailDialog.tsx`
- [Message operations](https://github.com/limarich/broadcast-app/blob/main/web/src/services/messageService.ts): `web/src/services/messageService.ts`
- [Live campaigns](https://github.com/limarich/broadcast-app/blob/main/web/src/hooks/useMessages.ts): `web/src/hooks/useMessages.ts`
- [Scheduled dispatcher](https://github.com/limarich/broadcast-app/blob/main/functions/src/index.ts): `functions/src/index.ts`

### Firebase platform

- [Firebase client](https://github.com/limarich/broadcast-app/blob/main/web/src/lib/firebase.ts): `web/src/lib/firebase.ts`
- **Firestore data**
- **Firebase Auth**

### Other components

- **Account user**

## Connections

- Account user → Application routes: opens app (evidence: `web/src/App.tsx`)
- Application routes → Login and registration: routes auth (evidence: `web/src/App.tsx`)
- Application routes → Protected access: guards workspace (evidence: `web/src/App.tsx`)
- Application routes → Connection management: routes workspace (evidence: `web/src/App.tsx`)
- Application routes → Contact management: routes contacts (evidence: `web/src/App.tsx`)
- Application routes → Campaign management: routes campaigns (evidence: `web/src/App.tsx`)
- Application routes → Help and policies: routes information (evidence: `web/src/App.tsx`)
- Login and registration → Authentication state: uses auth (evidence: `web/src/pages/LoginPage.tsx`)
- Authentication state → Firebase Auth: authenticates (evidence: `web/src/contexts/AuthContext.tsx`)
- Protected access → Authentication state: checks user (evidence: `web/src/components/PrivateRoute.tsx`)
- Connection management → Connection editor: opens editor (evidence: `web/src/pages/ConnectionsPage.tsx`)
- Connection management → Connection operations: manages connections (evidence: `web/src/pages/ConnectionsPage.tsx`)
- Connection management → Active connection: selects connection (evidence: `web/src/pages/ConnectionsPage.tsx`)
- Connection editor → Connection operations: saves connection (evidence: `web/src/components/connections/ConnectionDialog.tsx`)
- Connection operations → Firestore data: writes and deletes (evidence: `web/src/services/connectionService.ts`)
- Contact management → Contact editor: opens editor (evidence: `web/src/pages/ContactsPage.tsx`)
- Contact management → Contact operations: manages contacts (evidence: `web/src/pages/ContactsPage.tsx`)
- Contact management → Live contacts: loads contacts (evidence: `web/src/pages/ContactsPage.tsx`)
- Contact editor → Contact operations: saves contact (evidence: `web/src/components/contacts/ContactDialog.tsx`)
- Contact operations → Firestore data: writes and queries (evidence: `web/src/services/contactService.ts`)
- Live contacts → Firestore data: subscribes to contacts (evidence: `web/src/hooks/useContacts.ts`)
- Campaign management → Compose campaign: opens composer (evidence: `web/src/pages/MessagePage.tsx`)
- Campaign management → Campaign details: shows details (evidence: `web/src/pages/MessagePage.tsx`)
- Campaign management → Message operations: manages campaigns (evidence: `web/src/pages/MessagePage.tsx`)
- Campaign management → Live campaigns: loads campaigns (evidence: `web/src/pages/MessagePage.tsx`)
- Compose campaign → Message operations: saves campaign (evidence: `web/src/components/messages/MessageDialog.tsx`)
- Message operations → Firestore data: writes messages (evidence: `web/src/services/messageService.ts`)
- Live campaigns → Firestore data: subscribes to messages (evidence: `web/src/hooks/useMessages.ts`)
- Scheduled dispatcher → Firestore data: updates scheduled messages (evidence: `README.md`)
- Firebase client → Firebase Auth: initializes auth (evidence: `web/src/lib/firebase.ts`)
- Firebase client → Firestore data: initializes database (evidence: `web/src/lib/firebase.ts`)
