Skip to content

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.

Notifications You must be signed in to change notification settings

SymonMuchemi/expense_tracker_api

Repository files navigation

Expense Tracker API

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.

Features

  • 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.

Tech Stack

  • 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)

Database Schema

The application uses a normalized database structure consisting of two tables with a One-to-Many relationship (one Category to many Expenses).

Database Design

Getting Started

Prerequisites

  • JDK 17 or later
  • Maven 3.6+
  • PostgresSQL instance running
  1. Clone the repository
git clone https://github.com/SymonMuchemi/expense_tracker_api
cd expense_tracker_api
  1. 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
  1. Build and Run

Run the application using the Spring Boot Maven plugin:

./mvnw clean install
./mvnw spring-boot:run

Swagger Documentation:

http://localhost:8080/swagger-ui/index.html#

About

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.

Topics

Resources

Stars

Watchers

Forks

Languages