Skip to content

Silvernitro/splitpay-backend

Repository files navigation

SplitPay

Built with:

nest postgresql

Just the back-end of it here. SplitPay let's clients create bills that need to be split amongst friends. You create a bill, add people to it, have each person indicate what they've paid for and what they've consumed, and let SplitPay generate an optimized set of transactions.

A note on optimizing transactions

Unfortunately, the problem of optimzing transactions is NP-Complete. I'm not going to go into that here, but you can show a reduction from either the Partition problem or Subset-Sum problem to prove it.

As such, I used a greedy approximation algorithm instead. Not sure what the relative performance guarantee is, or if it's even a ρ-approximation. Alternatively, one can model this problem as a max-flow problem and solve it with Dinic's or Edmonds-Karp but I just want to keep things simple.

Running locally

I'll write this soon enough once I decide how I want to deploy and dockerize the app.

Postman Tests

Kinda lazy to write unit and integration tests, so I went with e2e tests for the highest ROI. I have a Postman test suite that I use to test locally and also on the CI pipeline to test each build on Master. You can check out a live version of the test suite here:

Run in Postman

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published