A Spring Boot 3 backend application for the FinMate personal finance management system.
- User Authentication: JWT-based authentication with registration and login
- User Management: User CRUD operations with role-based access control
- Invitation System: User invitation management for team collaboration
- Database Migration: Automatic schema management with Flyway
- API Documentation: Swagger UI integration for API exploration
- Security: Spring Security with BCrypt password encoding
- Java 17
- Spring Boot 3.2.0
- Spring Security 6
- Spring Data JPA
- MySQL Database
- Flyway Migration
- JWT Authentication
- OpenAPI 3 (Swagger)
- Maven
- Lombok
- Java 17 or higher
- MySQL 8.0 or higher
- Maven 3.6 or higher
Set the following environment variables or use the default values:
# Database Configuration
DB_URL=jdbc:mysql://localhost:3306/finmate?createDatabaseIfNotExist=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
DB_USERNAME=root
DB_PASSWORD=password
# JWT Configuration
JWT_SECRET=your-secret-key-here-change-in-production
JWT_EXPIRATION=86400000-
Clone the repository
git clone <repository-url> cd finmate-backend
-
Set up MySQL database
- Ensure MySQL is running
- Create a database named
finmate(or it will be created automatically) - Update environment variables if needed
-
Build the project
mvn clean install
-
Run the application
mvn spring-boot:run
-
Access the application
- Application: http://localhost:8080
- Swagger UI: http://localhost:8080/swagger-ui.html
- API Docs: http://localhost:8080/api-docs
POST /api/auth/register- Register a new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user info
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"password": "password123"
}'curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"password": "password123"
}'curl -X GET http://localhost:8080/api/auth/me \
-H "Authorization: Bearer YOUR_JWT_TOKEN"The application automatically creates the following tables via Flyway migrations:
id- Primary keyname- User's full nameemail- Unique email addresspassword_hash- BCrypt hashed passwordrole- User role (ADMIN, MEMBER)created_at- Account creation timestampupdated_at- Last update timestamp
id- Primary keyemail- Invited user's emailrole- Invited rolestatus- Invitation status (PENDING, ACCEPTED, DECLINED, EXPIRED)token- Unique invitation tokeninvited_at- Invitation timestampexpires_at- Expiration timestampinvited_by- Reference to inviting user
- JWT Authentication: Stateless authentication with configurable expiration
- Password Security: BCrypt password hashing
- CORS Configuration: Configurable cross-origin resource sharing
- Role-based Access: User roles for authorization
- Input Validation: Bean validation for all inputs
src/main/java/com/finmate/
├── config/ # Configuration classes
├── auth/ # Authentication and authorization
├── users/ # User management
├── invitations/ # Invitation system
├── common/ # Shared utilities and base classes
└── FinmateBackendApplication.java
- Create entity classes extending
BaseEntity - Create repository interfaces extending
JpaRepository - Create service classes with business logic
- Create DTOs for data transfer
- Create controllers for API endpoints
- Add appropriate security configurations
Run tests with:
mvn testThe project includes test configuration that uses H2 in-memory database and disables security for testing purposes.
mvn clean package -DskipTestsThe JAR file will be created in the target/ directory.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.