# andymarrow/omnioptimize architecture

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

- Interactive diagram: https://gitdiagram.com/andymarrow/omnioptimize
- Repository: https://github.com/andymarrow/omnioptimize

## Overview

Omni Analytics combines a browser-tracking SDK and ingestion/analytics backend with a Next.js dashboard for viewing project analytics and managing projects. The principal flow is client event capture, batch validation and queueing, backend processing/storage, then analytics views. The repository also contains a Convex-backed dashboard with project, SEO, code-scan, and settings areas. Several dashboard and worker implementations were not sampled, so those components are shown without speculative call chains.

Main entry points: [`omni-sdk/packages/sdk/src/tracker/Tracker.ts`](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/packages/sdk/src/tracker/Tracker.ts) (Tracking SDK), [`omni-sdk/backend/src/handlers/ingest.handler.ts`](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/handlers/ingest.handler.ts) (Ingest handler), [`app/_context/ProjectContext.js`](https://github.com/andymarrow/omnioptimize/blob/main/app/_context/ProjectContext.js) (Project context), [`convex/analytics.ts`](https://github.com/andymarrow/omnioptimize/blob/main/convex/analytics.ts) (Convex functions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Tracking client"]
  node_sdk["Tracking SDK<br/>[Tracker.ts]"]
  node_react["React adapter<br/>[TrackerContext.tsx]"]
  node_capture["Event capture"]
  node_transport["Batch transport"]
end

subgraph group_backend["Event backend"]
  node_api["Ingest API<br/>[ingest.ts]"]
  node_validation["Batch validation<br/>[ingest.ts]"]
  node_ingest["Ingest handler<br/>[ingest.handler.ts]"]
  node_queue["Ingestion queue<br/>[IngestionQueue.ts]"]
  node_worker["Event worker<br/>[worker.ts]"]
  node_processors["Event processors"]
  node_repositories["Analytics repositories"]
  node_sessionrepo["Session repository"]
  node_db[("Event database<br/>[schema.ts]")]
end

subgraph group_dashboard["Analytics dashboard"]
  node_analyticsui["Analytics overview<br/>[page.jsx]"]
  node_insights["Deep insights<br/>[page.jsx]"]
  node_analyticsdetail["Analytics reports<br/>[page.jsx]"]
  node_replay["Session replay"]
  node_seo["SEO analysis<br/>[page.jsx]"]
  node_code["Code security<br/>[page.jsx]"]
  node_settings["Account settings<br/>[page.jsx]"]
  node_projects["Project context<br/>[ProjectContext.js]"]
end

subgraph group_convex["Convex services"]
  node_convex["Convex functions<br/>[analytics.ts]"]
  node_projectdata["Project functions<br/>[projects.ts]"]
  node_seoengine["SEO functions<br/>[seo.ts]"]
  node_convexstore[("Convex data model<br/>[schema.ts]")]
end

node_site(("Tracked site"))

node_site -.->|"hosts"| node_sdk
node_react -.->|"provides tracker"| node_sdk
node_sdk -.->|"dispatches events"| node_capture
node_sdk -.->|"sends batches"| node_transport
node_transport -.->|"posts batches"| node_api
node_api -->|"routes to"| node_ingest
node_ingest -->|"validates with"| node_validation
node_ingest -->|"enqueues batch"| node_queue
node_worker -.->|"dispatches to"| node_processors
node_processors -.->|"persists via"| node_repositories
node_sessionrepo -->|"reads and writes"| node_db
node_sessionrepo -->|"delegates rage counts"| node_repositories
node_projects -->|"queries projects"| node_projectdata
node_analyticsui -->|"reads active project"| node_projects
node_analyticsui -->|"fetches overview"| node_convex
node_insights -->|"reads project"| node_projects
node_insights -->|"uses API reference"| node_convex
node_seo -.->|"uses SEO data"| node_seoengine
node_convex -.->|"uses data model"| node_convexstore
node_projectdata -.->|"uses data model"| node_convexstore
node_seoengine -.->|"uses data model"| node_convexstore

click node_sdk "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/packages/sdk/src/tracker/Tracker.ts"
click node_react "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/packages/react/src/context/TrackerContext.tsx"
click node_capture "https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/packages/sdk/src/plugins"
click node_transport "https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/packages/sdk/src/transmitter"
click node_api "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/routes/ingest.ts"
click node_validation "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/schemas/ingest.ts"
click node_ingest "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/handlers/ingest.handler.ts"
click node_queue "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/queue/IngestionQueue.ts"
click node_worker "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/worker.ts"
click node_processors "https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/backend/src/processors"
click node_repositories "https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/backend/src/repositories"
click node_sessionrepo "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/repositories/SessionRepository.ts"
click node_db "https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/db/schema.ts"
click node_analyticsui "https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/page.jsx"
click node_insights "https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/deep-insight/page.jsx"
click node_analyticsdetail "https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/analytics/page.jsx"
click node_replay "https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/_components/insights/SessionReplayTab.jsx"
click node_seo "https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/seo/page.jsx"
click node_code "https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/code/page.jsx"
click node_settings "https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/settings/page.jsx"
click node_projects "https://github.com/andymarrow/omnioptimize/blob/main/app/_context/ProjectContext.js"
click node_convex "https://github.com/andymarrow/omnioptimize/blob/main/convex/analytics.ts"
click node_projectdata "https://github.com/andymarrow/omnioptimize/blob/main/convex/projects.ts"
click node_seoengine "https://github.com/andymarrow/omnioptimize/blob/main/convex/seo.ts"
click node_convexstore "https://github.com/andymarrow/omnioptimize/blob/main/convex/schema.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_sdk,node_react,node_capture,node_transport toneBlue
class node_api,node_validation,node_ingest,node_queue,node_worker,node_processors,node_repositories,node_sessionrepo,node_db toneAmber
class node_analyticsui,node_insights,node_analyticsdetail,node_replay,node_seo,node_code,node_settings,node_projects toneMint
class node_convex,node_projectdata,node_seoengine,node_convexstore toneRose
class node_site toneIndigo
```

## Components

### Tracking client

- [Tracking SDK](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/packages/sdk/src/tracker/Tracker.ts): `omni-sdk/packages/sdk/src/tracker/Tracker.ts`
- [React adapter](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/packages/react/src/context/TrackerContext.tsx): `omni-sdk/packages/react/src/context/TrackerContext.tsx`
- [Event capture](https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/packages/sdk/src/plugins): `omni-sdk/packages/sdk/src/plugins`
- [Batch transport](https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/packages/sdk/src/transmitter): `omni-sdk/packages/sdk/src/transmitter`

### Event backend

- [Ingest API](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/routes/ingest.ts): `omni-sdk/backend/src/routes/ingest.ts`
- [Batch validation](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/schemas/ingest.ts): `omni-sdk/backend/src/schemas/ingest.ts`
- [Ingest handler](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/handlers/ingest.handler.ts): `omni-sdk/backend/src/handlers/ingest.handler.ts`
- [Ingestion queue](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/queue/IngestionQueue.ts): `omni-sdk/backend/src/queue/IngestionQueue.ts`
- [Event worker](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/worker.ts): `omni-sdk/backend/src/worker.ts`
- [Event processors](https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/backend/src/processors): `omni-sdk/backend/src/processors`
- [Analytics repositories](https://github.com/andymarrow/omnioptimize/tree/main/omni-sdk/backend/src/repositories): `omni-sdk/backend/src/repositories`
- [Session repository](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/repositories/SessionRepository.ts): `omni-sdk/backend/src/repositories/SessionRepository.ts`
- [Event database](https://github.com/andymarrow/omnioptimize/blob/main/omni-sdk/backend/src/db/schema.ts): `omni-sdk/backend/src/db/schema.ts`

### Analytics dashboard

- [Analytics overview](https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/page.jsx): `app/(main)/dashboard/page.jsx`
- [Deep insights](https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/deep-insight/page.jsx): `app/(main)/dashboard/deep-insight/page.jsx`
- [Analytics reports](https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/analytics/page.jsx): `app/(main)/dashboard/analytics/page.jsx`
- [Session replay](https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/_components/insights/SessionReplayTab.jsx): `app/(main)/dashboard/_components/insights/SessionReplayTab.jsx`
- [SEO analysis](https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/seo/page.jsx): `app/(main)/dashboard/seo/page.jsx`
- [Code security](https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/code/page.jsx): `app/(main)/dashboard/code/page.jsx`
- [Account settings](https://github.com/andymarrow/omnioptimize/blob/main/app/(main)/dashboard/settings/page.jsx): `app/(main)/dashboard/settings/page.jsx`
- [Project context](https://github.com/andymarrow/omnioptimize/blob/main/app/_context/ProjectContext.js): `app/_context/ProjectContext.js`

### Convex services

- [Convex functions](https://github.com/andymarrow/omnioptimize/blob/main/convex/analytics.ts): `convex/analytics.ts`
- [Project functions](https://github.com/andymarrow/omnioptimize/blob/main/convex/projects.ts): `convex/projects.ts`
- [SEO functions](https://github.com/andymarrow/omnioptimize/blob/main/convex/seo.ts): `convex/seo.ts`
- [Convex data model](https://github.com/andymarrow/omnioptimize/blob/main/convex/schema.ts): `convex/schema.ts`

### Other components

- **Tracked site**

## Connections

- Tracked site → Tracking SDK: hosts
- React adapter → Tracking SDK: provides tracker
- Tracking SDK → Event capture: dispatches events
- Tracking SDK → Batch transport: sends batches
- Batch transport → Ingest API: posts batches
- Ingest API → Ingest handler: routes to (evidence: `omni-sdk/backend/src/routes/ingest.ts`)
- Ingest handler → Batch validation: validates with (evidence: `omni-sdk/backend/src/handlers/ingest.handler.ts`)
- Ingest handler → Ingestion queue: enqueues batch (evidence: `omni-sdk/backend/src/handlers/ingest.handler.ts`)
- Event worker → Event processors: dispatches to
- Event processors → Analytics repositories: persists via
- Session repository → Event database: reads and writes (evidence: `omni-sdk/backend/src/repositories/SessionRepository.ts`)
- Session repository → Analytics repositories: delegates rage counts (evidence: `omni-sdk/backend/src/repositories/SessionRepository.ts`)
- Project context → Project functions: queries projects (evidence: `app/_context/ProjectContext.js`)
- Analytics overview → Project context: reads active project (evidence: `app/(main)/dashboard/page.jsx`)
- Analytics overview → Convex functions: fetches overview (evidence: `app/(main)/dashboard/page.jsx`)
- Deep insights → Project context: reads project (evidence: `app/(main)/dashboard/deep-insight/page.jsx`)
- Deep insights → Convex functions: uses API reference (evidence: `app/(main)/dashboard/deep-insight/page.jsx`)
- SEO analysis → SEO functions: uses SEO data
- Convex functions → Convex data model: uses data model
- Project functions → Convex data model: uses data model
- SEO functions → Convex data model: uses data model
