split-bot

Split Bot — “Who owes whom”

Telegram bot + Mini App for splitting shared expenses (trips, parties, shared flats).

How it works

GitHub Pages (static)                     Your PC: python run.py
https://prostoyus.github.io/split-bot/    ┌────────────────────────────────────┐
  webapp/  ── fetch() ──►                 │ cloudflared quick tunnel (https)   │
                                          │   └► FastAPI  127.0.0.1:8080       │
                                          │ aiogram bot (long polling)         │
                                          │ SQLite  data/split.db              │
                                          └────────────────────────────────────┘

The bot and the API work only while run.py is running. The tunnel URL changes on every start; the bot passes it to the Mini App automatically.

See SPEC.md for the full technical spec (data model, API, auth).

Setup (Windows)

  1. Create a bot in @BotFather (/newbot) and copy the token.
  2. Install dependencies:

    python -m venv .venv
    .\.venv\Scripts\python.exe -m pip install -r requirements.txt
    
  3. Download cloudflared-windows-amd64.exe from cloudflare/cloudflared releases and save it as tools\cloudflared.exe.
  4. Copy .env.example to .env and set BOT_TOKEN.
  5. Run:

    .\.venv\Scripts\python.exe run.py
    
  6. Open your bot in Telegram and press Start.

Tests

.\.venv\Scripts\python.exe -m pytest -q

Security notes