Skip to content
All projects
Case studyCS/20
StatusPersonal project
TypeSystems
Year2024

DivvyMate

Expense-sharing back end with equal, exact and percentage splits

User, expense and balance-sheet services that split expenses three ways, publish expense events to Kafka, and generate downloadable balance sheets. Runs behind nginx on PostgreSQL and Redis.

  • 3 split modes
  • 3 services
  • Kafka producer/consumer
  • Balance-sheet export

§1

The problem

Groups sharing daily expenses need correct per-person balances whether a bill is split equally, by exact amounts or by percentage.

§2

My role

Built the services, split validation, Kafka producer/consumer and the Docker/nginx setup.

§3

Architecture

Fig. 1 · DivvyMate architecture
CLIENTNGINXUSER SERVICEEXPENSE SERVICE3 split modesKAFKAexpense eventsBALANCE SHEETexportPOSTGRESQL
clientserviceeventdata

§4

Key decisions

  1. D/01

    Validate splits at the edge

    Exact amounts must sum to the total and percentages to 100, rejected before anything is written.

  2. D/02

    Balance sheet as a consumer

    The balance-sheet service consumes expense events, so writes stay fast and reporting is decoupled.

§5

Challenges

  • Rounding: percentage splits that don't divide evenly must still sum to the exact total.

§6

Stack

  • Node.js
  • Express
  • PostgreSQL
  • Kafka
  • Redis
  • Nginx
  • Docker

Next case study

NexRule

A rule engine that turns rule strings into stored ASTs