# techorbit0813/neurotrace architecture

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

- Interactive diagram: https://gitdiagram.com/techorbit0813/neurotrace
- Repository: https://github.com/techorbit0813/neurotrace

## Overview

NeuroTrace collects browser and desktop activity, classifies usage, persists activity locally, then presents timelines, focus and weekly analytics, and behavioral insights. The browser extension tracks tab sessions and posts them to the app; the separate desktop tracker sends desktop activity through its own endpoint. Dashboard pages read the activity dataset, with the insights engine generating behavioral summaries. The graph preserves README-described capabilities whose implementation was not sampled; those links are omitted where wiring could not be confirmed. The README describes a local JSON file, though that file is absent from the supplied tree.

Main entry points: [`extension/background.js`](https://github.com/techorbit0813/neurotrace/blob/main/extension/background.js) (Browser extension), [`app/(dashboard)/page.tsx`](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/page.tsx) (Overview dashboard), [`app/(dashboard)/focus/page.tsx`](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/focus/page.tsx) (Focus analytics), [`app/(dashboard)/weekly/page.tsx`](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/weekly/page.tsx) (Weekly analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Activity capture"]
  node_browser_extension["Browser extension<br/>[background.js]"]
  node_extension_content["Page content tracker<br/>[content.js]"]
  node_extension_popup["Extension popup<br/>[popup.js]"]
  node_desktop_tracker["Desktop tracker<br/>[desktop-tracker.js]"]
end

subgraph group_ingest["Ingestion and storage"]
  node_browser_api["Browser activity API<br/>[route.ts]"]
  node_desktop_api["Desktop activity API<br/>[route.ts]"]
  node_activity_file[("Local activity data")]
end

subgraph group_analytics["Analytics"]
  node_focus["Focus analytics<br/>[page.tsx]"]
  node_weekly["Weekly analytics<br/>[page.tsx]"]
  node_insights_page["Behavioral insights<br/>[page.tsx]"]
  node_insights_engine["Insights engine<br/>[insights-engine.ts]"]
end

subgraph group_experience["User experience"]
  node_overview["Overview dashboard<br/>[page.tsx]"]
  node_timeline["Activity timeline<br/>[page.tsx]"]
  node_timeline_view["Timeline renderer"]
  node_popup_page["Quick activity popup<br/>[page.tsx]"]
  node_realtime_chart["Productivity trend chart"]
  node_chart_suite["Analytics charts"]
end

node_browser(("Browser user"))
node_desktop_user(("Desktop user"))
node_dashboard_user(("Dashboard user"))

node_browser -->|"uses tabs"| node_browser_extension
node_browser_extension -->|"posts sessions"| node_browser_api
node_browser_extension -->|"stores locally"| node_activity_file
node_extension_content -.->|"supplies page activity"| node_browser_extension
node_extension_popup -.->|"requests status"| node_browser_extension
node_desktop_user -->|"runs tracker"| node_desktop_tracker
node_desktop_tracker -->|"posts activity"| node_desktop_api
node_browser_api -->|"merges and writes"| node_activity_file
node_desktop_api -->|"appends activity"| node_activity_file
node_dashboard_user -->|"views dashboard"| node_overview
node_dashboard_user -->|"views timeline"| node_timeline
node_dashboard_user -->|"views focus"| node_focus
node_dashboard_user -->|"views trends"| node_weekly
node_dashboard_user -->|"views insights"| node_insights_page
node_dashboard_user -->|"opens popup"| node_popup_page
node_overview -->|"reads activity"| node_activity_file
node_timeline -->|"renders timeline"| node_timeline_view
node_timeline_view -->|"reads activity"| node_activity_file
node_focus -->|"reads activity"| node_activity_file
node_weekly -->|"reads activity"| node_activity_file
node_insights_page -->|"reads activity"| node_activity_file
node_insights_page -->|"generates insights"| node_insights_engine
node_realtime_chart -->|"reads activity"| node_activity_file
node_overview -->|"renders trend"| node_realtime_chart
node_overview -->|"renders analytics"| node_chart_suite
node_focus -->|"renders focus charts"| node_chart_suite
node_weekly -->|"renders weekly charts"| node_chart_suite

click node_browser_extension "https://github.com/techorbit0813/neurotrace/blob/main/extension/background.js"
click node_extension_content "https://github.com/techorbit0813/neurotrace/blob/main/content.js"
click node_extension_popup "https://github.com/techorbit0813/neurotrace/blob/main/extension/popup.js"
click node_desktop_tracker "https://github.com/techorbit0813/neurotrace/blob/main/desktop-tracker.js"
click node_browser_api "https://github.com/techorbit0813/neurotrace/blob/main/app/api/save-activities/route.ts"
click node_desktop_api "https://github.com/techorbit0813/neurotrace/blob/main/app/api/save-desktop-activities/route.ts"
click node_overview "https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/page.tsx"
click node_timeline "https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/timeline/page.tsx"
click node_timeline_view "https://github.com/techorbit0813/neurotrace/blob/main/components/timeline/activity-timeline.tsx"
click node_focus "https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/focus/page.tsx"
click node_weekly "https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/weekly/page.tsx"
click node_insights_page "https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/insights/page.tsx"
click node_insights_engine "https://github.com/techorbit0813/neurotrace/blob/main/lib/insights-engine.ts"
click node_popup_page "https://github.com/techorbit0813/neurotrace/blob/main/app/popup/page.tsx"
click node_realtime_chart "https://github.com/techorbit0813/neurotrace/blob/main/components/charts/realtime-productivity-chart.tsx"
click node_chart_suite "https://github.com/techorbit0813/neurotrace/tree/main/components/charts"

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_browser_extension,node_extension_content,node_extension_popup,node_desktop_tracker,node_browser,node_desktop_user,node_dashboard_user toneBlue
class node_browser_api,node_desktop_api,node_activity_file toneAmber
class node_focus,node_weekly,node_insights_page,node_insights_engine toneMint
class node_overview,node_timeline,node_timeline_view,node_popup_page,node_realtime_chart,node_chart_suite toneRose
```

## Components

### Activity capture

- [Browser extension](https://github.com/techorbit0813/neurotrace/blob/main/extension/background.js): `extension/background.js`
- [Page content tracker](https://github.com/techorbit0813/neurotrace/blob/main/content.js): `content.js`
- [Extension popup](https://github.com/techorbit0813/neurotrace/blob/main/extension/popup.js): `extension/popup.js`
- [Desktop tracker](https://github.com/techorbit0813/neurotrace/blob/main/desktop-tracker.js): `desktop-tracker.js`

### Ingestion and storage

- [Browser activity API](https://github.com/techorbit0813/neurotrace/blob/main/app/api/save-activities/route.ts): `app/api/save-activities/route.ts`
- [Desktop activity API](https://github.com/techorbit0813/neurotrace/blob/main/app/api/save-desktop-activities/route.ts): `app/api/save-desktop-activities/route.ts`
- **Local activity data**

### Analytics

- [Focus analytics](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/focus/page.tsx): `app/(dashboard)/focus/page.tsx`
- [Weekly analytics](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/weekly/page.tsx): `app/(dashboard)/weekly/page.tsx`
- [Behavioral insights](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/insights/page.tsx): `app/(dashboard)/insights/page.tsx`
- [Insights engine](https://github.com/techorbit0813/neurotrace/blob/main/lib/insights-engine.ts): `lib/insights-engine.ts`

### User experience

- [Overview dashboard](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/page.tsx): `app/(dashboard)/page.tsx`
- [Activity timeline](https://github.com/techorbit0813/neurotrace/blob/main/app/(dashboard)/timeline/page.tsx): `app/(dashboard)/timeline/page.tsx`
- [Timeline renderer](https://github.com/techorbit0813/neurotrace/blob/main/components/timeline/activity-timeline.tsx): `components/timeline/activity-timeline.tsx`
- [Quick activity popup](https://github.com/techorbit0813/neurotrace/blob/main/app/popup/page.tsx): `app/popup/page.tsx`
- [Productivity trend chart](https://github.com/techorbit0813/neurotrace/blob/main/components/charts/realtime-productivity-chart.tsx): `components/charts/realtime-productivity-chart.tsx`
- [Analytics charts](https://github.com/techorbit0813/neurotrace/tree/main/components/charts): `components/charts`

### Other components

- **Browser user**
- **Desktop user**
- **Dashboard user**

## Connections

- Browser user → Browser extension: uses tabs
- Browser extension → Browser activity API: posts sessions
- Browser extension → Local activity data: stores locally
- Page content tracker → Browser extension: supplies page activity
- Extension popup → Browser extension: requests status
- Desktop user → Desktop tracker: runs tracker
- Desktop tracker → Desktop activity API: posts activity
- Browser activity API → Local activity data: merges and writes
- Desktop activity API → Local activity data: appends activity
- Dashboard user → Overview dashboard: views dashboard
- Dashboard user → Activity timeline: views timeline
- Dashboard user → Focus analytics: views focus
- Dashboard user → Weekly analytics: views trends
- Dashboard user → Behavioral insights: views insights
- Dashboard user → Quick activity popup: opens popup
- Overview dashboard → Local activity data: reads activity
- Activity timeline → Timeline renderer: renders timeline
- Timeline renderer → Local activity data: reads activity
- Focus analytics → Local activity data: reads activity
- Weekly analytics → Local activity data: reads activity
- Behavioral insights → Local activity data: reads activity
- Behavioral insights → Insights engine: generates insights
- Productivity trend chart → Local activity data: reads activity
- Overview dashboard → Productivity trend chart: renders trend
- Overview dashboard → Analytics charts: renders analytics
- Focus analytics → Analytics charts: renders focus charts
- Weekly analytics → Analytics charts: renders weekly charts
