# felixnt0/fkt_calling_webapp architecture

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

- Interactive diagram: https://gitdiagram.com/felixnt0/fkt_calling_webapp
- Repository: https://github.com/felixnt0/fkt_calling_webapp

## Overview

#### Purpose and Runtime
This is a Next.js App Router application for creating, discovering, joining, and conducting online meetings. It combines browser-rendered meeting UI with server-side route handlers for meeting operations, chat, and Agora video-token issuance. The primary runtime is Next.js/React; deployment is compatible with Vercel per the project README.

#### Application Entry and Route Structure
The root application shell and public landing entry are:
- `src/app/layout.tsx`
- `src/app/page.tsx`
- `src/app/globals.css`

App Router pages expose meeting-specific navigation and general product pages. The central meeting lifecycle routes are:
- `src/app/[id]/page.tsx`
- `src/app/[id]/join/page.tsx`
- `src/app/[id]/room/page.tsx`

A meeting identifier is the boundary connecting meeting details, pre-join behavior, and the live room.

#### Meeting Lifecycle and State
Meeting creation and browsing are represented in UI components, while shared React context likely coordinates client-side meeting and user state:
- `src/components/CreateMeetingModal.tsx`
- `src/components/MeetingDetails.tsx`
- `src/context/MeetingContext.tsx`
- `src/context/UserContext.tsx`

The expected control flow is: users discover or create a meeting, navigate through an ID-scoped meeting page, optionally complete a join step, then enter the room. Context is the client-state boundary; API handlers are the persistence/service boundary.

#### Server API Boundary
Next.js route handlers provide the backend surface for meeting operations:
- `src/app/api/meeting/route.ts`
- `src/app/api/meeting/[id]/route.ts`
- `src/app/api/meeting/[id]/chat/route.ts`

These handlers separate browser UI from meeting resource management and per-meeting chat. `src/api/index.ts` is a separate API-facing module and may act as a client/service aggregation point.

#### Real-Time Video and Chat
Agora is the material external real-time communications service. Live-room rendering and Agora client integration are concentrated in:
- `src/components/AgoraCall.tsx`
- `src/components/Agora/AgoraVideoPlayer.tsx`
- `src/components/Agora/AgoraUIVideoPlayer.tsx`

Agora credentials/tokens are issued through:
- `src/app/api/meeting/agora/token/route.ts`
- `src/components/AgoraConfig.tsx`

The token endpoint is the security boundary between browser media clients and Agora credentials; live media should consume issued tokens rather than embed server secrets.

#### Identity and Data Infrastructure
Authentication-facing pages are:
- `src/app/auth/login/page.tsx`
- `src/app/auth/signup/page.tsx`

Firebase is an explicit infrastructure dependency, with administrative/server integration isolated in:
- `src/lib/firebaseAdmin.ts`
- `src/lib/schemas.ts`

This suggests Firebase-backed identity and/or meeting data, while schemas establish validation or shared data contracts. Server route handlers should own use of Firebase Admin credentials; client components should interact through APIs or client-safe providers.

#### Presentation and Operational Pages
The product includes discovery, profile, administration, and documentation surfaces:
- `src/app/explore/page.tsx`
- `src/app/profile/page.tsx`
- `src/app/admin/page.tsx`
- `src/app/api-docs/page.tsx`

Reusable navigation, provider composition, meeting cards, and room actions are centered in:
- `src/components/Providers.tsx`
- `src/components/NavBar.tsx`
- `src/components/MeetingCard.tsx`
- `src/components/BottomActionButtons.tsx`

