# mattwalker75/junk_tracker architecture

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

- Interactive diagram: https://gitdiagram.com/mattwalker75/junk_tracker
- Repository: https://github.com/mattwalker75/junk_tracker

## Overview

Junk Tracker is a self-hosted personal tracker for splurges, activity, weight, and goals, with optional multi-user sign-in and network access. A person opens the web app, views Home or navigates to Calendar and Goals, and uses sheets to record or edit entries; the client sends API requests to the server, which coordinates user, goal, and log services backed by SQLite. Settings cover personal preferences, appearance, users, and network access. Some server routes and UI implementations were not excerpted, so their detailed internal links are omitted.

Main entry points: [`web/src/App.tsx`](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/App.tsx) (App shell), [`server/src/app.ts`](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/app.ts) (HTTP API), [`web/src/lib/api.ts`](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/api.ts) (HTTP client), [`web/src/components/Home.tsx`](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/Home.tsx) (Home dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Tracker interface"]
  node_app["App shell<br/>[App.tsx]"]
  node_home["Home dashboard<br/>[Home.tsx]"]
  node_calendar["Calendar<br/>[CalendarPage.tsx]"]
  node_day["Day detail<br/>[DaySheet.tsx]"]
  node_splurge["Splurge logging<br/>[LogSheet.tsx]"]
  node_activity["Activity logging<br/>[ActivitySheet.tsx]"]
  node_weighin["Weigh-ins<br/>[WeighSheet.tsx]"]
  node_goalsui["Goals interface<br/>[GoalsPage.tsx]"]
  node_goalnote["Home goal note<br/>[GoalNote.tsx]"]
  node_settings["Settings<br/>[SettingsPage.tsx]"]
  node_authui["Sign-in interface<br/>[AuthScreen.tsx]"]
end

subgraph group_client["Client foundations"]
  node_router["Hash router<br/>[route.ts]"]
  node_api["HTTP client<br/>[api.ts]"]
  node_stats["Log statistics<br/>[stats.ts]"]
  node_dates["Date utilities<br/>[dates.ts]"]
  node_actions["Sheet actions<br/>[actions.tsx]"]
  node_shared["Shared data types<br/>[types.ts]"]
end

subgraph group_server["Server services"]
  node_http["HTTP API<br/>[app.ts]"]
  node_config["App configuration<br/>[config.ts]"]
  node_security["Request security<br/>[security.ts]"]
  node_users["User management<br/>[users.ts]"]
  node_goals["Goal service<br/>[goals.ts]"]
  node_logsvc["Tracking log service<br/>[log.ts]"]
end

subgraph group_state["Persistent data"]
  node_database[("SQLite database<br/>[db.ts]")]
end

node_person(("Tracker user"))

node_person -->|"uses"| node_app
node_app -->|"reads routes"| node_router
node_app -->|"renders"| node_home
node_app -->|"renders"| node_calendar
node_app -->|"renders"| node_goalsui
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_authui
node_app -->|"opens"| node_day
node_app -->|"opens"| node_splurge
node_app -->|"opens"| node_activity
node_app -->|"opens"| node_weighin
node_home -->|"renders"| node_goalnote
node_home -->|"calculates metrics"| node_stats
node_calendar -->|"calculates totals"| node_stats
node_home -->|"requests data"| node_api
node_calendar -->|"requests data"| node_api
node_goalsui -->|"updates goals"| node_api
node_splurge -->|"sends entries"| node_api
node_activity -->|"sends entries"| node_api
node_weighin -->|"sends weigh-ins"| node_api
node_day -->|"requests day data"| node_api
node_stats -->|"uses calendar arithmetic"| node_dates
node_app -->|"provides actions"| node_actions
node_api -->|"calls endpoints"| node_http
node_http -->|"opens"| node_database
node_http -->|"dispatches user operations"| node_users
node_http -->|"dispatches goal operations"| node_goals
node_http -->|"dispatches log operations"| node_logsvc
node_http -->|"reads settings"| node_config
node_http -->|"guards requests"| node_security
node_logsvc -->|"uses goal service"| node_goals
node_logsvc -->|"uses user service"| node_users
node_http -->|"uses shared types"| node_shared
node_api -->|"types API data"| node_shared

click node_app "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/App.tsx"
click node_home "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/Home.tsx"
click node_calendar "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/CalendarPage.tsx"
click node_day "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/DaySheet.tsx"
click node_splurge "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/LogSheet.tsx"
click node_activity "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/ActivitySheet.tsx"
click node_weighin "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/WeighSheet.tsx"
click node_goalsui "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/GoalsPage.tsx"
click node_goalnote "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/GoalNote.tsx"
click node_settings "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/settings/SettingsPage.tsx"
click node_authui "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/AuthScreen.tsx"
click node_router "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/route.ts"
click node_api "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/api.ts"
click node_stats "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/stats.ts"
click node_dates "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/dates.ts"
click node_actions "https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/actions.tsx"
click node_shared "https://github.com/mattwalker75/junk_tracker/blob/main/shared/types.ts"
click node_http "https://github.com/mattwalker75/junk_tracker/blob/main/server/src/app.ts"
click node_config "https://github.com/mattwalker75/junk_tracker/blob/main/server/src/config.ts"
click node_security "https://github.com/mattwalker75/junk_tracker/blob/main/server/src/security.ts"
click node_users "https://github.com/mattwalker75/junk_tracker/blob/main/server/src/users.ts"
click node_goals "https://github.com/mattwalker75/junk_tracker/blob/main/server/src/goals.ts"
click node_logsvc "https://github.com/mattwalker75/junk_tracker/blob/main/server/src/log.ts"
click node_database "https://github.com/mattwalker75/junk_tracker/blob/main/server/src/db.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_app,node_home,node_calendar,node_day,node_splurge,node_activity,node_weighin,node_goalsui,node_goalnote,node_settings,node_authui,node_person toneBlue
class node_router,node_api,node_stats,node_dates,node_actions,node_shared toneAmber
class node_http,node_config,node_security,node_users,node_goals,node_logsvc toneMint
class node_database toneRose
```

## Components

### Tracker interface

- [App shell](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Home dashboard](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/Home.tsx): `web/src/components/Home.tsx`
- [Calendar](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/CalendarPage.tsx): `web/src/components/CalendarPage.tsx`
- [Day detail](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/DaySheet.tsx): `web/src/components/DaySheet.tsx`
- [Splurge logging](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/LogSheet.tsx): `web/src/components/LogSheet.tsx`
- [Activity logging](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/ActivitySheet.tsx): `web/src/components/ActivitySheet.tsx`
- [Weigh-ins](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/WeighSheet.tsx): `web/src/components/WeighSheet.tsx`
- [Goals interface](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/GoalsPage.tsx): `web/src/components/GoalsPage.tsx`
- [Home goal note](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/GoalNote.tsx): `web/src/components/GoalNote.tsx`
- [Settings](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/settings/SettingsPage.tsx): `web/src/settings/SettingsPage.tsx`
- [Sign-in interface](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/components/AuthScreen.tsx): `web/src/components/AuthScreen.tsx`

### Client foundations

- [Hash router](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/route.ts): `web/src/lib/route.ts`
- [HTTP client](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`
- [Log statistics](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/stats.ts): `web/src/lib/stats.ts`
- [Date utilities](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/dates.ts): `web/src/lib/dates.ts`
- [Sheet actions](https://github.com/mattwalker75/junk_tracker/blob/main/web/src/lib/actions.tsx): `web/src/lib/actions.tsx`
- [Shared data types](https://github.com/mattwalker75/junk_tracker/blob/main/shared/types.ts): `shared/types.ts`

### Server services

- [HTTP API](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/app.ts): `server/src/app.ts`
- [App configuration](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/config.ts): `server/src/config.ts`
- [Request security](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/security.ts): `server/src/security.ts`
- [User management](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/users.ts): `server/src/users.ts`
- [Goal service](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/goals.ts): `server/src/goals.ts`
- [Tracking log service](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/log.ts): `server/src/log.ts`

### Persistent data

- [SQLite database](https://github.com/mattwalker75/junk_tracker/blob/main/server/src/db.ts): `server/src/db.ts`

### Other components

- **Tracker user**

## Connections

- Tracker user → App shell: uses (evidence: `README.md`)
- App shell → Hash router: reads routes (evidence: `web/src/App.tsx`)
- App shell → Home dashboard: renders (evidence: `web/src/App.tsx`)
- App shell → Calendar: renders (evidence: `web/src/App.tsx`)
- App shell → Goals interface: renders (evidence: `web/src/App.tsx`)
- App shell → Settings: renders (evidence: `web/src/App.tsx`)
- App shell → Sign-in interface: renders (evidence: `web/src/App.tsx`)
- App shell → Day detail: opens (evidence: `web/src/App.tsx`)
- App shell → Splurge logging: opens (evidence: `web/src/App.tsx`)
- App shell → Activity logging: opens (evidence: `web/src/App.tsx`)
- App shell → Weigh-ins: opens (evidence: `web/src/App.tsx`)
- Home dashboard → Home goal note: renders (evidence: `web/src/components/Home.tsx`)
- Home dashboard → Log statistics: calculates metrics (evidence: `web/src/components/Home.tsx`)
- Calendar → Log statistics: calculates totals (evidence: `web/src/components/CalendarPage.tsx`)
- Home dashboard → HTTP client: requests data (evidence: `web/src/components/Home.tsx`)
- Calendar → HTTP client: requests data (evidence: `web/src/components/CalendarPage.tsx`)
- Goals interface → HTTP client: updates goals (evidence: `web/src/components/GoalsPage.tsx`)
- Splurge logging → HTTP client: sends entries (evidence: `web/src/components/LogSheet.tsx`)
- Activity logging → HTTP client: sends entries (evidence: `web/src/components/ActivitySheet.tsx`)
- Weigh-ins → HTTP client: sends weigh-ins (evidence: `web/src/components/WeighSheet.tsx`)
- Day detail → HTTP client: requests day data (evidence: `web/src/components/DaySheet.tsx`)
- Log statistics → Date utilities: uses calendar arithmetic (evidence: `web/src/lib/stats.ts`)
- App shell → Sheet actions: provides actions (evidence: `web/src/App.tsx`)
- HTTP client → HTTP API: calls endpoints (evidence: `web/src/lib/api.ts`)
- HTTP API → SQLite database: opens (evidence: `server/src/app.ts`)
- HTTP API → User management: dispatches user operations (evidence: `server/src/app.ts`)
- HTTP API → Goal service: dispatches goal operations (evidence: `server/src/app.ts`)
- HTTP API → Tracking log service: dispatches log operations (evidence: `server/src/app.ts`)
- HTTP API → App configuration: reads settings (evidence: `server/src/app.ts`)
- HTTP API → Request security: guards requests (evidence: `server/src/app.ts`)
- Tracking log service → Goal service: uses goal service (evidence: `server/src/log.ts`)
- Tracking log service → User management: uses user service (evidence: `server/src/log.ts`)
- HTTP API → Shared data types: uses shared types (evidence: `server/src/app.ts`)
- HTTP client → Shared data types: types API data (evidence: `web/src/lib/api.ts`)
