# rishi2600/analytics-board-supabase architecture

> Architecture diagram of the GitHub repository rishi2600/analytics-board-supabase, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rishi2600/analytics-board-supabase
- Repository: https://github.com/rishi2600/analytics-board-supabase

## Overview

Analytics is a self-serve product analytics platform: teams install the SDK, events are ingested and aggregated, then users explore project data and manage access in a Supabase-backed dashboard. The README documents scheduled rollups and several dashboard capabilities whose implementation files are not included in the excerpts; their paths and wiring are shown only where the tree supports them.

Main entry points: [`apps/web/src/app/router.tsx`](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/app/router.tsx) (Dashboard routes), [`apps/web/src/features/analytics/api.ts`](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/analytics/api.ts) (Analytics queries), [`apps/web/src/lib/supabase.ts`](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/lib/supabase.ts) (Web Supabase client), [`supabase/functions/ingest/index.ts`](https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/ingest/index.ts) (Event ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collect["Event collection"]
  node_sdk["Analytics SDK<br/>[index.ts]"]
  node_ingest["Event ingestion<br/>[index.ts]"]
end

subgraph group_process["Event processing"]
  node_rollups["Scheduled rollups"]
  node_backfill["Rollup backfill"]
end

subgraph group_explore["Analytics dashboard"]
  node_router["Dashboard routes<br/>[router.tsx]"]
  node_overview["Overview<br/>[overview.tsx]"]
  node_explorer["Event explorer<br/>[events.tsx]"]
  node_live["Live feed<br/>[live.tsx]"]
  node_funnels["Funnels<br/>[funnels.tsx]"]
  node_retention["Retention cohorts<br/>[retention.tsx]"]
  node_reports["Reports and exports<br/>[reports.tsx]"]
  node_health["Ingestion health<br/>[health.tsx]"]
  node_analytics_api["Analytics queries<br/>[api.ts]"]
  node_export_run["Export runner<br/>[index.ts]"]
  node_export_download["Export download<br/>[index.ts]"]
end

subgraph group_manage["Workspace management"]
  node_auth["Authentication<br/>[auth-provider.tsx]"]
  node_orgs["Organizations and members<br/>[api.ts]"]
  node_projects["Project settings<br/>[api.ts]"]
  node_keys["API key management<br/>[api.ts]"]
end

subgraph group_platform["Supabase platform"]
  node_supabase_client["Web Supabase client<br/>[supabase.ts]"]
  node_key_auth["Ingestion key verification<br/>[auth.ts]"]
  node_postgres[("Postgres")]
  node_supabase_auth["Supabase Auth"]
  node_storage[("Supabase Storage")]
end

node_customer_app(("Customer app"))
node_dashboard_user(("Dashboard user"))

node_customer_app -->|"sends events"| node_sdk
node_sdk -->|"submits batches"| node_ingest
node_ingest -->|"resolves key"| node_key_auth
node_key_auth -->|"verifies key"| node_postgres
node_ingest -->|"stores events"| node_postgres
node_rollups -->|"reads and writes"| node_postgres
node_backfill -->|"recomputes rollups"| node_postgres
node_dashboard_user -->|"uses dashboard"| node_router
node_router -->|"routes to"| node_overview
node_router -->|"routes to"| node_explorer
node_router -->|"routes to"| node_live
node_router -->|"routes to"| node_funnels
node_router -->|"routes to"| node_retention
node_router -->|"routes to"| node_reports
node_router -->|"routes to"| node_health
node_overview -->|"queries metrics"| node_analytics_api
node_explorer -->|"queries events"| node_analytics_api
node_funnels -->|"queries funnels"| node_analytics_api
node_retention -->|"queries cohorts"| node_analytics_api
node_health -->|"queries health"| node_analytics_api
node_analytics_api -->|"uses client"| node_supabase_client
node_supabase_client -->|"queries data"| node_postgres
node_reports -->|"requests exports"| node_export_run
node_export_run -->|"claims and reads"| node_postgres
node_export_run -->|"stores export"| node_storage
node_export_download -->|"retrieves export"| node_storage
node_auth -->|"reads session"| node_supabase_auth
node_orgs -->|"uses client"| node_supabase_client
node_projects -->|"uses client"| node_supabase_client
node_keys -->|"uses client"| node_supabase_client

click node_sdk "https://github.com/rishi2600/analytics-board-supabase/blob/main/packages/sdk/src/index.ts"
click node_ingest "https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/ingest/index.ts"
click node_backfill "https://github.com/rishi2600/analytics-board-supabase/blob/main/scripts/backfill-rollups.ts"
click node_router "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/app/router.tsx"
click node_overview "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/overview.tsx"
click node_explorer "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/events.tsx"
click node_live "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/live.tsx"
click node_funnels "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/funnels.tsx"
click node_retention "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/retention.tsx"
click node_reports "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/reports.tsx"
click node_health "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/health.tsx"
click node_analytics_api "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/analytics/api.ts"
click node_export_run "https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/export-run/index.ts"
click node_export_download "https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/export-download/index.ts"
click node_auth "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/auth/auth-provider.tsx"
click node_orgs "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/orgs/api.ts"
click node_projects "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/projects/api.ts"
click node_keys "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/keys/api.ts"
click node_supabase_client "https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/lib/supabase.ts"
click node_key_auth "https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/_shared/auth.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_ingest,node_dashboard_user toneBlue
class node_rollups,node_backfill toneAmber
class node_router,node_overview,node_explorer,node_live,node_funnels,node_retention,node_reports,node_health,node_analytics_api,node_export_run,node_export_download toneMint
class node_auth,node_orgs,node_projects,node_keys toneRose
class node_supabase_client,node_key_auth,node_postgres,node_supabase_auth,node_storage,node_customer_app toneIndigo
```

## Components

### Event collection

- [Analytics SDK](https://github.com/rishi2600/analytics-board-supabase/blob/main/packages/sdk/src/index.ts): `packages/sdk/src/index.ts`
- [Event ingestion](https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/ingest/index.ts): `supabase/functions/ingest/index.ts`

### Event processing

- **Scheduled rollups**
- [Rollup backfill](https://github.com/rishi2600/analytics-board-supabase/blob/main/scripts/backfill-rollups.ts): `scripts/backfill-rollups.ts`

### Analytics dashboard

- [Dashboard routes](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/app/router.tsx): `apps/web/src/app/router.tsx`
- [Overview](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/overview.tsx): `apps/web/src/routes/project/overview.tsx`
- [Event explorer](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/events.tsx): `apps/web/src/routes/project/events.tsx`
- [Live feed](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/live.tsx): `apps/web/src/routes/project/live.tsx`
- [Funnels](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/funnels.tsx): `apps/web/src/routes/project/funnels.tsx`
- [Retention cohorts](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/retention.tsx): `apps/web/src/routes/project/retention.tsx`
- [Reports and exports](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/reports.tsx): `apps/web/src/routes/project/reports.tsx`
- [Ingestion health](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/routes/project/health.tsx): `apps/web/src/routes/project/health.tsx`
- [Analytics queries](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/analytics/api.ts): `apps/web/src/features/analytics/api.ts`
- [Export runner](https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/export-run/index.ts): `supabase/functions/export-run/index.ts`
- [Export download](https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/export-download/index.ts): `supabase/functions/export-download/index.ts`

### Workspace management

- [Authentication](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/auth/auth-provider.tsx): `apps/web/src/features/auth/auth-provider.tsx`
- [Organizations and members](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/orgs/api.ts): `apps/web/src/features/orgs/api.ts`
- [Project settings](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/projects/api.ts): `apps/web/src/features/projects/api.ts`
- [API key management](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/features/keys/api.ts): `apps/web/src/features/keys/api.ts`

### Supabase platform

- [Web Supabase client](https://github.com/rishi2600/analytics-board-supabase/blob/main/apps/web/src/lib/supabase.ts): `apps/web/src/lib/supabase.ts`
- [Ingestion key verification](https://github.com/rishi2600/analytics-board-supabase/blob/main/supabase/functions/_shared/auth.ts): `supabase/functions/_shared/auth.ts`
- **Postgres**
- **Supabase Auth**
- **Supabase Storage**

### Other components

- **Customer app**
- **Dashboard user**

## Connections

- Customer app → Analytics SDK: sends events
- Analytics SDK → Event ingestion: submits batches
- Event ingestion → Ingestion key verification: resolves key
- Ingestion key verification → Postgres: verifies key
- Event ingestion → Postgres: stores events
- Scheduled rollups → Postgres: reads and writes
- Rollup backfill → Postgres: recomputes rollups
- Dashboard user → Dashboard routes: uses dashboard
- Dashboard routes → Overview: routes to
- Dashboard routes → Event explorer: routes to
- Dashboard routes → Live feed: routes to
- Dashboard routes → Funnels: routes to
- Dashboard routes → Retention cohorts: routes to
- Dashboard routes → Reports and exports: routes to
- Dashboard routes → Ingestion health: routes to
- Overview → Analytics queries: queries metrics
- Event explorer → Analytics queries: queries events
- Funnels → Analytics queries: queries funnels
- Retention cohorts → Analytics queries: queries cohorts
- Ingestion health → Analytics queries: queries health
- Analytics queries → Web Supabase client: uses client
- Web Supabase client → Postgres: queries data
- Reports and exports → Export runner: requests exports
- Export runner → Postgres: claims and reads
- Export runner → Supabase Storage: stores export
- Export download → Supabase Storage: retrieves export
- Authentication → Supabase Auth: reads session
- Organizations and members → Web Supabase client: uses client
- Project settings → Web Supabase client: uses client
- API key management → Web Supabase client: uses client