Main entry points: [`src/components/AgoraCall.tsx`](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/AgoraCall.tsx) (Agora call UI), [`src/app/api/meeting/route.ts`](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/route.ts) (Meeting API), [`src/components/CreateMeetingModal.tsx`](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/CreateMeetingModal.tsx) (Discovery & meeting UI), [`src/app/[id]/room/page.tsx`](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/%5Bid%5D/room/page.tsx) (Live room)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Next.js client"]
  node_shell["App shell<br/>layout<br/>[layout.tsx]"]
  node_discovery["Discovery &amp; meeting UI<br/>components"]
  node_meeting_state["Meeting state<br/>React context<br/>[MeetingContext.tsx]"]
  node_api_client["API module<br/>service module<br/>[index.ts]"]
end

subgraph group_routes["App routes"]
  node_landing["Landing<br/>page<br/>[page.tsx]"]
  node_meeting_page["Meeting details<br/>dynamic page<br/>[page.tsx]"]
  node_join_page["Pre-join<br/>dynamic page<br/>[page.tsx]"]
  node_room_page["Live room<br/>dynamic page<br/>[page.tsx]"]
  node_product_pages["Product pages<br/>[page.tsx]"]
end

subgraph group_api["Server API"]
  node_meeting_api["Meeting API<br/>route handlers<br/>[route.ts]"]
  node_meeting_resource_api["Meeting resource API<br/>route handler<br/>[route.ts]"]
  node_chat_api["Meeting chat API<br/>route handler<br/>[route.ts]"]
  node_token_api["Agora token API<br/>route handler<br/>[route.ts]"]
end

subgraph group_realtime["Real-time media"]
  node_agora_call["Agora call UI<br/>React component<br/>[AgoraCall.tsx]"]
  node_video_players["Agora video players<br/>React components"]
end

subgraph group_infra["Infrastructure"]
  node_firebase_admin[("Firebase Admin<br/>server integration<br/>[firebaseAdmin.ts]")]
  node_schemas["Data schemas<br/>contracts<br/>[schemas.ts]"]
  node_agora{{"Agora<br/>external RTC service"}}
end

node_shell -->|"hosts"| node_landing
node_shell -->|"provides"| node_meeting_state
node_landing -->|"renders"| node_discovery
node_discovery -->|"reads and updates"| node_meeting_state
node_discovery -->|"creates and browses"| node_meeting_api
node_meeting_api -->|"persists through"| node_firebase_admin
node_meeting_api -->|"validates with"| node_schemas
node_meeting_page -->|"loads meeting"| node_meeting_resource_api
node_meeting_resource_api -->|"accesses"| node_firebase_admin
node_meeting_page -->|"continues to"| node_join_page
node_join_page -->|"enters"| node_room_page
node_room_page -->|"renders"| node_agora_call
node_agora_call -->|"uses"| node_video_players
node_agora_call -->|"requests token"| node_token_api
node_token_api -->|"issues access for"| node_agora
node_agora_call -->|"joins media channel"| node_agora
node_room_page -->|"uses chat"| node_chat_api
node_chat_api -->|"stores through"| node_firebase_admin
node_api_client -->|"calls"| node_meeting_api
node_product_pages -.->|"uses"| node_api_client

