Skip to content

DevbBhatt/expense-splitter-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Έ Expense Splitter Backend

Java Spring Boot Spring Security Database Docker Render License

Backend REST API for Expense Splitter, a full-stack application inspired by Splitwise that helps users manage shared expenses, calculate balances, and simplify settlements within groups.


πŸš€ Live API

Backend

https://expense-splitter-backend-eb7u.onrender.com/

Swagger API Documentation

https://expense-splitter-backend-eb7u.onrender.com/swagger-ui/index.html


✨ Features

πŸ” Authentication

  • User Registration
  • User Login
  • JWT Authentication
  • Password Encryption using BCrypt
  • Protected APIs with Spring Security

πŸ‘₯ Group Management

  • Create Group
  • View Groups
  • Delete Group
  • Soft Delete Support

πŸ‘€ Member Management

  • Add Members
  • Remove Members
  • Group Membership Validation

πŸ’Έ Expense Management

  • Add Expense
  • Delete Expense
  • Equal Split
  • Exact Split
  • Input Validation

πŸ’° Balance Management

  • Calculate Group Balances
  • Calculate User Balances
  • Settlement Suggestions
  • Optimized Debt Simplification

πŸ›‘ Exception Handling

  • Global Exception Handler
  • Consistent API Response Structure
  • Validation Error Handling

πŸ›  Tech Stack

  • Java 21
  • Spring Boot
  • Spring Security
  • Spring Data JPA
  • Hibernate
  • JWT
  • Maven
  • TiDB Cloud (MySQL Compatible)
  • Docker
  • Render

πŸ— Project Architecture

Controller
      β”‚
      β–Ό
Service Layer
      β”‚
      β–Ό
Repository Layer
      β”‚
      β–Ό
Database (TiDB Cloud)

Project follows a layered architecture for better maintainability and separation of concerns.


πŸ“‚ Project Structure

src
└── main
    β”œβ”€β”€ controller
    β”œβ”€β”€ service
    β”œβ”€β”€ repository
    β”œβ”€β”€ entity
    β”œβ”€β”€ dto
    β”œβ”€β”€ security
    β”œβ”€β”€ config
    β”œβ”€β”€ exception
    └── ExpenseSplitterApplication

πŸ” Authentication APIs

Method Endpoint Description
POST /auth/signup Register User
POST /auth/login Login User

πŸ“ Group APIs

Method Endpoint
GET /groups
POST /groups
GET /groups/{id}
DELETE /groups/{id}

πŸ‘₯ Member APIs

Method Endpoint
POST /groups/{groupId}/members/{userId}
DELETE /groups/{groupId}/members/{userId}
GET /groups/members/{groupId}

πŸ’Έ Expense APIs

Method Endpoint
POST /expenses/groups/{groupId}/expenses
GET /expenses/groups/{groupId}/expenses
DELETE /expenses/{expenseId}

πŸ’° Balance APIs

Method Endpoint
GET /balances/groups/{groupId}/balances
GET /balances/groups/{groupId}/settlements
GET /balances/me

πŸ”‘ Environment Variables

Create an .env (or configure environment variables in your deployment platform):

DB_URL=
DB_USERNAME=
DB_PASSWORD=
JWT_SECRET=

βš™ Running Locally

Clone Repository

git clone https://github.com/DevbBhatt/expense-splitter-backend.git

Move into project

cd expense-splitter-backend

Run

./mvnw spring-boot:run

🐳 Docker

Build

docker build -t expense-splitter-backend .

Run

docker run -p 8080:8080 expense-splitter-backend

🌐 Deployment

Service Platform
Backend Render
Database TiDB Cloud

πŸš€ Future Improvements

  • Email Verification
  • Password Reset
  • Recurring Expenses
  • Expense Categories
  • Notifications
  • File Attachments
  • Group Invitations
  • Audit Logs

πŸ‘¨β€πŸ’» Author

Dev Bhatt

GitHub

https://github.com/DevbBhatt

LinkedIn

https://www.linkedin.com/in/dev-bhatt-9825b12bb/


⭐ If you like this project, consider giving it a star!

About

REST API for Expense Splitter built with Spring Boot, JWT Authentication and MySQL.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors