biswodip.← All projects
05 / Expenses and settlementsFull-Stack Software Engineer (Sole Developer)

Tripmate

Group expense management and settlement application with greedy debt resolution.

01 / The Problem & Analysis

Group travelers struggle with complex multi-payer expenses, uneven currency splits, and awkward manual debt reconciliation.

02 / Engineering & BA Role

Full-Stack Software Engineer (Sole Developer)

03 / Outcome

Minimizes total required cash transactions across participants using a greedy debt-simplification algorithm.

Overview

Tripmate helps groups record shared expenses, calculate who owes whom and simplify the final settlement between members using a greedy graph resolution algorithm.

What I built

Implemented a greedy balance resolution graph algorithm in TypeScript, multi-party expense splitting logic, UPI deep links, and PDF summary exports.

Product Interface

tripmate.boats
Live
Tripmate real application interface from the deployed site

Engineering Decisions

Connect expenses to members

What
Groups can record shared expenses.
Why
A useful balance needs to account for who paid and who shares the cost.
How
The application uses member and expense information to calculate balances.

Explain the settlement

What
Members can see who owes whom.
Why
A group needs actionable settlement amounts after recording expenses.
How
Balance calculations feed the settlement workflow.

Support the next action

What
Settlements include UPI links and PDF exports.
Why
Members need to make payments and keep a readable expense record.
How
The application creates payment links and generates a PDF from the expense information.

Data Architecture & Schema

The application stores groups, members and shared expense information. Expense and member relationships support the balance and settlement calculations.

trip_id
UUID · Unique trip join code partition
creator_id
UUID · Trip organizer user identifier
expense_id
UUID · Itemized transaction record
amount
NUMERIC · Total expenditure value in INR
payer_id
UUID · Paying member identifier
split_type
TEXT · equal / custom / percentage / quantity
settled
BOOLEAN · Pairwise balance settlement flag
category
TEXT · Lodging / Dining / Transit / Activity

API & System Workflow

The interface connects group and expense actions to stored application data. Settlement amounts are used to create UPI payment links; PDF generation makes the expense information exportable.

  1. Expense
  2. Participants
  3. Balance Calculation
  4. Settlement Algorithm
  5. UPI / PDF Export

End-to-end system lifecycle

Representative Implementation

Settlement engine · Minimized-debt greedy balance resolution. Excerpt from the repository source.

src/lib/algorithms/settle.tsTypeScript
// Minimized-debt greedy balance resolution algorithm
export function simplifyDebts(balances: Map<string, number>): Settlement[] {
  const debtors = [...balances.entries()].filter(([_, b]) => b < -0.01).sort((a,b) => a[1] - b[1]);
  const creditors = [...balances.entries()].filter(([_, b]) => b > 0.01).sort((a,b) => b[1] - a[1]);
  const settlements: Settlement[] = [];
  // Greedy balance resolution cancels circular obligations
  return settleGreedy(debtors, creditors, settlements);
}
Settlement engine · Minimized-debt greedy balance resolution
Read file on GitHub

Interface & Features

The group expense interface brings expense entry, member balances and settlement actions together.

  • Shared expense splitting
  • Balances and settlements
  • UPI payment links
  • PDF exports

Technology Stack

  • Next.js
  • React
  • TypeScript

Next.js · React · TypeScript · PostgreSQL/data-backed application · Expense calculations · Settlement logic · API integration · PDF generation

Source Repositories

Open GitHub repository

Live Deployment

Run Tripmate