click node_shell "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/layout.tsx"
click node_landing "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/page.tsx"
click node_discovery "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/CreateMeetingModal.tsx"
click node_meeting_state "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/context/MeetingContext.tsx"
click node_meeting_page "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/%5Bid%5D/page.tsx"
click node_join_page "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/%5Bid%5D/join/page.tsx"
click node_room_page "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/%5Bid%5D/room/page.tsx"
click node_product_pages "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/explore/page.tsx"
click node_meeting_api "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/route.ts"
click node_meeting_resource_api "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/%5Bid%5D/route.ts"
click node_chat_api "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/%5Bid%5D/chat/route.ts"
click node_api_client "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/api/index.ts"
click node_agora_call "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/AgoraCall.tsx"
click node_video_players "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/Agora/AgoraVideoPlayer.tsx"
click node_token_api "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/agora/token/route.ts"
click node_firebase_admin "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/lib/firebaseAdmin.ts"
click node_schemas "https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/lib/schemas.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_shell,node_discovery,node_meeting_state,node_api_client toneBlue
class node_landing,node_meeting_page,node_join_page,node_room_page,node_product_pages toneAmber
class node_meeting_api,node_meeting_resource_api,node_chat_api,node_token_api toneMint
class node_agora_call,node_video_players toneRose
class node_firebase_admin,node_schemas,node_agora toneIndigo
```

## Components

### Next.js client

- [App shell](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/layout.tsx): layout · Root layout, global styles, and provider composition. · `src/app/layout.tsx`
- [Discovery & meeting UI](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/CreateMeetingModal.tsx): components · Meeting creation, browsing, cards, and navigation. · `src/components/CreateMeetingModal.tsx`
- [Meeting state](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/context/MeetingContext.tsx): React context · Client-side meeting and user state boundary. · `src/context/MeetingContext.tsx`
- [API module](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/api/index.ts): service module · API-facing client or service aggregation. · `src/api/index.ts`

### App routes

- [Landing](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/page.tsx): page · `src/app/page.tsx`
- [Meeting details](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/%5Bid%5D/page.tsx): dynamic page · ID-scoped meeting entry and details. · `src/app/[id]/page.tsx`
- [Pre-join](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/%5Bid%5D/join/page.tsx): dynamic page · `src/app/[id]/join/page.tsx`
- [Live room](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/%5Bid%5D/room/page.tsx): dynamic page · `src/app/[id]/room/page.tsx`
- [Product pages](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/explore/page.tsx): pages · Explore, profile, admin, and API documentation surfaces. · `src/app/explore/page.tsx`

### Server API

- [Meeting API](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/route.ts): route handlers · Creates and lists meeting resources. · `src/app/api/meeting/route.ts`
- [Meeting resource API](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/%5Bid%5D/route.ts): route handler · Reads or updates an ID-scoped meeting. · `src/app/api/meeting/[id]/route.ts`
- [Meeting chat API](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/%5Bid%5D/chat/route.ts): route handler · Per-meeting chat boundary. · `src/app/api/meeting/[id]/chat/route.ts`
- [Agora token API](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/app/api/meeting/agora/token/route.ts): route handler · Security boundary issuing browser media tokens. · `src/app/api/meeting/agora/token/route.ts`

### Real-time media

- [Agora call UI](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/AgoraCall.tsx): React component · Live-room media integration. · `src/components/AgoraCall.tsx`
- [Agora video players](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/components/Agora/AgoraVideoPlayer.tsx): React components · Renders remote and local video streams. · `src/components/Agora/AgoraVideoPlayer.tsx`

### Infrastructure

- [Firebase Admin](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/lib/firebaseAdmin.ts): server integration · Server-side identity and data access. · `src/lib/firebaseAdmin.ts`
- [Data schemas](https://github.com/felixnt0/fkt_calling_webapp/blob/main/src/lib/schemas.ts): contracts · Shared validation and data contracts. · `src/lib/schemas.ts`
- **Agora**: external RTC service · Real-time video communications provider.

## Connections

- App shell → Landing: hosts
- App shell → Meeting state: provides
- Landing → Discovery & meeting UI: renders
- Discovery & meeting UI → Meeting state: reads and updates
- Discovery & meeting UI → Meeting API: creates and browses
- Meeting API → Firebase Admin: persists through
- Meeting API → Data schemas: validates with
- Meeting details → Meeting resource API: loads meeting
- Meeting resource API → Firebase Admin: accesses
- Meeting details → Pre-join: continues to
- Pre-join → Live room: enters
- Live room → Agora call UI: renders
- Agora call UI → Agora video players: uses
- Agora call UI → Agora token API: requests token
- Agora token API → Agora: issues access for
- Agora call UI → Agora: joins media channel
- Live room → Meeting chat API: uses chat
- Meeting chat API → Firebase Admin: stores through
- API module → Meeting API: calls
- Product pages → API module: uses
