Skip to content

Deploying IHateMoney

Introduction

IHateMoney is a simple, elegant web application for managing shared expenses. Whether you’re splitting bills with roommates, tracking expenses on a group trip, or managing shared costs with friends, IHateMoney makes it easy to keep track of who paid what, when, and for whom - then calculates the optimal way to settle up.

Built with Python and Flask, IHateMoney provides a straightforward interface that focuses on getting the job done without unnecessary complexity. The application supports multiple projects (expense groups), automatic balance calculations, and even generates QR codes for easy mobile access.

Key highlights of IHateMoney:

  • Simple Interface: Clean, intuitive design for adding and managing expenses
  • Smart Settlements: Automatically calculates the minimum number of transactions to settle all debts
  • Multiple Projects: Create separate projects for different groups or trips
  • Weight System: Support for uneven splitting based on participation
  • Multi-Currency: Track expenses in different currencies
  • Email Notifications: Invite participants via email
  • Statistics: View spending breakdowns by person and category
  • Export Options: Export data in JSON and CSV formats
  • API Access: RESTful API for integration with other tools
  • Self-Hosted Privacy: Your financial data stays on your infrastructure
  • Mobile Friendly: Responsive design works on phones and tablets

This guide walks through deploying IHateMoney on Klutch.sh using Docker, setting up a private expense tracking system for you and your groups.

Why Deploy IHateMoney on Klutch.sh

Deploying IHateMoney on Klutch.sh provides several advantages for expense management:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds IHateMoney without manual server configuration. Push to GitHub and your expense tracker deploys automatically.

Persistent Storage: Attach persistent volumes for your database. Your expense history survives container restarts and redeployments.

HTTPS by Default: Klutch.sh provides automatic SSL certificates, ensuring secure access to your financial data.

GitHub Integration: Connect your configuration repository directly from GitHub. Updates trigger automatic redeployments.

Privacy Focused: Keep your expense data on infrastructure you control, not on third-party services.

Custom Domains: Assign a custom domain for easy sharing with your expense groups.

Always Available: Access your expense data from anywhere, anytime, without managing your own server hardware.

Prerequisites

Before deploying IHateMoney on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your IHateMoney configuration
  • Basic familiarity with Docker and containerization concepts
  • (Optional) An SMTP server for email notifications

Understanding IHateMoney Architecture

IHateMoney is built on a straightforward stack:

Flask Application: The Python-based web application handles all business logic and serves the web interface.

SQLAlchemy ORM: Database abstraction supporting SQLite (default) or PostgreSQL/MySQL for production.

Jinja2 Templates: Server-side rendering for the responsive web interface.

RESTful API: Programmatic access for mobile apps or integrations.

Preparing Your Repository

To deploy IHateMoney on Klutch.sh, create a GitHub repository containing your Dockerfile.

Repository Structure

