# yuva-raj444/analytechs architecture

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

- Interactive diagram: https://gitdiagram.com/yuva-raj444/analytechs
- Repository: https://github.com/yuva-raj444/analytechs

## Overview

AnalyTechs captures anonymous page-view and click events, persists them through an API, and presents session timelines and document-aware click heatmaps. The map follows the tracker-to-API ingestion path and the dashboard’s API-backed views, while retaining the demo sites and shared event model as product components. API validation, MongoDB access, and the dashboard fetch helper are shown as internal layers. README-described capabilities are included, but unshown route details are evidenced only by the README; no unsampled source is assumed inspected.

Main entry points: [`apps/api/src/server.ts`](https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/server.ts) (Fastify API), [`packages/tracker/src/index.ts`](https://github.com/yuva-raj444/analytechs/blob/main/packages/tracker/src/index.ts) (Tracker SDK), [`apps/dashboard/app/page.tsx`](https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx) (Dashboard), [`apps/api/src/db.ts`](https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/db.ts) (Event storage access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Event capture"]
  node_tracker["Tracker SDK<br/>[index.ts]"]
  node_eventmodel["Event model<br/>[index.ts]"]
end

subgraph group_service["Analytics service"]
  node_api["Fastify API<br/>[server.ts]"]
  node_validation["Event validation<br/>[schemas.ts]"]
  node_config["API configuration<br/>[config.ts]"]
  node_dbaccess["Event storage access<br/>[db.ts]"]
  node_mongodb[("MongoDB events")]
end

subgraph group_insights["Analytics dashboard"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_apihelper["Dashboard API client<br/>[api.ts]"]
  node_sessionview["Session timelines<br/>[page.tsx]"]
  node_heatmapview["Click heatmaps<br/>[page.tsx]"]
  node_pages["Page discovery<br/>[page.tsx]"]
end

subgraph group_demos["Demo sites"]
  node_demo["Multi-page demo"]
  node_demoapp["Demo app"]
end

node_visitor(("Site visitor"))

node_visitor -.->|"visits"| node_demo
node_demo -.->|"loads"| node_tracker
node_visitor -->|"interacts"| node_tracker
node_tracker -->|"posts batches"| node_api
node_api -->|"validates events"| node_validation
node_api -->|"stores and queries"| node_dbaccess
node_dbaccess -->|"reads and writes"| node_mongodb
node_dashboard -->|"fetches data"| node_apihelper
node_apihelper -->|"requests endpoints"| node_api
node_dashboard -->|"renders"| node_sessionview
node_dashboard -->|"renders"| node_heatmapview
node_dashboard -->|"discovers pages"| node_pages
node_eventmodel -.->|"defines event shape"| node_tracker
node_config -->|"configures"| node_api
node_demoapp -.->|"embeds"| node_tracker

click node_tracker "https://github.com/yuva-raj444/analytechs/blob/main/packages/tracker/src/index.ts"
click node_eventmodel "https://github.com/yuva-raj444/analytechs/blob/main/packages/types/index.ts"
click node_demo "https://github.com/yuva-raj444/analytechs/tree/main/apps/demo2"
click node_demoapp "https://github.com/yuva-raj444/analytechs/tree/main/apps/demo"
click node_api "https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/server.ts"
click node_validation "https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/schemas.ts"
click node_config "https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/config.ts"
click node_dbaccess "https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/db.ts"
click node_dashboard "https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx"
click node_apihelper "https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/lib/api.ts"
click node_sessionview "https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx"
click node_heatmapview "https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx"
click node_pages "https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx"

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_tracker,node_eventmodel toneBlue
class node_api,node_validation,node_config,node_dbaccess,node_mongodb toneAmber
class node_dashboard,node_apihelper,node_sessionview,node_heatmapview,node_pages toneMint
class node_demo,node_demoapp toneRose
class node_visitor toneIndigo
```

## Components

### Event capture

- [Tracker SDK](https://github.com/yuva-raj444/analytechs/blob/main/packages/tracker/src/index.ts): `packages/tracker/src/index.ts`
- [Event model](https://github.com/yuva-raj444/analytechs/blob/main/packages/types/index.ts): `packages/types/index.ts`

### Analytics service

- [Fastify API](https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/server.ts): `apps/api/src/server.ts`
- [Event validation](https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/schemas.ts): `apps/api/src/schemas.ts`
- [API configuration](https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/config.ts): `apps/api/src/config.ts`
- [Event storage access](https://github.com/yuva-raj444/analytechs/blob/main/apps/api/src/db.ts): `apps/api/src/db.ts`
- **MongoDB events**

### Analytics dashboard

- [Dashboard](https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx): `apps/dashboard/app/page.tsx`
- [Dashboard API client](https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/lib/api.ts): `apps/dashboard/lib/api.ts`
- [Session timelines](https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx): `apps/dashboard/app/page.tsx`
- [Click heatmaps](https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx): `apps/dashboard/app/page.tsx`
- [Page discovery](https://github.com/yuva-raj444/analytechs/blob/main/apps/dashboard/app/page.tsx): `apps/dashboard/app/page.tsx`

### Demo sites

- [Multi-page demo](https://github.com/yuva-raj444/analytechs/tree/main/apps/demo2): `apps/demo2`
- [Demo app](https://github.com/yuva-raj444/analytechs/tree/main/apps/demo): `apps/demo`

### Other components

- **Site visitor**

## Connections

- Site visitor → Multi-page demo: visits (evidence: `README.md`)
- Multi-page demo → Tracker SDK: loads (evidence: `README.md`)
- Site visitor → Tracker SDK: interacts (evidence: `packages/tracker/src/index.ts`)
- Tracker SDK → Fastify API: posts batches (evidence: `packages/tracker/src/index.ts`)
- Fastify API → Event validation: validates events (evidence: `apps/api/src/server.ts`)
- Fastify API → Event storage access: stores and queries (evidence: `apps/api/src/server.ts`)
- Event storage access → MongoDB events: reads and writes (evidence: `apps/api/src/db.ts`)
- Dashboard → Dashboard API client: fetches data (evidence: `apps/dashboard/app/page.tsx`)
- Dashboard API client → Fastify API: requests endpoints (evidence: `apps/dashboard/lib/api.ts`)
- Dashboard → Session timelines: renders (evidence: `apps/dashboard/app/page.tsx`)
- Dashboard → Click heatmaps: renders (evidence: `apps/dashboard/app/page.tsx`)
- Dashboard → Page discovery: discovers pages (evidence: `apps/dashboard/app/page.tsx`)
- Event model → Tracker SDK: defines event shape (evidence: `README.md`)
- API configuration → Fastify API: configures (evidence: `apps/api/src/server.ts`)
- Demo app → Tracker SDK: embeds (evidence: `README.md`)
