This project is a backend banking application built with Spring Boot. It exposes a RESTful API for customer management, account operations, and transaction processing. The system applies double-entry bookkeeping principles using journals and ledger entries to ensure that transactions are always balanced and auditable.
-
Language: Java 17
-
Framework: Spring Boot 3.4.10
spring-boot-starter-web
for REST APIsspring-boot-starter-data-jpa
for persistencespring-boot-starter-security
for authentication and authorizationspring-boot-starter-validation
for request validation
-
Database: H2 (in-memory, development)
-
Documentation: SpringDoc OpenAPI (Swagger UI)
-
Build Tool: Maven with
spring-boot-maven-plugin
git clone https://github.com/Carlomos7/Spring-Banking-App-API
cd banking-api
# Using Maven Wrapper
./mvnw spring-boot:run
# Or using Maven directly
mvn spring-boot:run
- Base URL:
http://localhost:8080
- Swagger UI:
http://localhost:8080/swagger-ui/index.html
- H2 Console (development profile):
http://localhost:8080/h2-console
- Register new users with unique username and email
- Authenticate via login (username or email + password)
- Retrieve and update customer profiles
- Open new accounts (checking, savings, internal)
- Toggle account status (active/inactive)
- Retrieve account details by ID
- List all accounts for a customer
- Create journals for grouping transactions
- Add debit and credit ledger entries to journals
- Enforce balanced double-entry bookkeeping
- Post journals to finalize transactions
- Retrieve ledger history for specific accounts (with pagination)
- Passwords hashed using BCrypt
- Input validation on registration (strong password policy enforced)
- HTTP Basic Authentication enabled for development profile
- GET / – Returns API information
- POST /auth/register – Register a new customer
- POST /auth/login – Authenticate a customer
- GET /customers/{id} – Get customer details by ID
- PATCH /customers/{id} – Update customer profile
- POST /customers/{customerId}/accounts – Open a new account
- GET /customers/{customerId}/accounts – List all accounts for a customer
- GET /accounts/{accountId}?customerId={customerId} – Get account details
- PATCH /accounts/{accountId}/active – Activate or deactivate an account
- POST /journals?description={desc}&externalRef={ref} – Create a new journal
- GET /journals/{journalId} – Retrieve a journal by ID
- POST /journals/{journalId}/entries – Add a ledger entry to a journal
- GET /journals/{journalId}/entries – List entries for a journal
- POST /journals/{journalId}/post – Post (finalize) a journal
- GET /accounts/{accountId}/entries?page={n}&size={m} – Get ledger history for an account
- Customer – Username, email, password hash, profile fields
- Account – Linked to a customer, currency, account type, active flag, timestamps
- Journal – Transaction container with description, external reference, status (PENDING/POSTED)
- LedgerEntry – Debit/credit posting tied to both a journal and an account
curl -X POST http://localhost:8080/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "alice",
"firstName": "Alice",
"lastName": "Smith",
"email": "alice@email.com",
"password": "StrongPass123!"
}'
curl -X POST http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{
"identifier": "alice",
"password": "StrongPass123!"
}'
curl -X POST http://localhost:8080/customers/{customerId}/accounts \
-H "Content-Type: application/json" \
-d '{
"kind": "checking",
"currency": "USD"
}'
# Create a journal
curl -X POST "http://localhost:8080/journals?description=Transfer&externalRef=12345"
# Add a debit entry
curl -X POST http://localhost:8080/journals/{journalId}/entries \
-H "Content-Type: application/json" \
-d '{
"accountId": "{accountId}",
"side": "DEBIT",
"amountCents": 10000,
"currency": "USD"
}'
# Add a credit entry
curl -X POST http://localhost:8080/journals/{journalId}/entries \
-H "Content-Type: application/json" \
-d '{
"accountId": "{accountId}",
"side": "CREDIT",
"amountCents": 10000,
"currency": "USD"
}'
# Post the journal
curl -X POST http://localhost:8080/journals/{journalId}/post
This project allowed me to practice:
- Building REST APIs with Spring Boot
- Modeling banking operations with double-entry bookkeeping
- Applying strong validation and security practices in Spring Security
- Using JPA/Hibernate for entity persistence and relationships
- Documenting APIs with OpenAPI/Swagger for easy exploration