# cuemeet/cuemeet-google-bot architecture

> Architecture diagram of the GitHub repository cuemeet/cuemeet-google-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cuemeet/cuemeet-google-bot
- Repository: https://github.com/cuemeet/cuemeet-google-bot

## Overview

##### Project type and purpose
- This is a full-stack automation/integration tool: a Google Meet “bot” service combined with a browser extension for transcript capture.
- Purpose: programmatically join Google Meet calls, stay “alive” (random mouse movement), capture transcripts via a Chrome extension, and expose control via a backend API.

##### File structure
- Top-level service:
– app.py: main Flask/FastAPI (or similar) web service entry point
– config/: settings module for environment, secrets, and feature toggles
– logger.py & monitoring.py: centralized logging and metrics instrumentation
– google_meet/: core bot logic (bot.py orchestrates browser automation; random_mouse.py for anti-idle; utils.py for common helpers)
– transcript_extension/: Chrome extension assets (manifest.json, background.js, content.js)
– Dockerfile & entrypoint.sh: containerization
– buildspec*.yml: CI/CD build definitions
– pulse-*.conf: audio subsystem (PulseAudio) configurations
- Supporting scripts: Makefile, .env.example, pyproject.toml

##### README for additional insights
- Confirms this is one of several meeting-bots (Zoom, Teams, etc.), focused on Google Meet

a. Main components
1. User’s Browser + Google Meet UI
2. Transcript Chrome Extension (content.js + background.js)
3. Backend Service (app.py + google_meet package)
4. Browser Automation Engine (e.g., Selenium or Puppeteer, invoked by bot.py)
5. Audio Subsystem (PulseAudio with pulse-client.conf)
6. Logging & Monitoring (logger.py, monitoring.py + external metrics/log aggregator)
7. External Service: Google Meet Servers
b. Relationships & interactions
1. The user navigates to Google Meet in their browser; the extension injects content scripts.
2. content.js scrapes transcript text/events, sends them to background.js.
3. background.js POSTs transcript data to the backend’s REST/WebSocket endpoints.
4. The backend (app.py) exposes control APIs: start/stop meeting bot sessions, configure settings.
5. When a session is started, bot.py spins up a headless browser, connects to Google Meet, runs random_mouse to simulate activity, uses PulseAudio for voice or audio capture if needed.
6. Bot interactions (join/leave, transcript forwarding) are logged via logger.py and metrics emitted via monitoring.py.
7. Logs/metrics are sent to an external logging/monitoring service (e.g., CloudWatch, Prometheus+Grafana).
8. The CI/CD pipeline (buildspec.yml) builds the Docker image via Dockerfile and deploys to staging/production.
c. Architectural patterns & design principles
- Separation of concerns:
Frontend (extension) vs. Backend (API + automation) vs. Infrastructure (logging/monitoring)
- Modularization: google_meet module encapsulates bot logic; transcript_extension is fully decoupled.
- Containerization: Docker + buildspec for reproducible builds and deployments
- Configuration-as-code: config/settings.py + .env for environment-specific overrides
d. Key technologies/libraries
- Python 3.x (pyproject.toml)
- Flask or FastAPI (inferred from app.py)
- Selenium or Puppeteer (browser automation in bot.py)
- Chrome Extension APIs (manifest.json, content/background scripts)
- PulseAudio for audio routing
- Docker, AWS CodeBuild (buildspec), environment variables

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "User Browser & Extension" 
        direction TB
        Browser["User Browser + Google Meet UI"]:::frontend
        manifest["Manifest (manifest.json)"]:::frontend
        contentjs["Content Script (content.js)"]:::frontend
        backgroundjs["Background Script (background.js)"]:::frontend
    end

    %% Backend Layer inside Docker
    subgraph "Backend Service (Docker Container)" 
        direction TB
        app["Backend API (app.py)"]:::backend
        config["Configuration Module (config/settings.py)"]:::backend
        subgraph "Meet Bot Module" 
            direction TB
            bot["Meet Bot Engine (google_meet/bot.py)"]:::backend
            randommouse["Anti-Idle Mouse (google_meet/random_mouse.py)"]:::backend
            utils["Bot Utils (google_meet/utils.py)"]:::backend
        end
        logger["Centralized Logging (logger.py)"]:::backend
        monitoring["Metrics & Monitoring (monitoring.py)"]:::backend
        pulseclient["PulseAudio Client Config (pulse-client.conf)"]:::backend
        pulsed["PulseAudio Daemon Config (pulse-daemon.conf)"]:::backend
        entrypoint["Entrypoint Script (entrypoint.sh)"]:::infra
    end

    %% External Services
    subgraph "External Systems"
        direction TB
        gmeet["Google Meet Servers"]:::external
        extlogs["Logging/Monitoring Service"]:::external
    end

    %% CI/CD & Build
    subgraph "CI/CD & Build" 
        direction TB
        makefile["Makefile"]:::infra
        envexample[".env.example"]:::infra
        pyproject["pyproject.toml"]:::infra
        buildspec_prod["buildspec.yml"]:::infra
        buildspec_staging["buildspec-staging.yml"]:::infra
        dockerfile["Dockerfile"]:::infra
    end

    %% Data Flows and Relationships
    Browser -->|"Loads Extension via"| manifest
    manifest -->|"Injects"| contentjs
    contentjs -->|"Scrapes Transcript"| backgroundjs
    backgroundjs -->|"POSTs Transcript via HTTP/WebSocket"| app
    Browser -->|"User Control UI calls"| app

    app -->|"Starts Bot Session"| bot
    bot -->|"Simulate Activity"| randommouse
    bot -->|"Helper Operations"| utils
    bot -->|"Connects to"| gmeet
    bot -->|"Uses Audio via"| pulseclient
    bot --> pulseclient --> pulsed

    app -->|"Load Settings"| config
    app -->|"Log Events"| logger
    app -->|"Emit Metrics"| monitoring
    logger -->|"Send Logs to"| extlogs
    monitoring -->|"Send Metrics to"| extlogs

    buildspec_prod -->|"Build & Deploy"| dockerfile
    buildspec_staging -->|"Build & Deploy"| dockerfile
    dockerfile -->|"Sets up Container"| entrypoint
    makefile -->|"Automation"| dockerfile
    envexample -->|"Env Template for"| app
    pyproject -->|"Dependencies for"| app

    %% Click Events
    click app "https://github.com/cuemeet/cuemeet-google-bot/blob/main/app.py"
    click config "https://github.com/cuemeet/cuemeet-google-bot/blob/main/config/settings.py"
    click logger "https://github.com/cuemeet/cuemeet-google-bot/blob/main/logger.py"
    click monitoring "https://github.com/cuemeet/cuemeet-google-bot/blob/main/monitoring.py"
    click bot "https://github.com/cuemeet/cuemeet-google-bot/blob/main/google_meet/bot.py"
    click randommouse "https://github.com/cuemeet/cuemeet-google-bot/blob/main/google_meet/random_mouse.py"
    click utils "https://github.com/cuemeet/cuemeet-google-bot/blob/main/google_meet/utils.py"
    click manifest "https://github.com/cuemeet/cuemeet-google-bot/blob/main/transcript_extension/manifest.json"
    click backgroundjs "https://github.com/cuemeet/cuemeet-google-bot/blob/main/transcript_extension/background.js"
    click contentjs "https://github.com/cuemeet/cuemeet-google-bot/blob/main/transcript_extension/content.js"
    click dockerfile "https://github.com/cuemeet/cuemeet-google-bot/tree/main/Dockerfile"
    click entrypoint "https://github.com/cuemeet/cuemeet-google-bot/blob/main/entrypoint.sh"
    click buildspec_prod "https://github.com/cuemeet/cuemeet-google-bot/blob/main/buildspec.yml"
    click buildspec_staging "https://github.com/cuemeet/cuemeet-google-bot/blob/main/buildspec-staging.yml"
    click pulseclient "https://github.com/cuemeet/cuemeet-google-bot/blob/main/pulse-client.conf"
    click pulsed "https://github.com/cuemeet/cuemeet-google-bot/blob/main/pulse-daemon.conf"
    click envexample "https://github.com/cuemeet/cuemeet-google-bot/blob/main/.env.example"
    click makefile "https://github.com/cuemeet/cuemeet-google-bot/tree/main/Makefile"
    click pyproject "https://github.com/cuemeet/cuemeet-google-bot/blob/main/pyproject.toml"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef infra fill:#FFFACD,stroke:#333,stroke-width:1px
```
