Skip to content

R0gue-one/convin-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Expense Sharing Web App

About

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.

Features

  • 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:
      1. Equal Split
      2. Exact Amount Split
      3. Percentage Split
    • View individual expenses
    • View overall expense of all users
    • Generate and download balance sheets

Technology Stack

  • Node.js
  • Express.js
  • MongoDB
  • JSON Web Tokens (JWT) for authentication

Installation

  1. Clone the repository
git clone [email protected]:R0gue-one/convin-assignment.git
cd convin-assignment/backend
  1. Install dependencies
npm install
  1. Create a .env file in the backend 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

  1. Start the server
npm start

Demo Video

Screencast.from.2024-10-21.21-50-12.mp4



API Endpoints and Usage

Authentication

  • POST /signup - Register a new user
  • POST /login - Login user

Signup:

Body:

{
    "email": "[email protected]",
    "name": "jason",
    "mobile": 96453219656,
    "password": "******"
}

Response: image error handling: image

Login:

Body:

{
    "email": "[email protected]",
    "password": "********"
}

Response: image

Error handling: image image



Authorization

Auth: image

Handling: image

image



User Management

  • POST /addFriend - Add a friend


Body:

{
    "friendEmail": "[email protected]"
}

Response:
image

Expense Management

  • POST /expense - Add a new expense
  • GET /balanceSheet/:email - Get user's balance sheet
  • GET /balanceSheet-overall - Get overall expenses
  • GET /balanceSheet/download/:email - Download balance sheet



Expense

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"
}

Response: image

Error handling:

  1. percent given: 70, 20 image
  2. amount given: 700, 100, Total: 1000 image
  3. Validating all input fields

Balance Sheet

  1. Indivisual Balance Sheet GET Request: http://localhost:3000/balanceSheet/[email protected] image
  2. Overall expense of all users GET Request: http://localhost:3000/balanceSheet-overall image
  3. Download balance sheet GET Request: http://localhost:3000/balanceSheet/download/[email protected] CSV Format of Balance Sheet

Note this is the visualised data from JSON

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published