A RESTful Java API that helps groups track and split shared expenses fairly. Ideal for roommates, friends traveling together, or teams managing shared costs.
- Create users and groups
- Add shared expenses with split logic
- View who owes whom
- Settle balances
- Track group expenses over time
- Java 21.0.6
- Spring Boot
- REST API (Spring MVC)
- MySQL (configured via
application.yml) - JPA / Hibernate
- Gradle
- Java 11+
- Maven / Gradle
- Any IDE like IntelliJ or Eclipse
Clone the repo:
git clone https://github.com/pinkish-code/expense-sharing-API.git./gradlew bootRunThe API will start on: http://localhost:8080
src/
├── main/
│ ├── java/
│ │ └── org.example
│ │ ├── controller/
│ │ ├── service/
│ │ ├── model/
│ │ └── repository/
│ └── resources/
│ └── application.yml
└── test/
| Method | Endpoint | Description |
|---|---|---|
| POST | /users |
Create a new user |
| POST | /expenses |
Add an expense |
| POST | /show |
Show balances |
{ "command": "EXPENSE", "userId": "u1", "expense": { "paidBy": "u1", "amountPaid": 200.0, "userIds": ["u1", "u2", "u3"], "splitType": "EXACT", "values": [40, 100, 60] } }
Contributions welcome! Please open an issue or submit a pull request.
java -Xms256m -Xmx700m -jar build/libs/Expense-sharing-API-1.0-SNAPSHOT.jar --spring.profiles.active=production
scp -i ~/Downloads/expkey.pem /Users/swati.gupta/code/Expense-sharing-API/build/libs/Expense-sharing-API-1.0-SNAPSHOT.jar ubuntu@3.108.252.183:/home/ubuntu/
ssh -i ~/Downloads/expkey.pem ubuntu@3.108.252.183