Skip to content

quiggles/autoledger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AutoLedger πŸš—

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.

AutoLedger Dashboard Docker License


Features

  • 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

Quick Start

Prerequisites

Mac / Linux

# 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 -d

Then open http://localhost:5050 in your browser.

Data is stored in ./data/ (created automatically on first run).

Windows

# 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 -d

Then 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.


Synology NAS Installation (DS923+ / DSM 7.x)

Via Portainer (recommended)

  1. Open Portainer β†’ Stacks β†’ Add Stack
  2. Paste the contents of docker-compose.yml
  3. Set the environment variable DATA_PATH to /volume1/docker/autoledger/data
  4. Deploy the stack

Via SSH

# 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 --build

App will be at http://192.168.0.100:5050


Configuration

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/data

All other settings (currency, categories) are managed through the app's Settings page.


Updating

# Pull latest code
git pull

# Rebuild and restart
docker compose up --build

Your data in ./data/ is never touched by an update.


LubeLogger Migration

If you're coming from LubeLogger:

  1. In LubeLogger, export your fuel log as CSV (each vehicle separately)
  2. In AutoLedger, create your vehicle on the Vehicles page
  3. Go to Import / Export β†’ Import LubeLogger CSV
  4. Select your exported CSV file

AutoLedger reads LubeLogger's column format directly: Date, Odometer, FuelConsumed, Cost, FuelEconomy, IsFillToFull, Notes


Data Storage

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.


Port

The app runs on port 5050 by default. To change it, edit docker-compose.yml:

ports:
  - "YOUR_PORT:5000"

Tech Stack

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

Project Structure

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

Development

Mac / Linux:

# Run without Docker (requires Python 3.11+)
pip install -r requirements.txt
DATA_DIR=./data flask --app app run --port 5050 --debug

Windows (PowerShell):

pip install -r requirements.txt
$env:DATA_DIR="./data"; flask --app app run --port 5050 --debug

Windows (Command Prompt):

pip install -r requirements.txt
set DATA_DIR=./data && flask --app app run --port 5050 --debug

Changelog

See CHANGELOG.md for full version history.


Attribution

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.


License

MIT β€” do whatever you like with it.

About

A self-hosted car running cost tracker. All AI coded

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors