A REST-ful API designed to manage personal financial expenses and categories. This project is built using Spring Boot and Spring Data JPA, focusing on core CRUD operations and a professional database design.
- Category Management (CRUD): Add, view, update, and delete spending categories
- Record expenses with details like description, amount and date, linking each to a specific category
- Uses
Decimal(10, 2)for amount to ensure accurate financial calculations. - Auditing: Automatic timestamping for creation and last update (
createdAt,updateAt). - Unit tests (services).
- Intgration tests (controllers).
- API Documentation with Swagger UI.
- Exception handling with meaningful error responses.
- Input validation to ensure data integrity using Data Transfer Objects(DTOs).
- CI pipeline with GitHub Actions for automated testing and building.
- Language: Java 17
- Framework: Spring Boot 3.2.0
- Data Access: Spring Data JPA
- Database: PostgresSQL
- Testing: JUnit 5, Mockito
- API Documentation: Springdoc OpenAPI (Swagger UI)
The application uses a normalized database structure consisting of two tables with a One-to-Many relationship (one Category to many Expenses).
- JDK 17 or later
- Maven 3.6+
- PostgresSQL instance running
- Clone the repository
git clone https://github.com/SymonMuchemi/expense_tracker_api
cd expense_tracker_api- Configure the database
spring.datasource.url=jdbc:postgresql://localhost:5432/expense_tracker_db
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=update- Build and Run
Run the application using the Spring Boot Maven plugin:
./mvnw clean install
./mvnw spring-boot:run