How spkchalla/expense-tracker works
Pocket Ledger is a mobile-first personal expense and reserve-planning PWA. Users authenticate, capture and review discretionary expenses, manage separate mandatory-need reserves and budgets, and inspect reports; offline captures queue locally and sync to the API. The backend routes requests through controllers and domain services to MongoDB models. The README documents CSV export, undo, PWA installation, and admin privacy/privilege management; several of these implementations were not sampled, so their internal links are not inferred.
Main entry points: App.jsx App router · db.js MongoDB · api.js API client · dashboardService.js Dashboard calculations
Components 29
PWA client
- App router
client/src/app/App.jsx - Authentication UI
client/src/features/auth/AuthContext.jsx - Dashboard
client/src/features/dashboard - Needs and reserves
client/src/features/needs/NeedsPage.jsx - Transactions
client/src/features/transactions/TransactionListPage.jsx - Budget settings
client/src/features/budgets/BudgetSettingsPage.jsx - Reports and export
client/src/features/reports/ReportsPage.jsx - Admin management
client/src/features/admin - Profile and PWA
client/src/features/profile/ProfilePage.jsx - Currency formatting
client/src/lib/formatters.js - API client
client/src/lib/api.js
API and domain
- Express app
server/src/app.js - API routes
server/src/routes/index.js - Authentication
server/src/services/authService.js - Reserve planning
server/src/services/needService.js - Dashboard calculations
server/src/services/dashboardService.js - Expense processing
server/src/services/transactionService.js - Admin controls
server/src/services/adminService.js
Persistent data
- MongoDB
server/src/config/db.js - User records
server/src/models/User.js - Categories
server/src/models/Category.js - Need records
server/src/models/Need.js - Contributions
server/src/models/NeedContribution.js - Transactions
server/src/models/Transaction.js - Monthly budgets
server/src/models/MonthlyBudget.js - Admin audit logs
server/src/models/AdminAuditLog.js
Offline capture
- Offline sync
client/src/hooks/useOfflineSync.js - Pending transaction store
client/src/lib/db.js
Other components
- User
Connections 40
- User → App router: uses
README.md - App router → Authentication UI: checks session
client/src/app/App.jsx - App router → Dashboard: routes to
client/src/app/App.jsx - App router → Needs and reserves: routes to
client/src/app/App.jsx - App router → Transactions: routes to
client/src/app/App.jsx - App router → Budget settings: routes to
client/src/app/App.jsx - App router → Reports and export: routes to
client/src/app/App.jsx - App router → Admin management: routes to
client/src/app/App.jsx - App router → Profile and PWA: routes to
client/src/app/App.jsx - Authentication UI → API client: requests auth
client/src/features/auth/AuthContext.jsx - Transactions → API client: fetches and edits
client/src/features/transactions/TransactionListPage.jsx - Needs and reserves → API client: loads reserves
client/src/features/needs/NeedsPage.jsx - Budget settings → API client: requests budgets
client/src/features/budgets/BudgetSettingsPage.jsx - Reports and export → API client: requests reports
client/src/features/reports/ReportsPage.jsx - Admin management → API client: requests admin data
client/src/features/admin/AdminPage.jsx - Needs and reserves → Currency formatting: formats amounts
client/src/features/needs/NeedsPage.jsx - App router → Offline sync: starts sync
client/src/app/App.jsx - Offline sync → Pending transaction store: queues and clears
client/src/hooks/useOfflineSync.js - Offline sync → API client: syncs queued items
client/src/hooks/useOfflineSync.js - API client → Express app: sends API requests
README.md - Express app → API routes: mounts
server/src/app.js - Authentication → User records: reads and writes
server/src/services/authService.js - Authentication → Categories: seeds categories
server/src/services/authService.js - Reserve planning → Need records: uses records
server/src/services/needService.js - Reserve planning → Contributions: uses records
server/src/services/needService.js - Reserve planning → Transactions: uses records
server/src/services/needService.js - Dashboard calculations → Need records: reads
server/src/services/dashboardService.js - Dashboard calculations → Contributions: reads
server/src/services/dashboardService.js - Dashboard calculations → Transactions: reads
server/src/services/dashboardService.js - Dashboard calculations → Categories: reads
server/src/services/dashboardService.js - Dashboard calculations → Monthly budgets: reads
server/src/services/dashboardService.js - Expense processing → Transactions: processes expenses
- Admin controls → Admin audit logs: manages audit data
- MongoDB → User records: persists
- MongoDB → Categories: persists
- MongoDB → Need records: persists
- MongoDB → Contributions: persists
- MongoDB → Transactions: persists
- MongoDB → Monthly budgets: persists
- MongoDB → Admin audit logs: persists