Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/syamreddy99/daily-expenses-sharing-application

A Java Spring Boot application for managing and sharing daily expenses among users, featuring user management, expense splitting, and downloadable balance sheets.
https://github.com/syamreddy99/daily-expenses-sharing-application

dailyexpense-api expensesmanagement hibernate java maven mysql spring springboot usermanagementsystem

Last synced: 6 days ago
JSON representation

A Java Spring Boot application for managing and sharing daily expenses among users, featuring user management, expense splitting, and downloadable balance sheets.

Awesome Lists containing this project

README

        

# ๐Ÿฆ Daily Expenses Sharing Application

## Table of Contents
- [๐Ÿ“˜ Introduction](#-introduction)
- [โœจ Features](#-features)
- [๐Ÿ’ป Technologies Used](#-technologies-used)
- [๐Ÿš€ Getting Started](#-getting-started)
- [๐Ÿ“‹ Prerequisites](#-prerequisites)
- [๐Ÿ”ง Installation](#-installation)
- [โš™๏ธ Configuration](#%EF%B8%8Fconfiguration)
- [โ–ถ๏ธ Running the Application](#%EF%B8%8Frunning-the-application)
- [๐Ÿ”— API Endpoints](#api-endpoints)
- [๐Ÿ‘ฅ User Endpoints](#user-endpoints)
- [๐Ÿ’ฐ Expenses Endpoints](#expenses-endpoints)
- [๐Ÿ—„๏ธ Database Structure](#%EF%B8%8Fdatabase-structure)

# ๐Ÿ“˜ Introduction
The Daily Expenses Sharing Application allows users to add expenses and split them among participants using three different methods: equal splits, exact amounts, and percentages. The application also provides features for user management and generates downloadable balance sheets.

## โœจ Features
### User Management:
- ๐Ÿ‘คCreate and retrieve user details.
### Expense Management:
- ๐Ÿ’ธ Add expenses and split them in multiple ways.
- โœ… Validate inputs to ensure data integrity.
- ๐Ÿ“Š Generate balance sheets for individual users and overall expenses.

## ๐Ÿ’ป Technologies Used
- โ˜• **Java 17** ![Java](https://img.shields.io/badge/-Java-007396?style=flat&logo=java&logoColor=white)
- ๐Ÿ–ฅ๏ธ **Spring Boot** ![SpringBoot](https://img.shields.io/badge/-SpringBoot-6DB33F?style=flat&logo=springboot&logoColor=white)
- ๐Ÿ—ƒ๏ธ **Hibernate** ![Hibernate](https://img.shields.io/badge/-Hibernate-59616B?style=flat&logo=hibernate&logoColor=white)
- ๐Ÿ›ข๏ธ **MySQL** ![MySQL](https://img.shields.io/badge/-MySQL-4479A1?style=flat&logo=mysql&logoColor=white)
- ๐Ÿ“ฆ **Apache Maven** ![Maven](https://img.shields.io/badge/-Maven-C71A36?style=flat&logo=apache-maven&logoColor=white)
- ๐Ÿ“ **Lombok** ![Lombok](https://img.shields.io/badge/-Lombok-2C2D72?style=flat&logo=lombok&logoColor=white)

## ๐Ÿš€ Getting Started

### ๐Ÿ“‹ Prerequisites
Before you begin, ensure you have the following installed:
- โ˜• **Java 17** or above ![Java](https://img.shields.io/badge/-Java-007396?style=flat&logo=java&logoColor=white)
- ๐Ÿ› ๏ธ **Apache Maven** ![Maven](https://img.shields.io/badge/-Maven-C71A36?style=flat&logo=apache-maven&logoColor=white)
- ๐Ÿ›ข๏ธ **MySQL Workbench** ![MySQL](https://img.shields.io/badge/-MySQL-4479A1?style=flat&logo=mysql&logoColor=white)
- ๐Ÿ–ฅ๏ธ **Eclipse** or **Spring Tool Suite** ![Eclipse](https://img.shields.io/badge/-Eclipse-2C2D72?style=flat&logo=eclipse&logoColor=white)
- ๐Ÿ“จ **Postman** ![Postman](https://img.shields.io/badge/-Postman-FF6C37?style=flat&logo=postman&logoColor=white)

### ๐Ÿ”ง Installation
1. **Clone the Repository**:
```bash
git clone https://github.com/syamreddy99/Daily-Expenses-Sharing-Application
cd Daily-Expense-Sharing-Application

# โš™๏ธconfiguration
### Database Configuration:

Create a database named "dailyexpenses".

### Update"application.properties":

- spring.application.name= `Daily-Expenses-Sharing-Application`

- server.port= `9982`
- This property sets the port number on which the Spring Boot application will run.By default, Spring Boot applications run on port 8080, but this can be
changed as needed.

- spring.datasource.url= `jdbc:mysql://localhost:3306/DailyExpenses`

- This property defines the JDBC URL for connecting to the MySQL database. It specifies the database type, host, port, and the nameof the database.

- spring.datasource.username= `root`

- Defines the username for the database connection .

- spring.datasource.password= `root`

- Specifies the password for the database connection.

- spring.datasource.driver-class-name= `com.mysql.cj.jdbc.Driver`

- Specifies the fully qualified name of the JDBC driver.

- spring.jpa.hibernate.ddl-auto= `update`

- Defines the behavior of the Hibernate's automatic schema generation. update creates the schema if it doesn't exist and updates it if it does.

- spring.jpa.show-sql= `true`

- Enables logging of SQL statements generated by Hibernate.

- logging.level.org.springframework= `DEBUG`

- Sets the logging level for Spring framework classes.

### โ–ถ๏ธRunning the Application

- Import the Project: Unzip the project file and import it into your IDE (e.g., Eclipse).
- Create the Database: Create a MySQL database named DailyExpenses.
- Adjust Configuration: Modify the application.properties as needed.
- Run the Application: Start the application from your IDE.

# ๐Ÿ”—API Endpoints
### Base URL
- `http://localhost:9982`
## ๐Ÿ‘ฅUser Endpoints

### Create User

- Method: POST
- URL: `/api/users`
- Description: Creates a new user.
### Request Body:

- {
- "email": "[email protected]",
- "name": "John Doe",
- "mobile": "1234567890"
- }

- Response: Status: 201 Created
- Body: UserDTO object
### Retrieve User Details
- Method: GET
- URL: ` /api/users/{id}`
- Description: Retrieves details of a user by ID.
- Example URL: `/api/users/1`
- Response: Status: 200 OK
- Body: UserDTO object

## ๐Ÿ’ฐExpenses Endpoints
### Add Expenses
- Method: POST
- URL: `/api/expenses`
- Description: Adds a new expense.
### Request Body:
- {
- "description": "Dinner",
- "amount": 120.50,
- "date": "2023-07-27",
- "userId": 1,
- "splits": [

- {
- "userId": 1,
- "amount": 40.17,
- "splitType": "EQUAL"
- }
- {
- "userId": 2,
- "amount": 40.17,
- "splitType": "EQUAL"
- }
- {
- "userId": 3,
- "amount": 40.16,
- "splitType": "EQUAL"
- }
- ]


- Response: Status: 201 Created
- Body: ExpenseDTO object

### Retrieve Individual User Expenses
- Method: GET

- URL: `/api/expenses/user/{userId}`
- Description: Retrieves all expenses for a specific user by user ID.
- Example URL: `/api/expenses/user/1`
- Response: Status: 200 OK
- Body: List of ExpenseDTO objects
-
### Retrieve Overall Expenses
- Method: GET
- URL: `/api/expenses/overall`
- Description: Retrieves all expenses in the system.
- Response: Status: 200 OK
- Body: List of ExpenseDTO objects
### Download Balance Sheet
- Method: GET
- URL: `/api/expenses/download/{userId}`
- Description: Generates and downloads a balance sheet for a specific user.
- Example URL: `/api/expenses/download/1`
- Response: Status: 200 OK
- Headers:
- Content-Disposition: attachment; filename=balance_sheet.csv
- Content-Type: `application/csv`
- Body: CSV file
## ๐Ÿ—„๏ธDatabase Structure

- The database structure consists of the following tables:

### users:
- Stores user details such as email, name, and mobile number.
### expenses:
- Stores expense details including description, amount, date, and user ID.
### splits:
- Stores information about how expenses are split among users.