A simple RESTful API built with Spring Boot to simulate basic banking operations like account creation and fund transfers.
- Create user accounts with an initial balance
- Transfer funds between accounts
- Retrieve transaction history
- View all accounts
- Clean 3-layer architecture: Controller → Service → Repository
- Java 21
- Spring Boot 3.4.4
- Spring Web
This project uses Gradle to build and run the Spring Boot application.
Java 21 installed
git clone https://github.com/ireneboby/BankingAPI.git
cd BankingAPI
./gradlew bootRun
The app will start on http://localhost:8080
Open in browser: http://localhost:8080/swagger-ui.html
./gradlew clean build
This will generate a JAR file in the build/libs/ directory.
java -jar build/libs/<FILNAME>.jar
All endpoints return:
- 201 Created or 200 OK on success
- 400 Bad Request with an error message for invalid input (e.g. null fields, negative balance, insufficient funds)
POST /api/accounts
Request Body: { "firstName": "Luna", "lastName": "Lovegood", "initialBalance": 1000.00 }
GET /api/accounts
Returns a list of all account summaries.
POST /api/transactions/transfer
Transfers funds between accounts.
Request Body: {"senderId": 1, "receiverId": 2, "transferAmount": 250.00}
GET /api/transactions/account/{accountId}
Returns a list of transactions where the account was a sender or receiver.
- Account IDs are generated automatically using an in-memory counter
- Account Balances are handled using
BigDecimalfor currency precision - No memory persistence yet — data is lost on app restart (in-memory only)
- No authentication or authorization is implemented
- Negative balances are not allowed
- Transaction history is not filtered (returns full history)
- Swagger is used as the only form of documentation
- Only basic validation is performed (e.g. null checks, amount > 0)
- Account names are not validated for uniqueness or formatting
- Currency is not supported (i.e. all amounts are assumed to be in a single currency like USD)