The Expense Sharing Application is designed to manage user-related and expense-related data. It allows users to add expenses and split them among different people based on three different methods: exact amounts, percentages, and equal splits. The application manages user details and validates inputs.
The application consists of an API Gateway for request routing, backend services for business logic, and a PostgreSQL database for data storage. The application uses Spring Boot for backend services and JPA/Hibernate for database interactions.
- Each user should have:
emailnamemobile number
- Users can add expenses.
- Expenses can be split using three methods:
- Equal: Split equally among all participants.
- Exact: Specify the exact amount each participant owes.
- Percentage: Specify the percentage each participant owes (ensure percentages add up to 100%).
- Equal:
- Scenario: You go out from cab with 5 friends. The total bill is 5000. Each friend owes 1000.
- Exact:
- Scenario: You go shopping with 2 friends and pay 5000. Friend 1 owes 1000, Friend 2 owes 1500, and you owe 2500.
- Percentage:
- Scenario: You go to a trip with 2 friends. You owe 20%, Friend 1 owes 30%, and Friend 2 owes 50%. (100%)
- Create user:(POST)
/new-user - Retrieve user details:(GET)
/{id} - Retrieve all users:(GET)
/all-users
- Add expense:(POST)
/new-expense - Retrieve individual user expenses:(GET)
/user-expense/{userId} - Retrieve overall expenses:(GET)
/all - Process expense:(POST)
/process/{expenseId} - Split Equally: (POST)
/split-equally/{expenseId} - Split By Exact Amount: (POST)
/split-exact/{expenseId} - Split By Percentage: (POST)
/split-percentage/{expenseId}
- Validate user inputs.
- Ensure percentages in the percentage split method add up to 100%.
- Java Development Kit (JDK)
- Maven
- PostgreSQL Database
- Spring Boot
-
Set up PostgreSQL Database:
- Create a new database for the application.
- Configure database connection properties in
application.properties.
-
Clone the Repository:
git clone <repository-url> cd <repository-directory>
-
Build the Application:
- Using Maven:
mvn clean install
- Using Maven:
-
Run the Application:
- Using Maven:
mvn spring-boot:run
- Using Maven:
-
Access the Application:
- Open a web browser and navigate to
http://localhost:8080.
- Open a web browser and navigate to
This documentation provides an overview of the Expense Sharing Application architecture, including detailed descriptions of each component and their interactions. The provided setup and installation instructions will help you get started with the project.