A self-hosted car running cost tracker. Track fuel, insurance, servicing and other vehicle expenses with full fuel efficiency analysis (MPG, km/L) and spending reports.
Built with Flask + Python + flat JSON storage. Runs in Docker on Mac, Windows, Linux, or a Synology NAS.
- Multi-vehicle support β track any number of cars independently
- Fuel efficiency analysis β MPG and km/L calculated from consecutive full-tank fills
- LubeLogger import β import your existing fuel history from LubeLogger CSV exports
- 9 reports β monthly spend, category breakdown, cumulative spend, MPG trend, km/L trend, price-per-litre trend, cost-per-mile, fill-up interval, fuel vs other costs, annual breakdown table
- UK date format β DD/MM/YYYY throughout
- Light/dark mode β defaults to light; preference saved in browser
- JSON backup/restore β export and import your full data at any time
- No external dependencies β fully self-hosted, no cloud services required
- Docker Desktop (Mac / Windows) or Docker + Docker Compose (Linux / Synology)
- Git
# 1. Clone the repository
git clone https://github.com/quiggles/autoledger.git
cd autoledger
# 2. Copy the example env file
cp .env.example .env
# 3. Start the container
docker compose up --build -dThen open http://localhost:5050 in your browser.
Data is stored in ./data/ (created automatically on first run).
# 1. Clone the repository
git clone https://github.com/quiggles/autoledger.git
cd autoledger
# 2. Copy the example env file
copy .env.example .env
# 3. Start the container
docker compose up --build -dThen open http://localhost:5050 in your browser.
Note: Run the commands above in PowerShell, Command Prompt, or Git Bash. Docker Desktop for Windows must be running first.
- Open Portainer β Stacks β Add Stack
- Paste the contents of
docker-compose.yml - Set the environment variable
DATA_PATHto/volume1/docker/autoledger/data - Deploy the stack
# SSH into your NAS
ssh admin@192.168.0.100
# Create directories
mkdir -p /volume1/docker/autoledger/data
# Clone the repo
cd /volume1/docker/autoledger
git clone https://github.com/quiggles/autoledger.git .
# Configure data path
echo "DATA_PATH=/volume1/docker/autoledger/data" > .env
# Start
docker compose up -d --buildApp will be at http://192.168.0.100:5050
Copy .env.example to .env (if you haven't already), then edit it to configure the data storage location:
# Mac / Linux / Windows (default β stores data next to docker-compose.yml)
DATA_PATH=./data
# Synology NAS
DATA_PATH=/volume1/docker/autoledger/dataAll other settings (currency, categories) are managed through the app's Settings page.
# Pull latest code
git pull
# Rebuild and restart
docker compose up --buildYour data in ./data/ is never touched by an update.
If you're coming from LubeLogger:
- In LubeLogger, export your fuel log as CSV (each vehicle separately)
- In AutoLedger, create your vehicle on the Vehicles page
- Go to Import / Export β Import LubeLogger CSV
- Select your exported CSV file
AutoLedger reads LubeLogger's column format directly:
Date, Odometer, FuelConsumed, Cost, FuelEconomy, IsFillToFull, Notes
All data is stored as plain JSON files in the data/ directory:
| File | Contents |
|---|---|
data/costs.json |
All cost records |
data/vehicles.json |
Vehicle definitions |
data/settings.json |
User preferences (currency, categories) |
Backup: use the Export AutoLedger JSON button, or simply copy the data/ folder.
Restore: use the Import AutoLedger JSON button on the Import/Export page.
The app runs on port 5050 by default. To change it, edit docker-compose.yml:
ports:
- "YOUR_PORT:5000"| Layer | Technology |
|---|---|
| Backend | Python 3.11, Flask 3.0, Gunicorn |
| Storage | JSON files (atomic writes via tempfile + os.replace) |
| Frontend | Vanilla JS (no framework), Chart.js 4.4 |
| Fonts | Inter + Syne (Google Fonts) |
| Container | Docker + Docker Compose |
autoledger/
βββ app.py # Flask entry point
βββ requirements.txt # Python dependencies
βββ Dockerfile
βββ docker-compose.yml
βββ .env.example # Data path configuration template (copy to .env)
βββ routes/
β βββ data.py # Shared JSON load/save helpers
β βββ costs.py # Cost record CRUD API
β βββ vehicles.py # Vehicle CRUD API
β βββ settings.py # Settings API
β βββ reports.py # Report aggregation endpoints
β βββ importexport.py # Import/export endpoints
βββ static/
βββ index.html # Single-page app shell
βββ css/styles.css # All styles (light + dark mode)
βββ js/app.js # All frontend logic
Mac / Linux:
# Run without Docker (requires Python 3.11+)
pip install -r requirements.txt
DATA_DIR=./data flask --app app run --port 5050 --debugWindows (PowerShell):
pip install -r requirements.txt
$env:DATA_DIR="./data"; flask --app app run --port 5050 --debugWindows (Command Prompt):
pip install -r requirements.txt
set DATA_DIR=./data && flask --app app run --port 5050 --debugSee CHANGELOG.md for full version history.
This project was fully coded by AI (Claude by Anthropic) through prompting and direction by Gary Quigley. No manual code was written β every line was generated via conversational prompting.
MIT β do whatever you like with it.