# masantillan/tracker architecture

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

- Interactive diagram: https://gitdiagram.com/masantillan/tracker
- Repository: https://github.com/masantillan/tracker

## Overview

This is a browser-based expense tracker: a user submits or deletes an expense, and the screen refreshes to show that day’s expenses and total. The app validates and formats amounts, while a separate module persists expenses in IndexedDB and filters them by local day. A service worker provides a cache-first path for GET requests, falling back to the network. The excerpts show these runtime behaviors; the HTML and manifest were not sampled, so their wiring and any additional capabilities are not represented.

Main entry points: [`sw.js`](https://github.com/masantillan/tracker/blob/main/sw.js) (Service worker), [`js/app.js`](https://github.com/masantillan/tracker/blob/main/js/app.js) (Expense screen and actions), [`js/db.js`](https://github.com/masantillan/tracker/blob/main/js/db.js) (Expense persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_expense_app["Expense tracking"]
  node_expense_app["Expense screen and actions<br/>[app.js]"]
  node_expense_db["Expense persistence<br/>[db.js]"]
end

subgraph group_offline["Offline support"]
  node_service_worker["Service worker<br/>[sw.js]"]
end

node_user(("User"))
node_indexeddb[("IndexedDB")]
node_cache_storage[("Cache Storage")]
node_network(("Network"))

node_user -->|"submits or deletes"| node_expense_app
node_expense_app -->|"adds, lists, deletes"| node_expense_db
node_expense_db -->|"reads and writes"| node_indexeddb
node_service_worker -->|"checks cache"| node_cache_storage
node_service_worker -->|"fetches on miss"| node_network

click node_expense_app "https://github.com/masantillan/tracker/blob/main/js/app.js"
click node_expense_db "https://github.com/masantillan/tracker/blob/main/js/db.js"
click node_service_worker "https://github.com/masantillan/tracker/blob/main/sw.js"

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_expense_app,node_expense_db,node_user toneBlue
class node_service_worker,node_indexeddb,node_cache_storage toneAmber
class node_network toneIndigo
```

## Components

### Expense tracking

- [Expense screen and actions](https://github.com/masantillan/tracker/blob/main/js/app.js): `js/app.js`
- [Expense persistence](https://github.com/masantillan/tracker/blob/main/js/db.js): `js/db.js`

### Offline support

- [Service worker](https://github.com/masantillan/tracker/blob/main/sw.js): `sw.js`

### Other components

- **User**
- **IndexedDB**
- **Cache Storage**
- **Network**

## Connections

- User → Expense screen and actions: submits or deletes (evidence: `js/app.js`)
- Expense screen and actions → Expense persistence: adds, lists, deletes (evidence: `js/app.js`)
- Expense persistence → IndexedDB: reads and writes (evidence: `js/db.js`)
- Service worker → Cache Storage: checks cache (evidence: `sw.js`)
- Service worker → Network: fetches on miss (evidence: `sw.js`)
