# divesh-kumar-chordia/contentstack-analytics-automation-lab architecture

> Architecture diagram of the GitHub repository divesh-kumar-chordia/contentstack-analytics-automation-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divesh-kumar-chordia/contentstack-analytics-automation-lab
- Repository: https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab

## Overview

This repository is a Contentstack analytics testing lab: automation generates content-lifecycle and meter events, while dashboards expose run and coverage metrics and a separate React frontend displays published content. The principal workflow is automation → Contentstack CMA operations → analytics event pipeline → dashboard validation. The README documents the event pipeline and major scenarios; sampled source confirms the dashboard composition and Delivery API helpers. Several automation and dashboard details are unsampled, so their relationships are based on README statements rather than inferred calls.

Main entry points: [`scripts/lib/cma.mjs`](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/lib/cma.mjs) (CMA operations), [`src/NewsRouter.jsx`](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/NewsRouter.jsx) (News router), [`src/pages/RunsDashboard.jsx`](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/RunsDashboard.jsx) (Run analytics dashboard), [`src/lib/contentstackDelivery.js`](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/lib/contentstackDelivery.js) (Delivery API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_automation["Lifecycle automation"]
  node_orchestrator["Run orchestrator<br/>[drive-all.mjs]"]
  node_lifecycle["Lifecycle scenarios"]
  node_cma["CMA operations<br/>[cma.mjs]"]
  node_auth["TOTP support<br/>[totp.mjs]"]
end

subgraph group_analytics["Meter analytics"]
  node_analytics_engine["Analytics engine"]
  node_consistency["Meter consistency"]
  node_runs_dashboard["Run analytics dashboard<br/>[RunsDashboard.jsx]"]
  node_meter_coverage["Meter coverage view<br/>[MeterCoverage.jsx]"]
  node_observability["Observability metrics"]
end

subgraph group_web["Content experiences"]
  node_delivery_app["Content digest app<br/>[HomePage.jsx]"]
  node_entry_page["Entry detail page<br/>[EntryPage.jsx]"]
  node_delivery_client["Delivery API client"]
  node_news_router["News router<br/>[NewsRouter.jsx]"]
  node_news_pages["News pages<br/>[NewsHomepage.jsx]"]
  node_news_article["Article detail<br/>[NewsArticle.jsx]"]
end

subgraph group_platform["Contentstack platform"]
  node_contentstack_cma["Contentstack CMA"]
  node_contentstack_delivery["Contentstack Delivery API"]
  node_event_queue["Kafka event queue"]
  node_analytics_store[("Mongo analytics store")]
  node_search_store[("Elasticsearch metrics")]
  node_analytics_dashboards["Analytics dashboards"]
end

node_operator(("Lab operator"))

node_operator -->|"starts run"| node_orchestrator
node_orchestrator -->|"runs scenarios"| node_lifecycle
node_lifecycle -->|"performs operations"| node_cma
node_cma -->|"calls CMA"| node_contentstack_cma
node_cma -->|"uses TOTP"| node_auth
node_contentstack_cma -->|"emits meter events"| node_event_queue
node_event_queue -->|"streams events"| node_analytics_store
node_analytics_store -->|"syncs metrics"| node_search_store
node_search_store -->|"feeds metrics"| node_analytics_dashboards
node_analytics_engine -.->|"supports validation"| node_consistency
node_runs_dashboard -->|"renders coverage"| node_meter_coverage
node_runs_dashboard -->|"renders metrics"| node_observability
node_analytics_dashboards -.->|"presents run analytics"| node_runs_dashboard
node_operator -->|"views digest"| node_delivery_app
node_delivery_app -->|"fetches entries"| node_delivery_client
node_entry_page -->|"fetches entry"| node_delivery_client
node_delivery_client -->|"requests content"| node_contentstack_delivery
node_operator -->|"opens news"| node_news_router
node_news_router -->|"routes requests"| node_news_pages
node_news_router -->|"routes articles"| node_news_article
node_news_pages -.->|"loads published content"| node_contentstack_delivery
node_news_article -.->|"loads article content"| node_contentstack_delivery

click node_orchestrator "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/drive-all.mjs"
click node_lifecycle "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/tree/main/scripts"
click node_cma "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/lib/cma.mjs"
click node_auth "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/lib/totp.mjs"
click node_analytics_engine "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/lib/analytics-engine.mjs"
click node_consistency "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/meter-consistency-matrix.mjs"
click node_runs_dashboard "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/RunsDashboard.jsx"
click node_meter_coverage "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/components/MeterCoverage.jsx"
click node_observability "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/components/ObservabilityMetrics.jsx"
click node_delivery_app "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/HomePage.jsx"
click node_entry_page "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/EntryPage.jsx"
click node_delivery_client "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/lib/contentstackDelivery.js"
click node_news_router "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/NewsRouter.jsx"
click node_news_pages "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/NewsHomepage.jsx"
click node_news_article "https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/NewsArticle.jsx"

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_orchestrator,node_lifecycle,node_cma,node_auth toneBlue
class node_analytics_engine,node_consistency,node_runs_dashboard,node_meter_coverage,node_observability toneAmber
class node_delivery_app,node_entry_page,node_delivery_client,node_news_router,node_news_pages,node_news_article toneMint
class node_contentstack_cma,node_contentstack_delivery,node_event_queue,node_analytics_store,node_search_store,node_analytics_dashboards toneRose
class node_operator toneIndigo
```

## Components

### Lifecycle automation

- [Run orchestrator](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/drive-all.mjs): `scripts/drive-all.mjs`
- [Lifecycle scenarios](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/tree/main/scripts): `scripts`
- [CMA operations](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/lib/cma.mjs): `scripts/lib/cma.mjs`
- [TOTP support](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/lib/totp.mjs): `scripts/lib/totp.mjs`

### Meter analytics

- [Analytics engine](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/lib/analytics-engine.mjs): `scripts/lib/analytics-engine.mjs`
- [Meter consistency](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/scripts/meter-consistency-matrix.mjs): `scripts/meter-consistency-matrix.mjs`
- [Run analytics dashboard](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/RunsDashboard.jsx): `src/pages/RunsDashboard.jsx`
- [Meter coverage view](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/components/MeterCoverage.jsx): `src/components/MeterCoverage.jsx`
- [Observability metrics](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/components/ObservabilityMetrics.jsx): `src/components/ObservabilityMetrics.jsx`

### Content experiences

- [Content digest app](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/HomePage.jsx): `src/pages/HomePage.jsx`
- [Entry detail page](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/EntryPage.jsx): `src/pages/EntryPage.jsx`
- [Delivery API client](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/lib/contentstackDelivery.js): `src/lib/contentstackDelivery.js`
- [News router](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/NewsRouter.jsx): `src/NewsRouter.jsx`
- [News pages](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/NewsHomepage.jsx): `src/pages/NewsHomepage.jsx`
- [Article detail](https://github.com/divesh-kumar-chordia/contentstack-analytics-automation-lab/blob/main/src/pages/NewsArticle.jsx): `src/pages/NewsArticle.jsx`

### Contentstack platform

- **Contentstack CMA**
- **Contentstack Delivery API**
- **Kafka event queue**
- **Mongo analytics store**
- **Elasticsearch metrics**
- **Analytics dashboards**

### Other components

- **Lab operator**

## Connections

- Lab operator → Run orchestrator: starts run
- Run orchestrator → Lifecycle scenarios: runs scenarios
- Lifecycle scenarios → CMA operations: performs operations (evidence: `scripts/meter-consistency-matrix.mjs`)
- CMA operations → Contentstack CMA: calls CMA
- CMA operations → TOTP support: uses TOTP (evidence: `scripts/lib/cma.mjs`)
- Contentstack CMA → Kafka event queue: emits meter events
- Kafka event queue → Mongo analytics store: streams events
- Mongo analytics store → Elasticsearch metrics: syncs metrics
- Elasticsearch metrics → Analytics dashboards: feeds metrics
- Analytics engine → Meter consistency: supports validation
- Run analytics dashboard → Meter coverage view: renders coverage (evidence: `src/pages/RunsDashboard.jsx`)
- Run analytics dashboard → Observability metrics: renders metrics (evidence: `src/pages/RunsDashboard.jsx`)
- Analytics dashboards → Run analytics dashboard: presents run analytics
- Lab operator → Content digest app: views digest
- Content digest app → Delivery API client: fetches entries (evidence: `src/pages/HomePage.jsx`)
- Entry detail page → Delivery API client: fetches entry (evidence: `src/pages/EntryPage.jsx`)
- Delivery API client → Contentstack Delivery API: requests content (evidence: `src/lib/contentstackDelivery.js`)
- Lab operator → News router: opens news
- News router → News pages: routes requests (evidence: `src/NewsRouter.jsx`)
- News router → Article detail: routes articles (evidence: `src/NewsRouter.jsx`)
- News pages → Contentstack Delivery API: loads published content
- Article detail → Contentstack Delivery API: loads article content
