This backend service is designed for a Daily Expenses Sharing Application (Assignment for Convin AI).
The app allows users to add expenses and split them using three different methods: exact amounts, percentages, and equal splits. It also provides features to manage users, validate inputs, and generate downloadable balance sheets.
Front-end is only partially working.
-
User Management
- User registration and authentication
- User profile management with email, name, and mobile number
- Add Friends to share expenses between them
-
Expense Management
- Add new expenses
- Split expenses using three methods:
- Equal Split
- Exact Amount Split
- Percentage Split
- View individual expenses
- View overall expense of all users
- Generate and download balance sheets
- Node.js
- Express.js
- MongoDB
- JSON Web Tokens (JWT) for authentication
- Clone the repository
git clone [email protected]:R0gue-one/convin-assignment.git
cd convin-assignment/backend
- Install dependencies
npm install
- Create a
.env
file in thebackend
folder with the following variables:
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
PORT=3000
or you can download the file frome here
- Start the server
npm start
Screencast.from.2024-10-21.21-50-12.mp4
POST /signup
- Register a new userPOST /login
- Login user
Body:
{
"email": "[email protected]",
"name": "jason",
"mobile": 96453219656,
"password": "******"
}
Body:
{
"email": "[email protected]",
"password": "********"
}
-
POST /addFriend
- Add a friend
Body:
{
"friendEmail": "[email protected]"
}
POST /expense
- Add a new expenseGET /balanceSheet/:email
- Get user's balance sheetGET /balanceSheet-overall
- Get overall expensesGET /balanceSheet/download/:email
- Download balance sheet
Body:
{
"expenseID": "exp1",
"payer": "[email protected]",
"amount": 1000,
"participants": [
{
"email": "[email protected]",
"name": "Jatin",
"owed": 70,
"paid": true
},
{
"email": "[email protected]",
"name": "Vansh",
"owed": 30,
"paid": false
}
],
"splitType": "percentage",
"splitDetails": "McD"
}
Error handling:
- Indivisual Balance Sheet
GET Request:
http://localhost:3000/balanceSheet/[email protected]
- Overall expense of all users
GET Request:
http://localhost:3000/balanceSheet-overall
- Download balance sheet
GET Request:
http://localhost:3000/balanceSheet/download/[email protected]