How salehtl/ledger works
Ledger is a private, single-user budgeting PWA backed by one Go process and SQLite. Its main workflow reads bank alerts from a read-only IMAP mailbox, parses and categorizes transactions, stores them, and serves budget state to the PWA over HTTP and live updates. The product also supports historical imports, review and transaction management, accounts, projects, recurring charges, reports, insights, and ingest monitoring with alerts. Relationships use README statements or shown frontend calls; several backend resource and integration links are documented at package level rather than verified in sampled handlers.
Main entry points: client.ts API client · server HTTP and live API · AppShell.tsx Budget PWA · store SQLite store
Components 26
Email intake
- IMAP worker
internal/ingest - Parse cascade
internal/parse - Categorization
internal/categorize - AI classifier
internal/classify - Historical import
internal/importer
Ledger services
- HTTP and live API
internal/server - CSV export
internal/server/export.go
Persistent data
- SQLite store
internal/store
PWA experience
- Budget PWA
frontend/src/app/AppShell.tsx - API client
frontend/src/api/client.ts - Ingest health UI
frontend/src/screens/settings/IngestHealthPage.tsx - Transactions and review
frontend/src/screens/Transactions.tsx - Budget home
frontend/src/screens/Home.tsx - Insights and reports
frontend/src/screens/Insights.tsx - Settings and rules
frontend/src/screens/settings/SettingsPage.tsx - Accounts and balances
frontend/src/screens/accounts - Projects
frontend/src/screens/projects - Recurring charges
frontend/src/screens/recurring - Financial reports
frontend/src/screens/reports
Planning and reporting
- Budget math
internal/budget - Recurring detection
internal/recur - Ingest monitoring
internal/monitor - Web Push
internal/push
Other components
- Bank email
- AI provider
- User
Connections 31
- Bank email → IMAP worker: arrives in
- IMAP worker → Parse cascade: submits messages
- Parse cascade → Categorization: passes transactions
- Parse cascade → AI classifier: checks classification
- Categorization → AI classifier: categorizes unknowns
- AI classifier → AI provider: requests classification
- Categorization → SQLite store: stores results
- IMAP worker → SQLite store: retains raw bodies
- Historical import → SQLite store: backfills history
- HTTP and live API → SQLite store: reads and writes
- Budget math → SQLite store: uses transactions
- Recurring detection → SQLite store: checks history
- Ingest monitoring → HTTP and live API: publishes drift alerts
- HTTP and live API → Web Push: sends alerts
- User → Budget PWA: uses
- Budget PWA → API client: requests data
frontend/src/app/AppShell.tsx - API client → HTTP and live API: calls HTTP API
frontend/src/api/client.ts - HTTP and live API → Budget PWA: streams live updates
- Budget PWA → Budget home: shows budget
frontend/src/app/AppShell.tsx - Budget PWA → Transactions and review: opens transactions
frontend/src/app/AppShell.tsx - Budget PWA → Insights and reports: opens insights
frontend/src/app/AppShell.tsx - API client → Ingest health UI: fetches health
frontend/src/screens/settings/IngestHealthPage.tsx - API client → Transactions and review: serves transaction actions
- API client → Settings and rules: serves settings
- API client → Accounts and balances: serves account data
- API client → Projects: serves project data
- API client → Recurring charges: serves schedules
- API client → Financial reports: serves reports
- API client → CSV export: requests export
- HTTP and live API → Budget math: exposes budget state
- HTTP and live API → Recurring detection: exposes recurring results