Spring Boot banking API for managing customer registration, JWT login, accounts, cards, KYC details, nominees, and investments.
This application demonstrates a layered banking workflow with stateless JWT authentication, role-based access control, and JPA-backed persistence. Customers can register, log in, open accounts, manage cards and nominees, and invest from eligible balances. Admins can register as admins, inspect users, and manage account activation.
- Spring Boot REST API setup
- Spring Data JPA repository pattern
- MySQL-backed persistence
- Spring Security with JWT authentication
- Role-based access control with
@PreAuthorize - Customer and admin registration flows
- Account opening with account-type specific logic
- Card application, blocking, and limit updates
- KYC and nominee updates
- Investment creation from customer balances
- Custom JWT login endpoint
- Java 17
- Spring Boot 2.7
- Spring Web
- Spring Data JPA
- Spring Security
- Spring Validation
- MySQL
- Maven
- Lombok
- JJWT
Bank Security Application/
├── README.md
├── CHANGELOG.md
├── pom.xml
├── mvnw
├── mvnw.cmd
└── src/
└── main/
├── java/com/security/bank/
│ ├── AccountRules/
│ ├── accounts/
│ ├── admin/
│ ├── cards/
│ ├── config/
│ ├── dto/
│ ├── entity/
│ ├── jwt/
│ ├── repository/
│ ├── security/
│ ├── service/
│ ├── user/
│ └── BankApplication.java
└── resources/
└── application.yml
- Open a terminal in the project root.
- Update MySQL and JWT settings in
src/main/resources/application.ymlif needed. - Run
mvn test. - Run
mvn spring-boot:run. - Register a user with
POST /user/register. - Log in with
POST /user/login. - Call protected endpoints with
Authorization: Bearer <token>.
Available endpoints:
POST /user/registerPOST /user/loginPOST /admin/addGET /admin/getAllUserGET /admin/getUserByName/{username}DELETE /admin/deleteUser/{userId}PUT /admin/account/deactivatePUT /admin/account/activateGET /admin/account/getActiveAccountsListGET /admin/account/getInActiveAccountsListGET /admin/accountList/ByAccountType/{accType}GET /admin/accountList/ByBranchType/{branchType}POST /account/create/{userId}GET /account/all/{userId}GET /account/balanceGET /account/nomineePUT /account/updateNominee/{accountId}GET /account/getKycDetailsPUT /account/updateKyc/{accountId}GET /account/getAccount/summaryGET /card/blockPOST /card/apply/newPUT /card/settingPOST /invest/now
Access notes:
/user/registerand/user/loginare public.CUSTOMERusers can open accounts, manage cards, update KYC/nominees, and invest.ADMINusers can manage users and inspect account lists.- JWT security is configured in
SecurityConfig.
Example customer registration body:
{
"username": "john",
"password": "john123",
"name": "John Doe",
"email": "john@example.com",
"userType": "CUSTOMER"
}Example account creation body:
{
"accountType": "SAVINGS",
"balance": 50000,
"proof": "PAN",
"nominee": {
"name": "Jane Doe",
"accountNumber": 12345678,
"relation": "SPOUSE",
"age": 32,
"gender": "FEMALE"
}
}- Suggested repository description:
Spring Boot banking API for customer accounts, cards, KYC, investments, and JWT-based security. - Suggested topics:
java,java-17,spring-boot,spring-security,spring-data-jpa,jwt,mysql,banking,rest-api,maven,lombok,investment,account-management,portfolio-project