# mlml88/cs498 architecture

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

- Interactive diagram: https://gitdiagram.com/mlml88/cs498
- Repository: https://github.com/mlml88/cs498

## Overview

WebTrack is a browser extension for tracking time spent on websites, reviewing usage, organizing domains, and setting time limits. The main workflow starts with browser tab and focus events: the background tracker measures eligible-site activity, updates stored usage and alarm state, and the popup presents summaries and management screens. The popup also supports tags, blacklisting, settings, and sharing. The README only documents how to run the project; feature coverage and links for unsampled screens are based on the source index and declared routes, not inspected implementations.

Main entry points: [`entrypoints/popup/App.tsx`](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/App.tsx) (Popup router), [`entrypoints/background.ts`](https://github.com/mlml88/cs498/blob/Master/entrypoints/background.ts) (Activity tracker), [`entrypoints/popup/services/Time.ts`](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Time.ts) (Time data service), [`entrypoints/popup/pages/MainPage.tsx`](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/MainPage.tsx) (Usage overview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tracking["Tracking and alerts"]
  node_tracker["Activity tracker<br/>[background.ts]"]
end

subgraph group_data["Usage and preferences"]
  node_time_service["Time data service<br/>[Time.ts]"]
  node_alarm_service["Alarm service<br/>[Alarm.ts]"]
  node_tag_service["Tag service<br/>[Tag.ts]"]
  node_blacklist_service["Blacklist service<br/>[Blacklist.ts]"]
  node_local_storage[("Extension local storage")]
end

subgraph group_popup["Popup experience"]
  node_popup_root["Popup entry<br/>[main.tsx]"]
  node_app["Popup router<br/>[App.tsx]"]
  node_overview["Usage overview<br/>[MainPage.tsx]"]
  node_share["Share view<br/>[SharePage.tsx]"]
  node_settings["Settings<br/>[SettingsPage.tsx]"]
  node_chart["Usage chart"]
  node_usage_list["Usage list<br/>[List.tsx]"]
end

subgraph group_management["Domain management"]
  node_alarms_ui["Alarm management<br/>[AlarmsPage.tsx]"]
  node_blacklist_ui["Blacklist management<br/>[BlacklistPage.tsx]"]
  node_tags_ui["Tag management<br/>[TagsPage.tsx]"]
end

node_user(("User"))
node_browser["Browser events"]
node_notification["Notifications"]

node_user -->|"uses"| node_browser
node_browser -->|"sends tab events"| node_tracker
node_tracker -->|"records usage"| node_time_service
node_tracker -->|"updates alarms"| node_alarm_service
node_tracker -->|"checks exclusions"| node_blacklist_service
node_tracker -->|"creates alerts"| node_notification
node_popup_root -->|"renders"| node_app
node_app -->|"routes"| node_overview
node_app -->|"routes"| node_share
node_app -->|"routes"| node_settings
node_app -->|"routes"| node_alarms_ui
node_app -->|"routes"| node_blacklist_ui
node_app -->|"routes"| node_tags_ui
node_overview -->|"reads usage"| node_time_service
node_overview -->|"reads tags"| node_tag_service
node_overview -->|"renders"| node_chart
node_overview -->|"renders"| node_usage_list
node_tags_ui -->|"manages tags"| node_tag_service
node_tags_ui -->|"reads domains"| node_time_service
node_alarms_ui -->|"manages alarms"| node_alarm_service
node_alarms_ui -->|"normalizes domains"| node_tracker
node_blacklist_ui -->|"manages exclusions"| node_blacklist_service
node_blacklist_ui -->|"reads and edits usage"| node_time_service
node_blacklist_ui -->|"gets date key"| node_tracker
node_settings -->|"uses time data"| node_time_service
node_time_service -->|"reads and writes"| node_local_storage
node_alarm_service -->|"reads and writes"| node_local_storage
node_tag_service -->|"reads and writes"| node_local_storage
node_blacklist_service -->|"reads and writes"| node_local_storage

click node_popup_root "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/main.tsx"
click node_app "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/App.tsx"
click node_overview "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/MainPage.tsx"
click node_share "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/SharePage.tsx"
click node_settings "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/SettingsPage.tsx"
click node_chart "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/components/PieChartWithKey.tsx"
click node_usage_list "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/components/List.tsx"
click node_alarms_ui "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/AlarmsPage.tsx"
click node_blacklist_ui "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/BlacklistPage.tsx"
click node_tags_ui "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/TagsPage.tsx"
click node_tracker "https://github.com/mlml88/cs498/blob/Master/entrypoints/background.ts"
click node_time_service "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Time.ts"
click node_alarm_service "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Alarm.ts"
click node_tag_service "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Tag.ts"
click node_blacklist_service "https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Blacklist.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_tracker,node_user,node_browser toneBlue
class node_time_service,node_alarm_service,node_tag_service,node_blacklist_service,node_local_storage toneAmber
class node_popup_root,node_app,node_overview,node_share,node_settings,node_chart,node_usage_list toneMint
class node_alarms_ui,node_blacklist_ui,node_tags_ui toneRose
class node_notification toneIndigo
```

## Components

### Tracking and alerts

- [Activity tracker](https://github.com/mlml88/cs498/blob/Master/entrypoints/background.ts): `entrypoints/background.ts`

### Usage and preferences

- [Time data service](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Time.ts): `entrypoints/popup/services/Time.ts`
- [Alarm service](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Alarm.ts): `entrypoints/popup/services/Alarm.ts`
- [Tag service](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Tag.ts): `entrypoints/popup/services/Tag.ts`
- [Blacklist service](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/services/Blacklist.ts): `entrypoints/popup/services/Blacklist.ts`
- **Extension local storage**

### Popup experience

- [Popup entry](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/main.tsx): `entrypoints/popup/main.tsx`
- [Popup router](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/App.tsx): `entrypoints/popup/App.tsx`
- [Usage overview](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/MainPage.tsx): `entrypoints/popup/pages/MainPage.tsx`
- [Share view](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/SharePage.tsx): `entrypoints/popup/pages/SharePage.tsx`
- [Settings](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/SettingsPage.tsx): `entrypoints/popup/pages/SettingsPage.tsx`
- [Usage chart](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/components/PieChartWithKey.tsx): `entrypoints/popup/components/PieChartWithKey.tsx`
- [Usage list](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/components/List.tsx): `entrypoints/popup/components/List.tsx`

### Domain management

- [Alarm management](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/AlarmsPage.tsx): `entrypoints/popup/pages/AlarmsPage.tsx`
- [Blacklist management](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/BlacklistPage.tsx): `entrypoints/popup/pages/BlacklistPage.tsx`
- [Tag management](https://github.com/mlml88/cs498/blob/Master/entrypoints/popup/pages/TagsPage.tsx): `entrypoints/popup/pages/TagsPage.tsx`

### Other components

- **User**
- **Browser events**
- **Notifications**

## Connections

- User → Browser events: uses
- Browser events → Activity tracker: sends tab events (evidence: `entrypoints/background.ts`)
- Activity tracker → Time data service: records usage (evidence: `entrypoints/background.ts`)
- Activity tracker → Alarm service: updates alarms (evidence: `entrypoints/background.ts`)
- Activity tracker → Blacklist service: checks exclusions (evidence: `entrypoints/background.ts`)
- Activity tracker → Notifications: creates alerts (evidence: `entrypoints/background.ts`)
- Popup entry → Popup router: renders (evidence: `entrypoints/popup/main.tsx`)
- Popup router → Usage overview: routes (evidence: `entrypoints/popup/App.tsx`)
- Popup router → Share view: routes (evidence: `entrypoints/popup/App.tsx`)
- Popup router → Settings: routes (evidence: `entrypoints/popup/App.tsx`)
- Popup router → Alarm management: routes (evidence: `entrypoints/popup/App.tsx`)
- Popup router → Blacklist management: routes (evidence: `entrypoints/popup/App.tsx`)
- Popup router → Tag management: routes (evidence: `entrypoints/popup/App.tsx`)
- Usage overview → Time data service: reads usage (evidence: `entrypoints/popup/pages/MainPage.tsx`)
- Usage overview → Tag service: reads tags (evidence: `entrypoints/popup/pages/MainPage.tsx`)
- Usage overview → Usage chart: renders (evidence: `entrypoints/popup/pages/MainPage.tsx`)
- Usage overview → Usage list: renders (evidence: `entrypoints/popup/pages/MainPage.tsx`)
- Tag management → Tag service: manages tags (evidence: `entrypoints/popup/pages/TagsPage.tsx`)
- Tag management → Time data service: reads domains (evidence: `entrypoints/popup/pages/TagsPage.tsx`)
- Alarm management → Alarm service: manages alarms (evidence: `entrypoints/popup/pages/AlarmsPage.tsx`)
- Alarm management → Activity tracker: normalizes domains (evidence: `entrypoints/popup/pages/AlarmsPage.tsx`)
- Blacklist management → Blacklist service: manages exclusions (evidence: `entrypoints/popup/pages/BlacklistPage.tsx`)
- Blacklist management → Time data service: reads and edits usage (evidence: `entrypoints/popup/pages/BlacklistPage.tsx`)
- Blacklist management → Activity tracker: gets date key (evidence: `entrypoints/popup/pages/BlacklistPage.tsx`)
- Settings → Time data service: uses time data (evidence: `entrypoints/popup/pages/SettingsPage.tsx`)
- Time data service → Extension local storage: reads and writes (evidence: `entrypoints/popup/services/Time.ts`)
- Alarm service → Extension local storage: reads and writes (evidence: `entrypoints/popup/services/Alarm.ts`)
- Tag service → Extension local storage: reads and writes (evidence: `entrypoints/popup/services/Tag.ts`)
- Blacklist service → Extension local storage: reads and writes (evidence: `entrypoints/popup/services/Blacklist.ts`)
