# livekit-examples/meet architecture

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

- Interactive diagram: https://gitdiagram.com/livekit-examples/meet
- Repository: https://github.com/livekit-examples/meet

## Overview

##### Project type and purpose
- LiveKit Meet is a full-stack, server-rendered React application built with Next.js App Router.
- It’s an open-source video conferencing web app that uses LiveKit Cloud as its media signaling and SFU (Selective Forwarding Unit) backend.
- The Next.js codebase also exposes a small set of serverless API routes to generate connection tokens and control recording via the LiveKit REST API.

##### File structure
- Top-level:
- app/ — Next.js 13 App Router directory with server & client components.
– app/page.tsx, app/layout.tsx: root layout and home page.
– app/custom/, app/rooms/: client-side pages & custom React implementations.
– app/api/: serverless route handlers for /connection-details, /record/start, /record/stop.
- lib/: shared UI components and utilities for camera/mic settings, debug overlays, token generation (getLiveKitURL.ts), E2EE hooks.
- public/: static assets (images, backgrounds).
- next.config.js, tsconfig.json, package.json: build & tooling config.
- The separation between app/ (UI + API) and lib/ (reusable components & helpers) suggests a component-based, serverless-API architecture.

##### README
- Confirms tech stack: Next.js, React, @livekit/components-react, LiveKit Cloud.
- Describes demo URL, dev setup, and environment variables for connecting to LiveKit Cloud.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["User Browser"]:::frontend
        UIComp["UI Components Bundle"]:::frontend
        PublicAssets["Static Public Assets (public/)"]:::frontend
    end

    %% Next.js Application Layer
    subgraph "Next.js Application (Vercel)"
        SSR["Server-side Rendering"]:::backend
        Layout["Root Layout"]:::backend
        Page["Home Page"]:::backend
        CustomPage["Custom Page Wrapper"]:::frontend
        CustomImpl["Custom Video Conference Impl"]:::frontend
        RoomPage["Room Page (Dynamic Route)"]:::frontend
        RoomClient["Client-side Room Impl"]:::frontend

        subgraph "Shared Libraries & Utils"
            Camera["Camera Settings"]:::frontend
            Mic["Microphone Settings"]:::frontend
            Debug["Debug Overlay Utility"]:::frontend
            KS["Keyboard Shortcuts Utility"]:::frontend
            RecInd["Recording Indicator"]:::frontend
            Settings["Settings Menu"]:::frontend
            ClientUtils["Client-side Utilities"]:::backend
            LiveKitURL["LiveKit URL & Token Gen"]:::backend
            URLTests["LiveKit URL Helper Tests"]:::backend
            Types["Type Definitions"]:::backend
            E2EE["E2EE Hook"]:::backend
        end

        subgraph "API Routes"
            APIConnection["API: /api/connection-details"]:::backend
            APIStart["API: /api/record/start"]:::backend
            APIStop["API: /api/record/stop"]:::backend
        end

        NextConfig["next.config.js"]:::backend
        TSConfig["tsconfig.json"]:::backend
        Package["package.json"]:::backend
    end

    %% External Services Layer
    subgraph "External Services"
        LiveKitREST["LiveKit REST API"]:::external
        LiveKitSFU["LiveKit SFU (WebRTC)"]:::external
        Storage["Recording Storage"]:::external
    end

    %% Data Flows
    Browser -->|"SSR Request"| SSR
    SSR --> Layout
    SSR --> Page
    SSR --> UIComp
    Browser --> CustomPage
    CustomPage --> CustomImpl
    Browser --> RoomPage
    RoomPage --> RoomClient

    Browser -->|REST: connection-details| APIConnection
    APIConnection -->|uses env LIVEKIT_URL, API_KEY, SECRET| LiveKitREST
    Browser -->|WebRTC Media Streams| LiveKitSFU

    Browser -->|REST: start recording| APIStart
    APIStart --> LiveKitREST
    APIStart --> Storage

    Browser -->|REST: stop recording| APIStop
    APIStop --> LiveKitREST
    APIStop --> Storage

    %% Click Events
    click UIComp "https://github.com/livekit-examples/meet/tree/main/app/"
    click PublicAssets "https://github.com/livekit-examples/meet/tree/main/public/"
    click Layout "https://github.com/livekit-examples/meet/blob/main/app/layout.tsx"
    click Page "https://github.com/livekit-examples/meet/blob/main/app/page.tsx"
    click CustomPage "https://github.com/livekit-examples/meet/blob/main/app/custom/page.tsx"
    click CustomImpl "https://github.com/livekit-examples/meet/blob/main/app/custom/VideoConferenceClientImpl.tsx"
    click RoomPage "https://github.com/livekit-examples/meet/blob/main/app/rooms/[roomName]/page.tsx"
    click RoomClient "https://github.com/livekit-examples/meet/blob/main/app/rooms/[roomName]/PageClientImpl.tsx"
    click APIConnection "https://github.com/livekit-examples/meet/blob/main/app/api/connection-details/route.ts"
    click APIStart "https://github.com/livekit-examples/meet/blob/main/app/api/record/start/route.ts"
    click APIStop "https://github.com/livekit-examples/meet/blob/main/app/api/record/stop/route.ts"
    click Camera "https://github.com/livekit-examples/meet/blob/main/lib/CameraSettings.tsx"
    click Mic "https://github.com/livekit-examples/meet/blob/main/lib/MicrophoneSettings.tsx"
    click Debug "https://github.com/livekit-examples/meet/blob/main/lib/Debug.tsx"
    click KS "https://github.com/livekit-examples/meet/blob/main/lib/KeyboardShortcuts.tsx"
    click RecInd "https://github.com/livekit-examples/meet/blob/main/lib/RecordingIndicator.tsx"
    click Settings "https://github.com/livekit-examples/meet/blob/main/lib/SettingsMenu.tsx"
    click ClientUtils "https://github.com/livekit-examples/meet/blob/main/lib/client-utils.ts"
    click LiveKitURL "https://github.com/livekit-examples/meet/blob/main/lib/getLiveKitURL.ts"
    click URLTests "https://github.com/livekit-examples/meet/blob/main/lib/getLiveKitURL.test.ts"
    click Types "https://github.com/livekit-examples/meet/blob/main/lib/types.ts"
    click E2EE "https://github.com/livekit-examples/meet/blob/main/lib/useSetupE2EE.ts"
    click NextConfig "https://github.com/livekit-examples/meet/blob/main/next.config.js"
    click TSConfig "https://github.com/livekit-examples/meet/blob/main/tsconfig.json"
    click Package "https://github.com/livekit-examples/meet/blob/main/package.json"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef external fill:#fff3cd,stroke:#856404,color:#856404
```
