Skip to content

Repository files navigation

CoinSink

Self-hosted expense tracking for your home server.
Add expenses from your phone, review them in a clean read-only dashboard.

FastAPI SQLite Docker Raspberry Pi License MIT

CoinSink dashboard

Index

What It Is

CoinSink has two jobs:

  • Show a clean spending dashboard in the browser.
  • Accept new expenses through a simple HTTP API.

The website is intentionally read-only. It is for viewing totals, categories, charts, and time ranges. New expenses are submitted through the API. The included Apple Shortcut is one convenient way to do that from an iPhone, but any program can use the same API.

Screenshots

Mobile Dashboard Apple Shortcut
CoinSink mobile dashboard CoinSink Apple Shortcut

Features

  • Responsive dashboard for desktop and mobile
  • Category totals and stacked spending chart
  • Time ranges: Today, 7 Days, Month, 3M, 6M, 1Y, and Custom
  • Smart chart grouping for longer ranges
  • SQLite persistence
  • FastAPI-generated API docs at /docs
  • Docker Compose setup for Raspberry Pi and home servers
  • Optional Apple Shortcut for quick expense entry

Current Status

  • The website is read-only.
  • Expenses are added through the API.
  • Editing and deleting expenses is not implemented yet.
  • There is no authentication yet.
  • CoinSink is intended for private networks unless you add authentication, HTTPS, or a secured reverse proxy.

Default categories created on startup:

  • food
  • mobility
  • leisure
  • household
  • other

Unknown categories are stored as other.

Quick Start

With Docker:

docker compose up -d --build

Open:

http://localhost:8000

API docs:

http://localhost:8000/docs

Run Without Docker

Create a virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Start CoinSink:

mkdir -p data
DATABASE_URL=sqlite:///./data/coinsink.db uvicorn app.app:app --host 0.0.0.0 --port 8000

Open:

http://localhost:8000

From another device in the same network, use the computer's local IP address:

http://YOUR_DEVICE_IP:8000

Run With Docker

Build and start:

docker compose up -d --build

Open:

http://localhost:8000

Stop:

docker compose down

Autostart With Docker

The Compose file already contains:

restart: unless-stopped

Enable Docker on boot:

sudo systemctl enable docker
sudo systemctl start docker

Start CoinSink once:

docker compose up -d --build

After a reboot, Docker should bring CoinSink back automatically.

Check the container:

docker compose ps

Raspberry Pi Deployment

Install Docker:

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER

Log out and back in, or reboot the Pi.

Copy the project to the Pi:

rsync -av --exclude '.venv' --exclude '.git' --exclude '__pycache__' \
  /path/to/CoinSink/ \
  pi@RASPBERRY_PI_IP:~/coinsink/

Start CoinSink:

ssh pi@RASPBERRY_PI_IP
cd ~/coinsink
docker compose up -d --build

Open:

http://RASPBERRY_PI_IP:8000

Find the Pi's IP address:

hostname -I

Apple Shortcut

This repository includes:

CoinSink.shortcut

Import it into Apple Shortcuts on your iPhone, open the shortcut, and edit the URL action at the very top.

Set it to your CoinSink expenses endpoint, for example:

http://raspberrypi:8000/expenses

or:

http://RASPBERRY_PI_IP:8000/expenses

After saving the shortcut, you can run it normally from Apple Shortcuts.

The shortcut is optional. It is just one convenient workflow for Apple users. Any other app, script, or automation can submit expenses through the same API.

API Documentation

CoinSink uses FastAPI, so the API is documented automatically.

Open:

http://localhost:8000/docs

On a Raspberry Pi:

http://RASPBERRY_PI_IP:8000/docs

Use this page to inspect available endpoints and test requests directly in the browser.

Database

With Docker, SQLite is stored inside the container at:

/data/coinsink.db

On the host, this is persisted in:

data/coinsink.db

Without Docker, the recommended command above also stores the database in:

data/coinsink.db

If you are migrating from an older local cashflow.db, copy it to:

data/coinsink.db

Useful Commands

Show logs:

docker compose logs -f

Rebuild after code changes:

docker compose up -d --build

Stop the app:

docker compose down

Delete the local database:

docker compose down
rm data/coinsink.db

Tech Stack

  • FastAPI
  • SQLAlchemy
  • SQLite
  • Vanilla JavaScript
  • Chart.js
  • Docker Compose

License

MIT License. See LICENSE.

About

Self-hosted expense tracking for your home server, with a read-only spending dashboard and simple API-based expense entry.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages