This project is an Expense Tracker API built with Spring Boot. It provides a robust backend for managing expenses, categories, and user authentication. The application follows a clean architecture pattern and incorporates domain-driven design principles.
- User Authentication and Authorization
- Expense Management
- Category Management
- Role-based Access Control
- Audit Logging Events based on Spring Application Events
- JWT Token-based Authentication
- OpenAPI (Swagger) Documentation
- Pagination and Sorting for List Operations
- Java 17
- Spring Boot 3.3.2
- Spring Security with JWT
- Spring Data JPA
- H2 Database (for development)
- Maven
- GitHub Actions (CI/CD)
- Lombok
- SpringDoc OpenAPI (Swagger)
- Rate Limiting with Bucket4j
The project follows a clean architecture with the following main packages:
com.juriba.tracker.auth: Authentication and authorizationcom.juriba.tracker.user: User managementcom.juriba.tracker.expense: Expense and category managementcom.juriba.tracker.audit: Audit loggingcom.juriba.tracker.common: Common utilities and base classes
Each feature area is further divided into:
application: Use cases and application servicesdomain: Domain models and eventsinfrastructure: Repositories and external servicespresentation: Controllers and DTOs
- Java 17 or later
- Maven
- openssl
-
Clone the repository:
git clone [repository-url] -
Navigate to the project directory:
cd tracker-api -
Run the setup script to generate RSA keys for JWT:
./setup_project.sh -
Build the project:
mvn clean install -
Run the application:
mvn spring-boot:run -Dspring-boot.run.profiles=dev -
For testing, you can use the generated following credentials:
admin User Email: admin@tracker.com admin User Password: adminPassword user User Email: user@tracker.com user User Password: userPassword
The application will start on http://localhost:8080.
Once the application is running, you can access the Swagger UI for API documentation at:
http://localhost:8080/swagger-ui/index.html
The main configuration files are:
src/main/resources/application.properties: Main application propertiessrc/main/resources/application-dev.properties: Development-specific properties
Run the tests using:
mvn test
- The application uses JWT for authentication.
- Passwords are encrypted using BCrypt.
- Role-based access control is implemented for different endpoints.