A backend REST API project developed using Java, Spring Boot, Spring Data JPA, Hibernate, and MySQL.
This project provides APIs for managing customers, bank accounts, and transactions such as deposits and withdrawals. It also includes validation and global exception handling.
- Customer Management
- Bank Account Management
- Account-Customer Relationship
- Deposit Transactions
- Withdrawal Transactions
- Account Balance Management
- Transaction History
- Input Validation
- Global Exception Handling
- RESTful APIs
- MySQL Database Integration
- Java 21
- Spring Boot 4.0.8
- Spring Data JPA
- Hibernate
- MySQL
- Maven
- REST API
- Postman
- Git & GitHub
src/main/java/com/aryan/bank_management_system
│
├── account
│ ├── controller
│ ├── entity
│ ├── repository
│ ├── service
│ └── transaction
│ ├── controller
│ ├── entity
│ ├── repository
│ └── service
│
├── controller
├── entity
├── exception
├── repository
├── service
│
└── BankManagementSystemApplication.java
| Method | Endpoint | Description |
|---|---|---|
| POST | /customers |
Create Customer |
| GET | /customers |
Get All Customers |
| GET | /customers/{id} |
Get Customer by ID |
| PUT | /customers/{id} |
Update Customer |
| GET | /customers/{id}/accounts |
Get Customer Accounts |
| Method | Endpoint | Description |
|---|---|---|
| POST | /accounts?customerId=1 |
Create Account |
| GET | /accounts |
Get All Accounts |
| GET | /accounts/{id} |
Get Account by ID |
| PUT | /accounts/{id} |
Update Account |
| GET | /accounts/{id}/transactions |
Get Account Transactions |
| Method | Endpoint | Description |
|---|---|---|
| POST | /transactions?accountId=1 |
Create Transaction |
| GET | /transactions |
Get All Transactions |
| GET | /transactions/{id} |
Get Transaction by ID |
| GET | /accounts/{id}/transactions |
Get Account Transaction History |
The system supports two transaction types:
DEPOSIT— Adds money to the account balance.WITHDRAW— Deducts money from the account balance.
Withdrawal is not allowed when the requested amount is greater than the available balance.
The project includes validation for:
- Customer name
- Phone number
- Address
- Account number
- Account type
- Account balance
- Transaction type
- Transaction amount
Example validation:
Phone must be 10 digits
Amount must be greater than 0
Transaction type must be DEPOSIT or WITHDRAW
Insufficient balance
Global exception handling is implemented using:
@RestControllerAdvice@ExceptionHandler- Custom
ResourceNotFoundException
This provides clear error responses for validation errors and missing resources.
Database: MySQL
Database name:
bank_management_system
Database credentials are configured using environment variables and are not stored directly in the source code.
Example:
spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}git clone https://github.com/aryan14x/bank-management-system.gitOpen the project in VS Code or IntelliJ IDEA.
Set the following environment variables:
DB_URL
DB_USERNAME
DB_PASSWORD
Example:
DB_URL=jdbc:mysql://localhost:3306/bank_management_system
DB_USERNAME=root
DB_PASSWORD=your_password
Using Maven Wrapper:
Windows:
mvnw.cmd spring-boot:runOr run:
BankManagementSystemApplication.java
from your IDE.
The application runs on:
http://localhost:8080
APIs can be tested using Postman.
Example:
POST http://localhost:8080/customers
{
"name": "Amit Kumar",
"email": "amit@gmail.com",
"phone": "9876543210",
"address": "Raipur"
}This project was developed to understand and implement real-world backend development concepts including:
- REST API development
- Spring Boot
- JPA & Hibernate
- MySQL database integration
- Entity relationships
- CRUD operations
- Validation
- Exception handling
- Backend business logic
Aryan Bhardwaj
B.Tech CSE | Java Backend Developer
Java
Spring Boot
Spring Data JPA
Hibernate
MySQL
REST API
HTML
CSS
JavaScript
Git & GitHub
⭐ If you find this project useful, feel free to explore the repository.