video.mp4
A Spring Boot REST API for bank account management with JWT authentication.
The API supports account creation, deposit, withdraw, and transfer operations, along with centralized exception handling.
- JWT-based authentication and role management
- Account creation and retrieval
- User login with JWT token generation
- Deposit, withdraw, and transfer money operations
- Centralized exception handling
- Clean layered architecture (Controller, Service, Repository, Security, Config)
- Java 17
- Spring Boot 3
- Spring Security + JWT
- Spring Data JPA + Hibernate
- PostgreSQL
- Maven
spring-boot-bank-api/
│
├─ src/main/java/com/enescidem/
│ ├─ config/
│ │ └─ SecurityConfig.java
│ │
│ ├─ controller/
│ │ ├─ AuthController.java
│ │ ├─ IAccountController.java
│ │ └─ impl/
│ │ ├─ AccountControllerImpl.java
│ │ └─ AuthControllerImpl.java
│ │
│ ├─ dto/
│ │ ├─ DtoAccount.java
│ │ ├─ DtoAccountIU.java
│ │ ├─ DtoLogin.java
│ │ └─ DtoLoginIU.java
│ │
│ ├─ entity/
│ │ └─ Account.java
│ │
│ ├─ repository/
│ │ └─ AccountRepository.java
│ │
│ ├─ security/
│ │ ├─ JwtFilter.java
│ │ └─ JwtUtil.java
│ │
│ ├─ service/
│ │ ├─ IAccountService.java
│ │ ├─ IAuthService.java
│ │ └─ impl/
│ │ ├─ AccountServiceImpl.java
│ │ └─ AuthServiceImpl.java
│ │
│ ├─ exception/
│ │ ├─ BaseException.java
│ │ ├─ ErrorMessage.java
│ │ └─ MessageType.java
│ │
│ └─ handler/
│ ├─ ApiError.java
│ ├─ Exception.java
│ └─ GlobalExceptionHandler.java
│
├─ src/main/resources/
│ └─ application.properties
│
└─ pom.xml
git clone https://github.com/username/spring-boot-bank-api.git
cd spring-boot-bank-apiSet the following properties in application.properties:
jwt.secret=YourSecretKey
jwt.expiration=300000 # 5 minutes in milliseconds
spring.datasource.url=jdbc:postgresql://localhost:5432/db_name
spring.datasource.username=postgres
spring.datasource.password=passwordmvn clean install
mvn spring-boot:runPOST /auth/login– Login and receive JWT tokenPOST /accounts/create– Create a new accountGET /accounts/me– Retrieve logged-in user accountPOST /accounts/deposit– Deposit moneyPOST /accounts/withdraw– Withdraw moneyPOST /accounts/transfer– Transfer money
