Skip to case study

TakoSplit / Backend engineering

Building TakoSplit

Shared expenses. Exact settlements.

TakoSplit brings shared expenses and trip settlements into Telegram. I built it around a simple idea: the group chat is already there, so splitting the bills should fit into it.

  • Python
  • FastAPI
  • PostgreSQL
  • Google Cloud Run
TAKOSPLIT / TELEGRAMLive product
TakoSplit octopus holding a receipt
TakoSplit

Chat-native expense ledger

Illustrative Telegram conversation

/add 25 Supper
Supper · S$25.00Split equally with 4 peopleEach person pays · S$6.25Select participants → review → confirm
THE DECISIONS BEHIND THE BUILDEXPLORE THE PROJECT ↓
Project
Telegram bot + backend
Core challenge
Accurate shared expenses
Deployment
Cloud Run + Neon
Payment handoff
Optional private PayNow QR

01 / Why Telegram

The trip already has a group chat.

The starting point was simple: a lot of people already use Telegram, and the trip conversation is often there too. I didn't want to ask everyone to download another app just to keep track of shared bills.

Why I chose Telegram

I chose Telegram so the group could plan the trip and track its costs in one place. Using a familiar chat kept the setup simple: no extra app to install, and no separate place to check the bills.

Key features

All on Telegram

Record expenses and check balances in Telegram, without another app to download.

Group or private trips

Use an existing group, or start a private trip with the bot and invite others.

Equal or custom splits

Share a bill evenly or enter a different amount for each person.

Running trip summaries

Keep track of shared expenses and each person's share as the trip goes on.

Simplified settlements

Turn the trip's bills into a clear plan of who pays whom.

Private PayNow QR

Get an optional exact-amount QR privately, then complete payment in your banking app.

02 / The architecture

A light interface, with the backend doing the work.

I chose Python and FastAPI for the backend, with PostgreSQL for saved trip records. Telegram handles the conversation, while the backend takes care of calculations, confirmations, and the shared expense history.

HOW IT FITS TOGETHERA HIGH-LEVEL VIEW
  1. Telegram

    The conversation

    Commands & buttons
  2. FastAPI

    The connection

    Receives updates
  3. Expense engine

    The decisions

    Splits & settlements
  4. PostgreSQL

    The shared record

    Saved trip history
↳ A saved expense becomes a clear reply in the chat.
Cloud Run

The containerized backend runs as a hosted service.

Neon

Hosted PostgreSQL keeps trip state available across service restarts.

The conversation stays in Telegram; the backend keeps the financial records consistent.

03 / How it connects

One trip, connected records.

A trip brings together the people, the bills, and each person's share. Keeping the original expenses separate from the final settlement makes the result easier to understand and revisit.

THE SHARED CONTEXT

A shared trip

One connected picture

participation

People

Who is part of the trip

the original bills

Expenses

Who paid, and who shared it

calculated from bills

Balances

What each person owes or gets back

the next action

Settlement

A plan for who pays whom

People share expenses, expenses determine balances, and those balances inform the settlement plan.

04 / Getting the money right

Even the extra cent needs to go somewhere.

Splitting a bill gets less straightforward when the amount does not divide evenly. I used integer cents so the shares always add up, including when someone enters custom amounts or edits a bill later.

The rounding problem

S$10.00, shared three ways

The remaining cent goes to a predictable share, keeping the total intact.

Alex · payer
S$3.34
James
S$3.33
Sam
S$3.33
Total allocated
S$10.00
Illustrative example. The shares still match the original bill exactly.

Custom splits

Everyone's entered amount must reconcile with the bill.

Expense edits

Participants and their proportions stay intact when an amount changes.

05 / Reliable confirmations

The second tap matters, too.

A slow response can make someone press confirm again. Confirmation handling is idempotent, so repeating that action does not create another expense.

First confirmation
Repeated confirmation
One saved expense
Saved-state checks and database safeguards keep repeated confirmations tied to one expense.

Review before saving

There is a chance to check the amount and participants before confirming.

Keep the work saved

In-progress selections are saved so they can survive a service restart.

06 / Simplifying settlement

From a pile of bills to a payment plan.

At the end of a trip, each person's spending and shares are brought together into a net balance. The settlement plan simplifies who pays whom, while the original obligations remain visible to explain the result.

Before · 4 obligations

  • James owes Alex S$8.33
  • Sam owes Alex S$8.33
  • Alex owes James S$3.00
  • Alex owes Sam S$10.00

After · 2 transfers

PAYSJames
TO AlexS$3.66
TO SamS$1.67
Illustrative example with fictional participants. Four obligations become two transfers, with the same net result for everyone.

The completed plan is saved so participants can come back to it later. The bot proposes the transfers; people make the payments themselves.

07 / Privacy by design

Shared expenses, private payment details.

Trips can start in a Telegram group or in a private chat with the bot, with invite links for others to join. Whichever way the trip runs, PayNow setup and QR delivery stay in private chats, and stored mobile numbers are encrypted.

GROUP WORKFLOW

In a group chat

  • Start a shared trip
  • Record group expenses
  • View the running summary
  • See the settlement plan

PRIVATE WORKFLOW

In a private chat

  • Start a private trip
  • Invite participants by link
  • Add expenses and view settlement
  • Set up PayNow and request QR
Illustrative sample PayNow QR code, not a payment request
Sample QR

An optional payment handoff

The person who needs to pay can receive an exact-amount QR privately, check the recipient, and complete the transfer in their banking app.

Private delivery requires the participant to have opened a chat with the bot first.

08 / Checks & operations

Checking the details that are easy to miss.

The tests focus on money calculations, payment-detail validation, and QR generation. Running the bot also means looking after the service and the lifecycle of older trip records.

01

Amounts add up

Coverage includes rounding, custom splits, and edits that preserve the total.

02

Details stay protected

Checks cover number validation, encrypted storage, and masked display.

03

QRs carry the right amount

Tests check the generated image and the payment amount in its payload.

Service operations

A health check and secret redaction support running the backend.

Trip retention

Scheduled cleanup removes older completed trips so those records do not accumulate indefinitely.

TakoSplit / Explore the product

See the workflow
in the group chat.