A robust and modular backend banking system built with Spring Boot, Spring Data JPA, and MariaDB/MySQL.
This backend powers core banking features such as customer management, bank account operations (debit, credit, transfer), and full transaction history. The application is structured with clean architectural separation (DTOs, services, mappers, exception handling) and JWT-based security.
β οΈ This repository contains the backend only. The Angular frontend is implemented in this repository.
- Create, update, retrieve, and delete customers.
- Search customers by keyword or exact name.
- Supports Current Accounts (with overdraft) and Saving Accounts (with interest rate).
- Create, update, delete, and retrieve bank accounts.
- Retrieve accounts by customer.
- Debit, credit, and transfer between accounts.
- Track full transaction history with pagination and summaries.
- Structured account history using
AccountHistoryDTO. - Access latest operation summaries.
-JWT-based authentication with role-based access control (USER and ADMIN scopes). Password encryption using BCrypt.
Handles common banking errors:
CustomerNotFoundExceptionBankAccountNotFoundExceptionInsufficientBalanceException
Interactive Swagger UI at:
http://localhost:8085/swagger-ui/index.html
- Entities:
Customer,BankAccount,CurrentAccount,SavingAccount,AccountOperation - DTOs: Transfer objects for API communication
- Repositories: Spring Data JPA Repositories
- Services: Business logic with interfaces and implementations
- Controllers: REST API endpoints secured by JWT scopes
- Mappers: Entity β DTO transformation
- Exceptions: Custom exceptions for domain errors
- Security: JWT generation and validation, password encoding
This backend currently uses a relational MySQL database to persist customer, account, and transaction data.
- 1οΈβ£ Customer β¨ N BankAccounts
- 1οΈβ£ BankAccount β¨ N AccountOperations
| Technology | Version |
|---|---|
| Java | 21 |
| Spring Boot | 3.5.3 |
| Spring Data JPA | Included |
| MySQL | 8+ |
| Lombok | 1.18.34 |
| Swagger / OpenAPI | 2.5.0 |
| Maven | Build Tool |
| H2 (optional) | For testing |
| JWT (Nimbus JOSE) | included |
| BCrypt | Password Encoding |
- Java 21+
- Maven
- MySQL running (DB name:
E-BANK) - (Optional) phpMyAdmin or MySQL client
- Clone this repository:
git clone https://github.com/YOUHAD08/e-bank-backend-springboot.git cd e-bank-backend-springboot - Configure database in
src/main/resources/application.properties:spring.datasource.url=jdbc:mysql://localhost:3306/E-BANK?createDatabaseIfNotExist=true spring.datasource.username=root spring.datasource.password= - Build & Run
mvn clean install mvn spring-boot:run
- Access the APIs:
- Swagger UI: http://localhost:8085/swagger-ui/index.html
- MySQL Database via phpMyAdmin: http://localhost/phpmyadmin/index.php?route=/database/structure&db=e-bank
POST /auth/loginβ Login with username and password, returns JWT token.POST /auth/signupβ Register a new customer (role USER by default).GET /auth/profileβ Get current authenticated user details.
GET /customersβ List all customers.GET /customer/{id}β Get customer by ID.GET /customers/search?keyword=β Search customers by keyword.GET /customer/search?name=β Search customer by exact name.POST /customerβ Create customer (ADMIN only).PUT /customer/{id}β Update customer (ADMIN only).DELETE /customer/{id}β Delete customer (ADMIN only)
GET /account/{accountId}β Get bank account by ID.GET /accountsβ List all accounts.GET /accounts/{customerId}β List all accounts of a customer.POST /currentAccount/{customerId}β Create current account (ADMIN only).POST /savingAccount/{customerId}β Create saving account (ADMIN only).PUT /currentAccount/{accountId}β Update current account (ADMIN only).PUT /savingAccount/{accountId}β Update saving account (ADMIN only).DELETE /account/{accountId}β Delete account (ADMIN only).
GET /account/{accountId}/operationsβ List all operations for an account.GET /account/{accountId}/pageOperations?page=&size=β Paginated operations list.POST /account/{accountId}/debit?amount=&description=β Debit an account.POST /account/{accountId}/credit?amount=&description=β Credit an account (ADMIN only).POST /account/{accountId}/transfer?toAccountId=&amount=β Transfer money (ADMIN only).GET /operationsβ List all account operations.
CustomerNotFoundException- Thrown when a customer is not found.BankAccountNotFoundException- Thrown when a bank account is not found.InsufficientBalanceException- Thrown when an account has insufficient funds for a debit or transfer.
On startup, the application seeds the database with:
- 10 customers with realistic names, cities, and emails.
- 3 to 5 random accounts per customer (mix of current and saving).
- 10 to 20 random debit and credit operations per account.
Contributions are welcome! Feel free to open issues or pull requests so we grow together.
This project currently implements the backend RESTful API using Spring Boot and a relational MySQL database.
The frontend is currently under development using Angular and is structured to provide a clean and interactive UI for:
- Customer and account management
- Performing debit/credit/transfer operations
- Viewing paginated account operation history
- ... and more features to come
In future development, I plan to build an agentic AI component to work alongside this backend. While the full scope is yet to be defined, potential features might include:
- Intelligent customer support and chatbot integration
- Automated transaction analysis and fraud detection
- Personalized financial advice and account management
- Dynamic task automation within the banking system
This agentic AI will aim to enhance user experience, improve operational efficiency, and provide smart automation capabilities.
Although this version uses MySQL, a future version of this backend will be migrated to MongoDB to take advantage of:
- Flexible document-based schema
- Easier scalability
- Faster iterations in development
Stay tuned for the agentic AI enhancements, and the MongoDB-backed backend!
Developed by Youhad
Β© 2025