ihatemoney-deploy/
├── Dockerfile
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM ihatemoney/ihatemoney:latest
# Set environment variables
ENV SECRET_KEY=${SECRET_KEY}
ENV SQLALCHEMY_DATABASE_URI=${SQLALCHEMY_DATABASE_URI:-sqlite:////database/ihatemoney.db}
# Admin configuration
ENV ACTIVATE_ADMIN_DASHBOARD=${ACTIVATE_ADMIN_DASHBOARD:-True}
ENV ADMIN_PASSWORD=${ADMIN_PASSWORD}
# Project creation settings
ENV ALLOW_PUBLIC_PROJECT_CREATION=${ALLOW_PUBLIC_PROJECT_CREATION:-True}
ENV ACTIVATE_DEMO_PROJECT=${ACTIVATE_DEMO_PROJECT:-False}
# Email configuration (optional)
ENV MAIL_SERVER=${MAIL_SERVER:-}
ENV MAIL_PORT=${MAIL_PORT:-587}
ENV MAIL_USERNAME=${MAIL_USERNAME:-}
ENV MAIL_PASSWORD=${MAIL_PASSWORD:-}
ENV MAIL_USE_TLS=${MAIL_USE_TLS:-True}
ENV MAIL_DEFAULT_SENDER=${MAIL_DEFAULT_SENDER:-}
# Create database directory
RUN mkdir -p /database
# Expose port 8000
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8000/ || exit 1
# Volume for database
VOLUME ["/database"]

Environment Variables Reference

IHateMoney uses environment variables for configuration:

VariableRequiredDefaultDescription
SECRET_KEYYes-Flask secret key for session signing
SQLALCHEMY_DATABASE_URINosqlite:///…Database connection string
ACTIVATE_ADMIN_DASHBOARDNoTrueEnable admin dashboard
ADMIN_PASSWORDNo-Hashed admin password
ALLOW_PUBLIC_PROJECT_CREATIONNoTrueAllow anyone to create projects
ACTIVATE_DEMO_PROJECTNoFalseEnable demo project for testing
MAIL_SERVERNo-SMTP server hostname
MAIL_PORTNo587SMTP server port
MAIL_USERNAMENo-SMTP authentication username
MAIL_PASSWORDNo-SMTP authentication password
MAIL_USE_TLSNoTrueUse TLS for SMTP
MAIL_DEFAULT_SENDERNo-Default from address for emails

Deploying IHateMoney on Klutch.sh

Once your repository is prepared, follow these steps to deploy IHateMoney:

    Generate Your Secret Key

    Generate a secure secret key for Flask:

    Terminal window
    openssl rand -hex 32

    Save this key for the environment variables configuration.

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub:

    Terminal window
    git init
    git add Dockerfile .dockerignore
    git commit -m "Initial IHateMoney deployment configuration"
    git remote add origin https://github.com/yourusername/ihatemoney-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “expenses” or “ihatemoney”.

    Create a New App

    Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your IHateMoney Dockerfile.

    Configure HTTP Traffic

    IHateMoney serves its web interface over HTTP. In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 8000

    Set Environment Variables

    In the environment variables section, add the following:

    VariableValue
    SECRET_KEYYour generated secret key
    ACTIVATE_ADMIN_DASHBOARDTrue
    ALLOW_PUBLIC_PROJECT_CREATIONTrue (or False for restricted use)

    For email notifications, also add:

    VariableValue
    MAIL_SERVERYour SMTP server
    MAIL_PORT587
    MAIL_USERNAMEYour SMTP username
    MAIL_PASSWORDYour SMTP password
    MAIL_DEFAULT_SENDERnoreply@yourdomain.com

    Attach Persistent Volumes

    Persistent storage is essential for your expense data. Add the following volume:

    Mount PathRecommended SizePurpose
    /database1 GBSQLite database storage

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Detect your Dockerfile automatically
    • Build the container image
    • Attach the persistent volumes
    • Start the IHateMoney container
    • Provision an HTTPS certificate

    Access IHateMoney

    Once deployment completes, access your IHateMoney instance at https://your-app-name.klutch.sh. You can immediately start creating expense projects.

Using IHateMoney

Creating a Project

  1. Navigate to your IHateMoney instance
  2. Click “Start a new project” or access the demo project
  3. Enter a project name and identifier
  4. Set a private code (password) for the project
  5. Add email if you want to receive invitations

Adding Members

  1. Open your project
  2. Click “Add a member”
  3. Enter each participant’s name
  4. Optionally set a default weight for uneven splitting

Recording Expenses

  1. Click “Add a new bill”
  2. Enter:
    • Date: When the expense occurred
    • What: Description of the expense
    • Payer: Who paid
    • Amount: How much was spent
    • For whom: Who benefited (check participants)
  3. Click “Add” to save

Viewing Balances

The main project page shows:

  • Current balances for each member
  • Suggested settlements to resolve debts
  • List of all recorded expenses

Settling Up

IHateMoney calculates the optimal way to settle:

  1. View the “Settlement” section
  2. Follow the suggested payments
  3. Mark debts as settled when paid

Advanced Features

Using Weights

For uneven splitting (e.g., one person ate more):

  1. When adding a bill, expand “For whom”
  2. Adjust weights for each participant
  3. Expenses are split proportionally

Multi-Currency Projects

Track expenses in different currencies:

  1. When creating a project, select a default currency
  2. Add bills with amounts in any currency
  3. IHateMoney converts for balance calculations

Exporting Data

Export your project data:

  1. Access the project
  2. Click “Export” in the menu
  3. Choose JSON or CSV format
  4. Download for backup or analysis

Admin Dashboard

Access administrative features:

  1. Navigate to /admin on your instance
  2. Enter admin password
  3. Manage projects and users

Email Configuration

Enabling Invitations

With SMTP configured, members can:

  1. Receive project invitation emails
  2. Get notifications of new expenses
  3. Receive settlement reminders

SMTP Setup Examples

For Gmail:

MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USE_TLS=True

For SendGrid:

MAIL_SERVER=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey

Troubleshooting Common Issues

Cannot Create Projects

Symptoms: “Project creation is disabled” error.

Solutions:

  • Set ALLOW_PUBLIC_PROJECT_CREATION=True
  • Or create projects via admin dashboard

Emails Not Sending

Symptoms: Invitations and notifications don’t arrive.

Solutions:

  • Verify SMTP credentials are correct
  • Check MAIL_PORT and MAIL_USE_TLS settings
  • Review container logs for SMTP errors
  • Test with a mail service that provides delivery logs

Database Errors

Symptoms: Application errors related to database.

Solutions:

  • Ensure volume is properly mounted
  • Check write permissions on database directory
  • Verify database file isn’t corrupted

Session Errors

Symptoms: Being logged out frequently.

Solutions:

  • Ensure SECRET_KEY remains constant across deployments
  • Don’t change SECRET_KEY after deployment

Additional Resources

Conclusion

Deploying IHateMoney on Klutch.sh gives you a private, self-hosted expense sharing solution with automatic builds, persistent storage, and secure HTTPS access. You maintain full control over your financial data while enjoying a clean, functional interface for tracking shared expenses.

Whether you’re managing household expenses with roommates, tracking costs on a group vacation, or splitting bills with friends, IHateMoney on Klutch.sh provides a simple, reliable way to keep everyone’s finances in order without the awkwardness of money conversations.