Skip to content

EMVeskioja/Expense-tracker-backend

Repository files navigation

Java Spring Boot H2 Database PostgreSQL Swagger UI JUnit Mockito Build License Stars Forks

Expense Tracker Backend

Welcome to the backend of the Expense Tracker Full-Stack Project! This robust RESTful API is built with Spring Boot and PostgreSQL, designed meticulously for tracking expenses, scanning receipts, and managing financial records. 💸

What is This?

This backend handles all the heavy lifting for the Expense Tracker. It's built to endure the demands of precise bookkeepers and budget-savvy users alike.

Tech Stack:

  • Java 17: Modern Java, because we're fancy like that.
  • Spring Boot 3: For robust back-end services.
  • Spring Data JPA & Spring Validation: Because data matters and so does its integrity.
  • H2 Database: For testing without tears.
  • PostgreSQL: For production because we're serious about data.
  • Swagger UI: For easy testing and beautiful documentation.
  • JUnit 5 & Mockito: For making sure everything actually works.

Features:

  • Full CRUD Operations: Create, Read, Update, Delete — all your expenses are under your control.
  • Database Persistence: From H2 in dev to PostgreSQL in production.
  • Swagger UI: Auto-generated docs that make testing a breeze.
  • Exception Handling: We handle errors gracefully, keeping the backend stable.

Api Endpoints:

  • GET /api/expenses: Fetch all the money you've ever spent.
  • GET /api/expenses/{id}: Get an expense by ID.
  • POST /api/expenses: Confess a new expense.
  • PUT /api/expenses/{id}: Update the details of an existing expense.
  • DELETE /api/expenses/{id}: Forget an expense ever happened.

Testing Coverage:

  • Service Layer Testing: We mock the repositories to test service logic.
  • Controller Testing: We use MockMVC to ensure our endpoints are top-notch.
  • Integration Testing: Full API behavior validation — nothing gets past us.

Setup Database:

  • Default: H2
  • For Production: Switch to PostgreSQL.

Contribute:

  • This project is open-source. Contributions are not just welcome, they're celebrated! 🎉

Star This Repo

Support the project by starring this repo!

Contact & Feedback:

Connect with me on LinkedIn