Skip to content

nicholas-sc-08/vortexpay-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Java Spring Boot Maven

Postgres Hibernate JWT Lombok

Docker Swagger JUnit Mockito H2

πŸŒ€ VortexPay API

VortexPay is a robust digital banking ecosystem API, inspired by modern fintechs like Banco Inter. This project serves as the core engine for a digital bank, handling everything from secure user authentication to complex financial transaction settlements.

Unlike simple banking systems, VortexPay utilizes a smart data architecture that decouples access identity (User) from personal profiles (Customer) and asset management (Account), ensuring top-tier security and scalability.

πŸ› οΈ Tech Stack: The "Why" Behind the Choices

Technology Purpose Why I choose it
Spring Boot Framework Provides a robust, production-ready environment with built-in security and auto-configuration.
PostgreSQL Primary Database Relational database known for data integrity and performance in financial transactions.
JWT & Cookies Security Implements stateless authentication with HttpOnly cookies to prevent XSS and CSRF attacks.
Docker Containerization Ensures the application runs exactly the same way in development, testing, and production.
Hibernate (JPA) ORM Simplifies data mapping between Java objects and the database, reducing boilerplate SQL.
Mockito Testing Allows isolating services to test business logic (like transfers) without hitting the real database.
H2 Database Testing DB Provides a fast, in-memory database for automated tests, ensuring a clean state every run.
Lombok Productivity Reduces boilerplate code (getters, setters, constructors) making the classes much cleaner.

βš™οΈ Core Features

  • Authentication System: Secure login/register with password encryption and JWT session management.
  • Identity Decoupling: Unique architecture separating Authentication (User), Profile (Customer), and Assets (Account).
  • Financial Transactions: Secure money transfers between accounts with balance validation.
  • Self-Documented API: Interactive documentation via Swagger UI to test all endpoints in real-time.

πŸ—ΊοΈ Database Schema

The system architecture is based on a one-to-one and many-to-one relationship model to ensure data normalization:

  • User ↔ Customer: 1:1 (Security vs. Profile)
  • Customer ↔ Account: 1:1 (Profile vs. Assets)
  • Account ↔ Transaction: 1:N (History tracking)

πŸ›‘οΈ Business Rules & Error Handling

Scenario Logic Exception HTTP Status
Balance Withdrawals cannot exceed current balance. InsuficientFunds 422
Account Status No transactions if account is BLOCKED or INACTIVE. AccountBlocked or AccountInactive 422
Duplicity Unique Email (User) and unique Document (Customer). AlrealdyExists 409
Security Login fails if password doesn't match BCrypt hash. InvalidPassword 422

πŸ—οΈ Implementation Details

  • Welcome Bonus: New accounts are automatically initialized with a $ 10.00 balance using JPA @PrePersist hooks.
  • Atomic Transactions: All financial movements are wrapped in @Transactional blocks, ensuring data consistency (all-or-nothing).
  • Secure Identifiers: The system uses UUID for all primary keys and a custom SecureRandom generator for 8-digit account numbers.
  • State Management: Clear separation of concerns between AccountStatus (Active/Blocked) and TransactionType (Deposit/Withdrawal/Transfer).

πŸ“‚ Project Structure

The project follows a standard Spring Boot layered architecture, ensuring a clean separation of concerns:

src/main/java/com/pay/vortexpay/

β”œβ”€β”€ configs/          # Security (JWT/Filter) and App Configuration beans
β”œβ”€β”€ controllers/      # REST Endpoints for Auth, User, Customer, Account, and Transactions
β”œβ”€β”€ dtos/             # Request/Response Data Transfer Objects (using Records)
β”œβ”€β”€ entities/         # JPA Entities for Database Mapping (User, Customer, Account, Transaction)
β”œβ”€β”€ exceptions/       # Custom Exception classes and Global Exception Handler
β”œβ”€β”€ mappers/          # Component interfaces for Entity/DTO conversion
β”œβ”€β”€ repositories/     # Spring Data JPA Interfaces for Database communication
β”œβ”€β”€ services/         # Business Logic, Validators, and Security processing
└── shared/           # Enums and Shared Constants (UserRole, AccountStatus, etc.)

πŸ“– API Documentation

The API is fully documented using Swagger UI. You can explore and test all available endpoints (Authentication, Accounts, Transactions, etc.) by running the project and navigating to:

  • Swagger UI: http://localhost:8080/swagger-ui/index.html

πŸš€ Getting Started

πŸ“„ Prerequisites

  • Docker & Docker Compose
  • Java 21+ (if running locally)
  • Maven 3.8+

πŸ‹ How to Run

1. Clone the repository:

git clone https://github.com/nicholas-sc-08/vortexpay-api.git

2. Build the application:

./mvnw clean package -DskipTests

3. Spin up the environment (Postgres + API):

docker compose up --build

πŸ§ͺ Testing Strategy

Quality is ensured through a combination of unit and integration tests:

  • Unit Testing: Using JUnit 5 and Mockito to isolate business logic in TransactionService and AccountService.

  • Validation Testing: Ensuring that constraints like "Insufficient Funds" or "Blocked Account" correctly trigger the custom exceptions.

  • In-Memory DB: Utilizing H2 Database for fast and reliable integration testing during the build process.


πŸ‘€ Author

Nicholas Serencovich Carvalho Full Stack Developer & Systems Development Student

Aspiring Computer Science student at MIT. Currently mastering the Spring Ecosystem.

LinkedIn Gmail

About

A robust digital banking core and financial orchestration engine built with Java 21 and Spring Boot 3. This API handles the complete lifecycle of user accounts, secure transaction processing, and automated financial workflows. Designed for high availability and scalability, it features a modular architecture ready for high-concurrency fintech.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors