A bill-splitting application to track shared expenses in a group, developed with Node and React.
We implemented a greedy algorithm to minimise the number of transactions required to settle the debts between all members of a group. The algorithm runs in O(n log n), where n is the number of users – this means that it scales well with the number of users.
A simple example of this algorithm . In this example, Alice owes Bob ₹10 and Bob owes Charlie ₹10 for a total of two transactions. The algorithm will suggest that Alice pays Charlie ₹10 directly, meaning only one transaction is required to settle the debts.
- Create a file in the
server
directory with the name:.env
- Open the file in a text editor (such as Notepad or TextEdit).
- Add the following line to the file, replacing
<uri>
with the URI of your MongoDB database:
MONGODB_URI="<uri>"
- Save the file.
- Open a terminal window.
- Ensure that you're in the root directory:
sharepend
- Navigate to the server directory:
cd server
- Install dependencies:
npm install
- Run the server:
node app
- Open a new terminal window (separate to the previous one).
- Ensure that you're in the root directory:
sharepend
- Navigate to the server directory:
cd client
- Install dependencies:
npm install
- Run the client:
npm start
- Browse to the URL provided in the terminal window.