Overview
CarTrack is a local-first web application for tracking EV, PHEV, and gasoline vehicle consumption. It records odometer readings, charging or refueling events, and maintenance work, then calculates consumption and cost metrics and estimates range, days until empty, and upcoming maintenance.
Core data lives in the browserβs IndexedDB, and the app can be installed as an offline-capable PWA. Cloud sync is not part of the current local-first flow.
Why I Built This
I wanted a simple way to track my carβs consumption over time without relying on cloud services or manufacturer apps. Building my own gave me control over the data model and the experience.
Key Features
Dual Vehicle Support
Track electric vehicles, plug-in hybrids, and gasoline cars in one app. Each vehicle type has tailored consumption metrics, such as km per % for EVs and km per liter for gasoline.
Consumption Calculations
Consumption calculations use charge-cycle data where appropriate, with median and outlier handling to make readings more stable over time. Recent work also extracted shared vehicle-statistics logic and improved the rolling calculations.
Predictions
Estimate range and days until empty from reading history and configured daily distance. Maintenance items can also be forecast from their due rules and completion history.
Fuel and Maintenance Events
Log charging sessions and refueling events with cost and amount tracking. Maintenance records include scheduled work, costs, due status, and completion history.
Charts
Visualize consumption, cost per km, fuel-event costs, and maintenance costs with interactive charts.
Data Export and Import
Export a full JSON backup or a per-vehicle CSV file. Imports are duplicate-safe and include protections for oversized files.
Build Notes
Local-First Storage
Vehicle, reading, fuel-event, and maintenance data are stored in IndexedDB through Dexie.js. TanStack Query manages async state around the local data layer, while Zustand handles client preferences and UI state.
Evolving Calculations
The project has grown from a consumption log into a broader vehicle tracker. Recent releases added scheduled maintenance, completion history, maintenance cost trends, and maintenance due-date forecasting alongside the existing consumption calculations.