A modern expense sharing application that helps groups split bills and track shared expenses effortlessly
A full-stack expense sharing and management application built with Spring Boot and React. SplitWise helps users split bills and expenses with friends, track balances, and settle up easily.
- User Authentication: Secure registration and login with BCrypt password encryption
- Group Management: Create groups and add members for expense sharing
- Expense Tracking: Add and track expenses with detailed descriptions
- Automatic Split Calculation: Expenses are automatically split equally among group members
- Balance Tracking: Real-time balance calculations showing who owes whom
- Settlement System: Easy settlement of debts between group members
- Transaction History: Complete history of all expenses and settlements
- Receipt Generation: Download and print receipts for any expense
- Expense Calculator: Built-in calculator with tip percentage calculation
- Category Support: Categorize expenses (Food, Transport, Housing, etc.)
- Real-time Notifications: Toast notifications for user actions
- Responsive Design: Mobile-friendly interface using Tailwind CSS
- Form Validation: Comprehensive client-side validation with helpful error messages
- Java 24 (compiled with Java 16 compatibility)
- Spring Boot 3.2.2
- Spring Boot Starter Web
- Spring Boot Starter Data JPA
- Spring Boot Starter Security
- Spring Boot DevTools
- PostgreSQL - Database
- Maven - Build tool
- React 18
- React Router DOM - Navigation
- Tailwind CSS - Styling
- Lucide React - Icons
- Fetch API - HTTP requests
Before running this application, ensure you have the following installed:
- Java JDK 16+
- Node.js 14+ and npm
- PostgreSQL 12+
- Maven 3.6+
git clone <repository-url>
cd splitwise-projectCreate a PostgreSQL database:
CREATE DATABASE splitwise;Update database credentials in splitwise-backend/src/main/resources/application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/splitwise
spring.datasource.username=YOUR_USERNAME
spring.datasource.password=YOUR_PASSWORD
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=trueNavigate to the backend directory and build the project:
cd splitwise-backend
mvn clean install
mvn spring-boot:runThe backend server will start on http://localhost:8080
Navigate to the frontend directory and install dependencies:
cd splitwise-react-frontend
npm install
npm startThe frontend will start on http://localhost:3000
splitwise-backend/
βββ src/main/java/com/splitwise/
β βββ config/ # Security & CORS configuration
β β βββ SecurityConfig.java
β β βββ WebConfig.java
β βββ controller/ # REST API endpoints
β β βββ ExpenseController.java
β β βββ GroupController.java
β β βββ SettlementController.java
β β βββ UserController.java
β βββ dto/ # Data Transfer Objects
β β βββ ExpenseDTO.java
β β βββ GroupDetailsDTO.java
β β βββ LoginRequest.java
β β βββ SettlementDTO.java
β β βββ ...
β βββ model/ # JPA Entities
β β βββ User.java
β β βββ Group.java
β β βββ GroupMember.java
β β βββ Expense.java
β β βββ Settlement.java
β βββ repository/ # JPA Repositories
β β βββ UserRepository.java
β β βββ GroupRepository.java
β β βββ ExpenseRepository.java
β β βββ SettlementRepository.java
β βββ service/ # Business Logic
β β βββ UserService.java
β β βββ GroupService.java
β β βββ ExpenseService.java
β β βββ SettlementService.java
β βββ SplitwiseApplication.java
βββ src/main/resources/
βββ application.properties
splitwise-react-frontend/
βββ public/
βββ src/
β βββ components/
β β βββ auth/ # Authentication components
β β β βββ AuthProvider.js
β β β βββ LoginPage.js
β β β βββ ProtectedRoute.js
β β βββ layout/ # Layout components
β β β βββ Navbar.js
β β βββ pages/ # Page components
β β β βββ HomePage.js
β β β βββ Dashboard.js
β β β βββ CreateGroup.js
β β β βββ AddExpense.js
β β β βββ GroupDetails.js
β β β βββ MyTransactions.js
β β βββ ui/ # UI components
β β βββ NotificationSystem.js
β β βββ LoadingSpinner.js
β β βββ ExpenseCalculator.js
β β βββ ReceiptGenerator.js
β βββ utils/ # Utility functions
β β βββ api.js
β β βββ constants.js
β β βββ expenseCategories.js
β βββ App.js
β βββ App.css
β βββ index.js
β βββ index.css
βββ package.json
POST /api/users/register- Register new userPOST /api/users/login- Login userGET /api/users/email/{email}- Get user by email
POST /api/groups/create-with-members- Create group with membersGET /api/groups/user/email/{email}- Get user's groupsGET /api/groups/{id}/details?userId={userId}- Get group details
POST /api/expenses/add- Add new expenseGET /api/users/{userId}/transactions- Get user transactions
POST /api/settle- Settle up between usersGET /api/settlements/user/{userId}- Get user settlements
- Navigate to the homepage
- Click "Sign Up" to create a new account
- Or login with existing credentials
- Go to "Create Group" from the navbar
- Enter a group name
- Add members from the available users list
- Click "Create Group"
- Navigate to "Add Expense"
- Select a group
- Enter description and amount
- Optionally select a category
- Click "Add Expense"
- From the Dashboard, click on any group
- View members, balances, and expenses
- See who owes whom
- Generate receipts for expenses
- In the group details page
- Click "Settle Up" button
- Choose who to settle with
- Confirm the settlement
- Click the calculator icon in the navbar
- Enter total amount
- Adjust number of people
- Add tip percentage if needed
- See automatic split calculation
The application uses a sophisticated balance calculation system:
- Tracks all expenses paid by each member
- Calculates equal split among all group members
- Applies settlement transactions to adjust balances
- Displays personalized "you owe" or "owes you" messages
- Passwords encrypted with BCrypt
- CSRF protection disabled for API endpoints
- CORS configured for cross-origin requests
- Spring Security integrated
- Frontend: Real-time form validation with helpful error messages
- Backend: Entity validation and business logic checks
- Prevents negative amounts, invalid dates, duplicate users
Database Connection Error
- Ensure PostgreSQL is running
- Check database credentials in
application.properties - Verify database exists:
psql -U postgres -l
Port Already in Use
- Change port in
application.properties:server.port=8081
API Connection Error
- Verify backend is running on port 8080
- Check
API_BASEconstant insrc/utils/constants.js
Module Not Found
- Delete
node_modulesandpackage-lock.json - Run
npm installagain
- Unequal expense splitting
- Group admin controls
- Email notifications
- Export data to CSV/PDF
- Multi-currency support
- Expense attachments (receipts/images)
- Dark mode theme
- Mobile app version
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request