Skip to content

Molly-Varshney/finance-dashboard-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Finance Dashboard Backend

Spring Boot PostgreSQL Java Hibernate Swagger

A highly scalable, production-ready REST API for a personal finance and budgeting dashboard. Built using a domain-driven Package-by-Feature architecture to ensure clean modularity and enterprise-level maintainability.

🏛️ Architecture & Features

This API was engineered using modern backend standards:

  • Clean Architecture: Divided into strict features (account, category, transaction, user).
  • Data Integrity: Strict enforcement of business rules (e.g. InsufficientBalanceException triggers global rollbacks using @Transactional).
  • Precision Mathematics: Use of BigDecimal globally to avoid floating-point inaccuracies during financial processing.
  • Global Error Handling: @ControllerAdvice intercepts core application logic crashes and formats them into clean JSON 400/404/500 responses.
  • Interactive Documentation: Real-time API schema generated by Springdoc OpenAPI.

🚀 Quick Start

1. Database Setup

This project uses PostgreSQL. Create a database called finance_db. Ensure your local PostgreSQL server is running and configure your credentials inside src/main/resources/application.properties:

spring.datasource.url=jdbc:postgresql://localhost:5432/finance_db
spring.datasource.username=postgres
spring.datasource.password=1234

2. Run the Application

You can run the application directly from your IDE, or via Maven in your terminal:

./mvnw spring-boot:run

(The embedded Tomcat server will start on port 8081)

3. Automatic Database Seeding

To make testing easier, a DatabaseSeeder component is bundled. If your database is completely empty upon startup, it will automatically insert a Dummy User and Dummy Category, and print their UUIDs directly into your terminal!


🔑 Test Data (Important for Testing)

When you start the application, check the console logs. You will see:

  • USER_ID
  • CATEGORY_ID

Use these IDs while testing APIs in Swagger.

Example:

  • userId → paste USER_ID from console
  • categoryId → paste CATEGORY_ID from console

📖 API Documentation (Swagger)

The entire API structure is automatically documented and interactive. Once the server is running, navigate to the Swagger UI page in your browser: 👉 http://localhost:8081/swagger-ui/index.html

You can send test HTTP Requests to create Accounts and make Transactions directly from the webpage.


🛠️ Tech Stack & Dependencies

  • Core: Java 21, Spring Boot (Web, core container)
  • Storage: PostgreSQL, Spring Data JPA, Hibernate
  • Security: Spring Security (Pre-configured)
  • Documentation: Springdoc OpenAPI (Swagger)
  • Tooling: Lombok, Maven

👨‍💻 Testing with VS Code

If you use VS Code, an interactive test.http file is included in the root directory. Install the "REST Client" extension to ping endpoints directly from your code editor!

📌 Sample API Request

Create Account

POST /api/accounts

{
  "name": "Main Account",
  "startingBalance": 100.00,
  "currency": "USD",
  "userId": "your-user-id"
}

About

Finance backend system using Spring Boot, PostgreSQL, Swagger

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages