Life Cost is designed from the ground up for self-hosting. Because all your financial data stays on your own infrastructure, there are no usage limits, no subscription fees, and no third-party services that have access to your transactions. This guide walks you through deploying Life Cost on a Linux server or VPS using Docker Compose.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/akevalion/life_cost/llms.txt
Use this file to discover all available pages before exploring further.
System Requirements
| Component | Minimum Version | Notes |
|---|---|---|
| Docker | 20.10+ | Required to run the application container. |
| Docker Compose | v2 (docker compose) or standalone v1.29+ | Used to orchestrate the app, MySQL, and phpMyAdmin. |
| MySQL | 8.0 | Can be provided by the included Compose service or an existing MySQL instance. |
| Python | 3.10+ | Only needed if running the app outside Docker (not recommended for production). |
Production Deployment Steps
Pull the Docker image
Pull the latest Life Cost release image from Docker Hub:Confirm the image is available locally:
Set up MySQL
You have two options for the MySQL database:Option A — Use the bundled Docker Compose MySQL service (recommended for most self-hosters):The included
docker-compose.yml defines a mysql service backed by a named Docker volume (mysql_data). Data persists across container restarts automatically. No additional setup is required beyond setting strong passwords (see Step 3).Option B — Connect to an existing MySQL instance:If you already operate a MySQL 8.0 server, simply point DATABASE_URL at it. Create a dedicated database and user first:Configure environment variables
Life Cost requires three environment variables. Set them in your
Example using a Then reference variables in your
docker-compose.yml, a .env file, or your server’s environment:| Variable | Format / Example | Description |
|---|---|---|
DATABASE_URL | mysql://user:password@host/dbname | SQLAlchemy connection string for MySQL. |
GOOGLE_CLIENT_ID | xxxx.apps.googleusercontent.com | OAuth 2.0 Client ID from Google Cloud Console. |
GOOGLE_CLIENT_SECRET | GOCSPX-xxxxxxxx | OAuth 2.0 Client Secret from Google Cloud Console. |
.env file alongside docker-compose.yml:docker-compose.yml with the ${VAR} syntax:Run with Docker Compose
From the directory containing your To run the app as a standalone container without Compose (using an external MySQL instance):
docker-compose.yml, start all services:Verify the app is running
Check that all containers started successfully:You should see You should be redirected to Google’s OAuth consent screen. After signing in, the Life Cost dashboard will load and you can begin creating wallets and logging transactions.To inspect application logs:
life_app, mysql_container, and phpmyadmin all in the Up state. Then open a browser and navigate to:Dockerfile Reference
The official Docker image is built from the followingDockerfile in the repository root:
python:3.10-alpine and installs the MariaDB/MySQL client libraries needed by the mysqlclient Python package. The application process listens on port 3000 inside the container.
Port Mapping
The container exposes port 3000 internally. Thedocker-compose.yml maps this to port 5000 on the host:
Database Initialisation
Life Cost uses Flask-SQLAlchemy’sdb.create_all() call inside the application factory (app/main.py). On every startup, SQLAlchemy inspects the connected MySQL database and creates any missing tables:
user, wallet, category, money_transfer, tag, and user_wallet are created automatically the first time the app connects to a fresh database.
Security Considerations
For a hardened production setup:- Place the app behind a TLS-terminating reverse proxy (Nginx, Caddy, Traefik).
- Register an
https://redirect URI in your Google Cloud project credentials. - Remove or guard the
OAUTHLIB_INSECURE_TRANSPORT=1setting in production builds. - Use strong, randomly generated passwords for
MYSQL_ROOT_PASSWORD,MYSQL_PASSWORD, andapp.secret_key. - Keep your
GOOGLE_CLIENT_SECRETand database credentials out of version control (use a.envfile or a secrets manager).
Further Configuration
Environment Variables
Full reference for all supported environment variables and their default values.
Database Configuration
Details on the MySQL schema, connection string format, and advanced database options.