# webex/widgets architecture

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

- Interactive diagram: https://gitdiagram.com/webex/widgets
- Repository: https://github.com/webex/widgets

## Overview

##### Project Type and Purpose
- This is an open-source React component library—“Webex Widgets”—designed to be published to npm and embedded by developers into their web applications. It provides self-contained React widgets (currently a Meetings widget) that handle UI, styling, and integration with Webex APIs.

##### Main Components
a. Source Code (src/)
- widgets/WebexMeetings: React components, CSS, assets, and internal logic.
- index.js: library entry point that exports widgets.
b. Build & Bundling
- rollup.config.js & webpack.config.js: build the library and demo bundles.
- package.json & release.config.js: npm publication configuration.
c. Continuous Integration
- .circleci/config.yml & GitHub Actions (.github/workflows): test, build, and publish pipelines.
d. Demo Application (demo/)
- A small React app that imports the built widget and demonstrates usage.
e. Documentation Site (docs/)
- Prebuilt static bundles and HTML for npmjs documentation pages.
f. Tests
- End-to-end tests (wdio.conf.js, tests/): verify widget functionality in a simulated browser.
g. Distribution
- npm registry: consumers install @webex/widgets.
- dist/css/webex-widgets.css & dist/js bundles: the published artifacts.

##### External Dependencies & Services
- npm registry: artifact publication and consumption.
- Webex Backend APIs & Media Services: widget runtime integration for authentication (accessToken), meeting signaling, and media streams.
- Developer’s host app: imports and renders the widget, passes props (accessToken, meetingDestination, optional fedramp).

##### Architectural Patterns & Design Principles
- Modular component design: each widget is self-contained under src/widgets.
- Single entry point pattern: src/index.js re-exports widgets.
- CI/CD pipeline for automated testing and publishing.
- Demo & docs decoupled from core library—built via separate configs.

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Developer Environment & Source Repo"
    direction TB
    GitHub["GitHub Repo"]:::gray
    LocalDev["Local Dev\n(Node.js, ESLint, Prettier)"]:::gray
    subgraph "Source Code"
      direction TB
      Widgets["WebexMeetings Widget\n(src/widgets/WebexMeetings)"]:::green
      Index["Library Entry Point\n(src/index.js)"]:::green
    end
  end

  subgraph "CI/CD Pipeline"
    direction TB
    CircleCI["CircleCI"]:::blue
    GHActions["GitHub Actions"]:::blue
    LBT["Lint → Build → Test → Publish"]:::blue
  end

  subgraph "Build & Bundling"
    direction TB
    Rollup["rollup.config.js"]:::blue
    Webpack["webpack.config.js"]:::blue
    PackageJSON["package.json"]:::blue
    ReleaseConfig["release.config.js"]:::blue
  end

  subgraph "Tests"
    direction TB
    WDIO["wdio.conf.js"]:::blue
    E2ETests["tests/"]:::blue
  end

  subgraph "Demo & Docs Generation"
    direction TB
    DemoApp["Demo App\n(demo/)"]:::blue
    DocsSite["Docs Site\n(docs/)"]:::blue
  end

  NPM["npm Registry"]:::gray
  DocsHost["Docs Hosting\n(static site)"]:::gray

  subgraph "Consumer Runtime"
    direction TB
    ReactApp["Consumer React App"]:::green
    Browser["Browser\nWidget Bundle\n(JS/CSS)"]:::green
    Widget["WebexMeetings Widget\n(in Browser)"]:::green
    WebexBackend["Webex Backend\n(REST/WS/Media)"]:::cloud
  end

  %% Connections
  GitHub -->|push code| CircleCI
  GitHub -->|push code| GHActions
  CircleCI -->|run pipeline| LBT
  GHActions -->|run pipeline| LBT
  LBT -->|bundles via| Rollup
  LBT -->|bundles via| Webpack
  Rollup -->|output| DemoApp
  Webpack -->|output| DemoApp
  Rollup -->|output| DocsSite
  Webpack -->|output| DocsSite
  LBT -->|run E2E tests| WDIO
  WDIO -->|load specs| E2ETests
  LBT -->|publish| NPM
  LBT -->|deploy docs| DocsHost

  ReactApp -->|install @webex/widgets| NPM
  ReactApp -->|renders| Browser
  Browser -->|loads widget bundle| Widget
  Widget -->|REST API calls| WebexBackend
  Widget -->|WebSocket/Media| WebexBackend

  %% Click events
  click Widgets "https://github.com/webex/widgets/tree/master/src/widgets/WebexMeetings"
  click Index "https://github.com/webex/widgets/blob/master/src/index.js"
  click Rollup "https://github.com/webex/widgets/blob/master/rollup.config.js"
  click Webpack "https://github.com/webex/widgets/blob/master/webpack.config.js"
  click PackageJSON "https://github.com/webex/widgets/blob/master/package.json"
  click ReleaseConfig "https://github.com/webex/widgets/blob/master/release.config.js"
  click CircleCI "https://github.com/webex/widgets/blob/master/.circleci/config.yml"
  click GHActions "https://github.com/webex/widgets/blob/master/.github/workflows/update-dependencies.yml"
  click DemoApp "https://github.com/webex/widgets/tree/master/demo/"
  click DocsSite "https://github.com/webex/widgets/tree/master/docs/"
  click WDIO "https://github.com/webex/widgets/blob/master/wdio.conf.js"
  click E2ETests "https://github.com/webex/widgets/tree/master/tests/"

  %% Styles
  classDef gray fill:#f5f5f5,stroke:#999,stroke-width:1px
  classDef blue fill:#bbdefb,stroke:#2196f3,stroke-width:1px
  classDef green fill:#c8e6c9,stroke:#388e3c,stroke-width:1px
  classDef cloud fill:#e1f5fe,stroke:#03a9f4,stroke-dasharray:5 5,stroke-width:1px
```
