Debt-It V2
Published on May 30, 2022
Track debts/bills between your friends, travel buddies, family and roommates easily.
About the app
- Become a beta tester: debt-it.xyz
About
This app is a solution for settling debts in group expenses. Every user in this app can build a team by inviting other users to the group. Here, they can track expenses, see the balance, and also check who’s the debitor and who’s the creditor.
With this app, you wouldn’t have to calculate the expense balance for your group, all you need to do is check-in the expenses and you can see the creditors, the debitors and amount needed to be paid right away.
The algorithm integrated in the app will minimise the amount of transaction needed to clear out debts between group members.
Techstacks Changes
- One of the big changes is the whole frontend and backend are written in TypeScript
- Using AWS CodePipeline and Elastic Beanstalk for automated server deployments
- Backend architecture revamp to works with the calculations efficiently
- Whole UI upgrade with unnecessary features removed and new useful features
Code Snippets
Backend: src/utils/calculations.ts
export const getTotalSpent = ({ allExpenses }: GetTotalSpent): number => {
return allExpenses?.reduce((acc: number, expense: ExpenseDocument) => {
if (expense.payback) {
return acc;
} else {
return acc + expense.amount;
}
}, 0);
};
This is a backend function that is used to calculate the current total spending of a user.