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.
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.
InsufficientBalanceExceptiontriggers global rollbacks using@Transactional). - Precision Mathematics: Use of
BigDecimalglobally to avoid floating-point inaccuracies during financial processing. - Global Error Handling:
@ControllerAdviceintercepts core application logic crashes and formats them into clean JSON 400/404/500 responses. - Interactive Documentation: Real-time API schema generated by Springdoc OpenAPI.
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=1234You 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)
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!
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
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.
- 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
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!
POST /api/accounts
{
"name": "Main Account",
"startingBalance": 100.00,
"currency": "USD",
"userId": "your-user-id"
}