How usghejr/fuel_tracker works
This is a web app for recording vehicle trips and fuel purchases, estimating trip costs, filtering trip history, and tracking reimbursements. The main workflow runs from the authenticated user through the app controller, which coordinates local trip/refuel data, cloud reads, matching and cost calculations, and reimbursement actions; the UI presents those results and supports trip entry/import. Authentication and offline-capable synchronization are supporting subsystems. Some component and sync implementations were not sampled, so their internal relationships are omitted unless the excerpts or README establish them.
Main entry points: App.tsx App shell · useAppController.ts App controller · useDataSync.ts Data sync · authService.ts Auth service
Components 27
Trip management
- App shell
src/App.tsx - App controller
src/features/app/hooks/useAppController.ts - Trip entry and import
src/features/trips/components - Trip filters and table
src/features/trips/components
Fuel and costs
- Trip matching and costs
src/features/trips/services/tripMatchingService.ts - Fuel conversion
src/shared/utils/fuelConverter.ts - Refuel management
src/features/refuels/components/RefuelBoxList.tsx - Refuel service
src/features/refuels/services/refuelService.ts - Reimbursement actions
src/features/reimbursements/hooks/useReimbursements.ts - Reimbursement calculation
src/features/reimbursements/services/reimbursementCalculator.ts - Reimbursement summary
src/features/reimbursements/components/ReimbursementSummaryCard.tsx
Identity and sync
- Login
src/features/auth/components/Login.tsx - Auth context
src/features/auth/context/AuthContext.tsx - Auth service
src/features/auth/services/authService.ts - Master sync
src/features/sync/hooks/useMasterSync.ts - Data sync
src/features/sync/hooks/useDataSync.ts - Browser lifecycle sync
src/features/sync/hooks/useBrowserLifecycleSync.ts - Sync service
src/features/sync/services/syncService.ts - Sync status
src/features/sync/components/SyncStatusIndicator.tsx
Data and platform
- Trip repository
src/database/repositories/tripRepository.ts - Refuel repository
src/database/repositories/refuelRepository.ts - Supabase client
src/database/supabaseClient.ts - Local storage service
src/shared/services/storage/localStorageService.ts - PWA install
src/features/pwa/components/InstallAppButton.tsx
Other components
- Driver
- Supabase
- Local storage
Connections 33
- Driver → App shell: uses
src/App.tsx - App shell → App controller: coordinates
src/App.tsx - App shell → Trip entry and import: renders
src/App.tsx - App shell → Trip filters and table: renders
src/App.tsx - App shell → Refuel management: renders
src/App.tsx - App shell → Reimbursement summary: renders
src/App.tsx - App shell → Login: renders
src/App.tsx - App shell → Sync status: renders
src/App.tsx - App shell → PWA install: renders
src/App.tsx - App controller → Trip repository: loads trips
src/features/app/hooks/useAppController.ts - App controller → Refuel repository: loads refuels
src/features/app/hooks/useAppController.ts - App controller → Trip matching and costs: enriches trips
src/features/app/hooks/useAppController.ts - App controller → Reimbursement actions: coordinates
src/features/app/hooks/useAppController.ts - App controller → Auth context: gets auth
src/features/app/hooks/useAppController.ts - App controller → Master sync: starts sync
src/features/app/hooks/useAppController.ts - Trip matching and costs → Fuel conversion: converts fuel
src/features/trips/services/tripMatchingService.ts - Reimbursement actions → Reimbursement calculation: calculates
src/features/reimbursements/hooks/useReimbursements.ts - Reimbursement actions → Trip matching and costs: uses matches
src/features/reimbursements/hooks/useReimbursements.ts - Reimbursement summary → Reimbursement calculation: reads summary
src/features/reimbursements/components/ReimbursementSummaryCard.tsx - Login → Auth service: authenticates
- Auth context → Auth service: uses
src/features/auth/context/AuthContext.tsx - Auth service → Supabase client: auth requests
src/features/auth/services/authService.ts - Auth service → Local storage service: clears metadata
src/features/auth/services/authService.ts - Master sync → Data sync: coordinates
src/features/sync/hooks/useMasterSync.ts - Data sync → Sync service: syncs queue
src/features/sync/hooks/useDataSync.ts - Data sync → Browser lifecycle sync: registers flush
src/features/sync/hooks/useDataSync.ts - Data sync → Local storage service: persists queue
src/features/sync/hooks/useDataSync.ts - Trip repository → Supabase client: queries
src/database/repositories/tripRepository.ts - Refuel repository → Supabase client: queries
src/database/repositories/refuelRepository.ts - Supabase client → Supabase: connects
src/database/supabaseClient.ts - Local storage service → Local storage: reads and writes
src/shared/services/storage/localStorageService.ts - Sync service → Trip repository: dispatches data
src/features/sync/services/syncService.ts - Sync service → Refuel repository: dispatches data
src/features/sync/services/syncService.ts