MicroBank360 is a modular, scalable banking platform built using the Microservice Architecture with Java Spring Boot. It simulates core banking functionalities such as customer and account management and is designed to grow with additional services like transactions, notifications, and authentication.
Architecture: View Architecture Design
- Customer Service & Account Service – Independent microservices with full CRUD operations.
- Spring Data JPA – Simplified database interaction via repositories.
- RESTful APIs – Structured and consistent API endpoints.
- OpenFeign – Declarative REST client for seamless inter-service communication.
- Eureka – Service discovery and registration for dynamic scaling.
- Spring Cloud API Gateway – Centralized routing and request handling.
- Reactive LoadBalancer – Client-side load balancing for resilient service calls.
- MySQL – Robust data persistence layer.
- Postman-Tested – All endpoints verified through Postman.
- Data Seeder Microservice – Automated, realistic test data generation for customers and accounts.
- DataFaker Library – Authentic, randomized data for development and testing.
- Batch Processing – Bulk creation with configurable batch sizes.
- CSV Export – Generates customer, account, and JMeter-ready datasets.
- Circuit Breaker (Resilience4j) – Fault tolerance for robust operations.
- WebFlux – Non-blocking, reactive endpoints for high performance.
- API Request Collections – Ready-to-use HTTP and REST files for IntelliJ, VS Code, and Postman.
- JMeter Performance and load Test – Automated performance and load testing with multiple scenarios and reporting.
- Shell Scripts – One-command execution for test automation and reporting.
The platform is designed for horizontal scalability and easy integration of new services. Planned enhancements include:
- Eureka Server for service discovery and dynamic registration.
- Spring Cloud Gateway to handle routing, filtering, and authorization.
- Reactive LoadBalancer to distribute requests across service instances.
- Data Seeder Service for realistic test data generation and export.
- Performance and load Testing with JMeter automation.
- Token-based Authentication for secure access control (future).
- Centralized Configuration using Spring Cloud Config (future enhancement).
MicroBank360 aims to be a production-grade, extensible microservice banking application reflecting real-world enterprise architecture practices.
This project contains two microservices built using Java, Spring Boot:
- Customer Service: Handles operations related to customer data.
- Account Service: Manages account data and balance updates.
Both services use Spring Data JPA with MySQL for persistent storage.
- Backend: Java, Spring Boot, Spring Data JPA
- Database: MySQL
- Build Tool: Maven
- Dependencies: Spring Web, Spring Data JPA, MySQL Connector, Lombok(there are further dependencies that i will update below)
- Testing API: Postman
- Version Control: GitHub
- Other Tools: IntelliJ IDEA, MySQL Workbench
| Method | Endpoint | Description |
|---|---|---|
| GET | /customer | Get all customers(Updated: Along with account info) |
| GET | /customer/{id} | Get customer by ID(Updated: Along with their account info) |
| POST | /customer | Create a new customer |
| PUT | /customer/{id} | Update a customer's data by ID |
| DELETE | /customer/{id} | Delete a customer by ID |
| Method | Endpoint | Description |
|---|---|---|
| GET | /account | Get all accounts |
| GET | /account/{id} | Get account by ID |
| POST | /account | Create a new account |
| PUT | /account/{id}/{balance} | Update account balance by ID |
| DELETE | /account/{id} | Delete account by ID |
| GET | /account/customer/{customerId} | Get all accounts by customer ID |
Clone all services from GitHub:
git clone https://github.com/PritiAryal/MicroBank360.gitUpdate the following in both services:
spring.datasource.url=jdbc:mysql://localhost:3306/{your_db_name}
spring.datasource.username=your_username
spring.datasource.password=your_passwordOpen both projects in IntelliJ IDEA:
- Ensure JDK 17 or above is selected.
- Run all the main classes of each services such as(you can also run multiple instances of same service to see how load balancing works):
CustomerServiceApplication.javaAccountServiceApplication.java
- Use Postman for making requests to the API.
- Use MySQL Workbench to validate data persistence.
- Ensure MySQL Server is running and the database exists.
- Update port configurations if needed to avoid conflicts.
Request:
GET /customer/Response:
[
{
"id": 2,
"name": "Jane",
"email": "jane@example.com",
"phone": "+0987654321",
"createdAt": "2025-04-29T22:09:45.811707",
"accounts": []
},
{
"id": 3,
"name": "Alice",
"email": "alice@example.com",
"phone": "+1122334455",
"createdAt": "2025-04-29T22:30:50.51107",
"accounts": [
{
"id": 2,
"accountNumber": "ACC1002",
"accountType": "CURRENT",
"balance": 2500.00,
"customerId": 3,
"createdAt": "2025-04-29T22:32:40.04309"
},
{
"id": 3,
"accountNumber": "ACC1001",
"accountType": "SAVINGS",
"balance": 15000.00,
"customerId": 3,
"createdAt": "2025-04-29T23:17:04.860544"
}
]
}
]Request:
GET /customer/3Response:
{
"id": 3,
"name": "Alice",
"email": "alice@example.com",
"phone": "+1122334455",
"createdAt": "2025-04-29T22:30:50.51107",
"accounts": [
{
"id": 2,
"accountNumber": "ACC1002",
"accountType": "CURRENT",
"balance": 2500.00,
"customerId": 3,
"createdAt": "2025-04-29T22:32:40.04309"
},
{
"id": 3,
"accountNumber": "ACC1001",
"accountType": "SAVINGS",
"balance": 15000.00,
"customerId": 3,
"createdAt": "2025-04-29T23:17:04.860544"
}
]
}Request:
POST /customerRequest Body:
{
"name": "Alice",
"email": "alice@example.com",
"phone": "+1122334455"
}Response:
{
"id": 3,
"name": "Alice",
"email": "alice@example.com",
"phone": "+1122334455",
"createdAt": "2025-04-29T12:00:00"
}Request:
PUT /customer/1Request Body:
{
"name": "John Updated",
"email": "johnupdated@example.com",
"phone": "+1234567899"
}Response:
{
"id": 1,
"name": "John Updated",
"email": "johnupdated@example.com",
"phone": "+1234567899",
"createdAt": "2025-04-29T10:00:00"
}Request:
DELETE /customer/1Response:
Customer 1 gets Deleted from Database.
Request:
GET /accountResponse:
[
{
"id": 1,
"accountNumber": "ACC1001",
"accountType": "SAVINGS",
"balance": 1500.00,
"customerId": 1,
"createdAt": "2025-04-29T10:30:00"
},
{
"id": 2,
"accountNumber": "ACC1002",
"accountType": "CURRENT",
"balance": 2500.00,
"customerId": 2,
"createdAt": "2025-04-28T16:00:00"
}
]Request:
GET /account/1Response:
{
"id": 1,
"accountNumber": "ACC1001",
"accountType": "SAVINGS",
"balance": 1500.00,
"customerId": 1,
"createdAt": "2025-04-29T10:30:00"
}Request:
POST /accountRequest Body:
{
"accountNumber": "ACC1003",
"accountType": "SAVINGS",
"balance": 3000.00,
"customerId": 1
}Response:
{
"id": 3,
"accountNumber": "ACC1003",
"accountType": "SAVINGS",
"balance": 3000.00,
"customerId": 1,
"createdAt": "2025-04-29T12:30:00"
}Request:
PUT /account/1/15000Response:
{
"id": 1,
"accountNumber": "ACC1001",
"accountType": "SAVINGS",
"balance": 15000.00,
"customerId": 1,
"createdAt": "2025-04-29T10:30:00"
}Request:
DELETE /account/1Response:
Account 1 gets Deleted from Database.
Request:
GET /account/customer/1Response:
[
{
"id": 1,
"accountNumber": "ACC1001",
"accountType": "SAVINGS",
"balance": 15000.00,
"customerId": 1,
"createdAt": "2025-04-29T10:30:00"
},
{
"id": 3,
"accountNumber": "ACC1003",
"accountType": "SAVINGS",
"balance": 3000.00,
"customerId": 1,
"createdAt": "2025-04-29T12:30:00"
}
]The Registry Service acts as the service discovery server for the MicroBank360 platform. Built using Spring Cloud Netflix Eureka, it enables all microservices to register themselves at runtime and discover each other without hard-coded hostnames or ports.
- Centralized Service Discovery
- Dynamic registration and de-registration of microservices
- Enables client-side load balancing (via OpenFeign and Spring Cloud LoadBalancer)
- Simplifies inter-service communication
- When microservices (like Customer Service or Account Service) start, they register themselves to the Eureka server.
- Other services can then discover these instances dynamically using their service name.
- Eureka keeps a heartbeat to remove inactive services.
- Spring Web
- Spring Cloud Discovery - Eureka Server
- Spring Cloud OpenFeign
- Spring Cloud LoadBalancer
- Eureka Discovery Client - Spring Cloud Discovery
The API Gateway serves as the single entry point for all client requests. It routes requests to the appropriate microservice (e.g., Account Service, Customer Service) and handles concerns like routing, load balancing, and service discovery.
- Reactive Gateway - Spring Cloud Routing
- Eureka Discovery Client - Spring Cloud Discovery
- Spring Boot Actuator - OPS
- Route incoming requests to corresponding microservices based on configured paths
- Enable client-side load balancing using Spring Cloud LoadBalancer
- Discover services dynamically via Eureka Server
- Centralize cross-cutting concerns (e.g., logging, authentication, rate limiting – to be added as needed)
/customer/**→ routed to Customer Service/account/**→ routed to Account Service
The Data Seeder Service is a dedicated microservice designed to generate realistic test data for performance testing and development environments. It provides API-based data generation with export capabilities for JMeter testing.
- API-Based Data Generation: RESTful endpoints for creating customers and accounts
- Realistic Data: Uses DataFaker library for generating authentic-looking test data
- Batch Processing: Supports bulk creation with configurable batch sizes
- Export Capabilities: Generates CSV files optimized for JMeter consumption
- Circuit Breaker: Resilience4j integration for fault tolerance
- Service Discovery: Integrates with Eureka for dynamic service communication
- Reactive Programming: Uses WebFlux for non-blocking, asynchronous operations
sequenceDiagram
participant Client
participant Gateway
participant DataSeeder
participant CircuitBreaker
participant CustomerService
participant AccountService
participant DataFaker
Client->>Gateway: POST /seed/full-dataset?customerCount=1000
Gateway->>DataSeeder: Route via lb://DATA-SEEDER-SERVICE
DataSeeder->>DataFaker: Generate realistic customer data
DataFaker-->>DataSeeder: CustomerRequest objects
DataSeeder->>DataSeeder: Process in batches (100 records)
DataSeeder->>CircuitBreaker: WebClient.post() to Customer Service
CircuitBreaker->>CustomerService: Batch customer creation
CustomerService-->>CircuitBreaker: CustomerResponse objects
CircuitBreaker-->>DataSeeder: Success/Fallback response
DataSeeder->>DataFaker: Generate account data for customers
DataFaker-->>DataSeeder: AccountRequest objects
DataSeeder->>CircuitBreaker: WebClient.post() to Account Service
CircuitBreaker->>AccountService: Batch account creation
AccountService-->>CircuitBreaker: AccountResponse objects
CircuitBreaker-->>DataSeeder: Success/Fallback response
DataSeeder-->>Gateway: Combined dataset with metrics
Gateway-->>Client: Complete response with execution time
sequenceDiagram
participant Client
participant APIGateway
participant DataSeeder
participant CircuitBreaker as Circuit Breaker
participant CustomerServiceClient
participant AccountServiceClient
participant CustomerService
participant AccountService
participant CustomerDB as Customer Database
participant AccountDB as Account Database
participant DataFaker
Note over DataSeeder: Three Main Operations:<br>1. Generate Customers<br>2. Generate Accounts for Existing Customers<br>3. Full Dataset Generation
%% Operation 1: Generate New Customers
rect rgb(200, 230, 255)
Note over Client, DataFaker: Scenario 1: Generate New Customers
Client->>APIGateway: POST /seed/customers/500
APIGateway->>DataSeeder: Route to DATA-SEEDER-SERVICE
DataSeeder->>DataSeeder: Check usedEmails Set (in-memory)
DataSeeder->>DataFaker: Generate unique customer data
DataFaker-->>DataSeeder: CustomerRequest objects (batch of 100)
loop Batch Processing (500 customers in batches of 100)
DataSeeder->>CustomerServiceClient: createCustomersBatch : List CustomerRequest
CustomerServiceClient->>CircuitBreaker: Apply circuit breaker protection
CircuitBreaker->>CustomerService: POST /customer (WebClient)
CustomerService->>CustomerDB: INSERT INTO customers
CustomerDB-->>CustomerService: Customer saved with ID
CustomerService-->>CircuitBreaker: CustomerResponse
CircuitBreaker-->>CustomerServiceClient: Success/Fallback
CustomerServiceClient-->>DataSeeder: List CustomerResponse
DataSeeder->>DataSeeder: delayElement(10ms) - Rate limiting
end
DataSeeder-->>APIGateway: Success response with count & metrics
APIGateway-->>Client: 500 customers created
end
%% Operation 2: Generate Accounts for Existing Customers ONLY
rect rgb(200, 255, 200)
Note over Client, DataFaker: Scenario 2: Accounts for Existing Customers ONLY
Client->>APIGateway: POST /seed/accounts?minAccountsPerCustomer=1&maxAccountsPerCustomer=3
APIGateway->>DataSeeder: Route to DATA-SEEDER-SERVICE
%% First: Fetch ALL existing customer IDs
DataSeeder->>CustomerServiceClient: getAllCustomerIds()
CustomerServiceClient->>CustomerService: GET /customer (WebClient)
CustomerService->>CustomerDB: SELECT * FROM customers
CustomerDB-->>CustomerService: All existing customers
CustomerService-->>CustomerServiceClient: Flux CustomerResponse
CustomerServiceClient->>CustomerServiceClient: .map(CustomerResponse::getId)
CustomerServiceClient-->>DataSeeder: Flux Long customerIds
DataSeeder->>DataSeeder: .collectList() to List Long customerIds
alt No existing customers found
DataSeeder-->>APIGateway: customersProcessed: 0, accountsGenerated: 0, message: No existing customers found
else Existing customers found
loop For each existing customer ID
DataSeeder->>DataSeeder: Generate random account count (1-3)
DataSeeder->>DataFaker: Generate account data for customerId
DataFaker-->>DataSeeder: AccountRequest with customerId
DataSeeder->>DataSeeder: Check usedAccountNumbers Set
end
loop Batch Processing (accounts in batches of 100)
DataSeeder->>AccountServiceClient: createAccountsBatch : List AccountRequest
AccountServiceClient->>CircuitBreaker: Apply circuit breaker protection
CircuitBreaker->>AccountService: POST /account WebClient
AccountService->>AccountDB: INSERT INTO accounts with customerId FK
AccountDB-->>AccountService: Account saved with ID
AccountService-->>CircuitBreaker: AccountResponse
CircuitBreaker-->>AccountServiceClient: Success/Fallback
AccountServiceClient-->>DataSeeder: List AccountResponse
DataSeeder->>DataSeeder: delayElement(10ms) - Rate limiting
end
DataSeeder-->>APIGateway: customersProcessed: X, accountsGenerated: Y
end
APIGateway-->>Client: Accounts created for existing customers only
end
%% Operation 3: Full Dataset Generation
rect rgb(255, 200, 200)
Note over Client, DataFaker: Scenario 3: Full Dataset Generation
Client->>APIGateway: POST /seed/full-dataset?customerCount=1000&minAccountsPerCustomer=1&maxAccountsPerCustomer=4
APIGateway->>DataSeeder: Route to DATA-SEEDER-SERVICE
%% Step 1: Generate customers first
DataSeeder->>DataSeeder: generateCustomers(1000)
Note over DataSeeder, CustomerService: (Same process as Scenario 1)
DataSeeder->>DataSeeder: Extract customerIds from created customers
%% Step 2: Generate accounts for the newly created customers
DataSeeder->>DataSeeder: generateAccountsForCustomers(customerIds, 1, 4)
loop For each new customer ID
DataSeeder->>DataFaker: Generate 1-4 accounts per customer
DataFaker-->>DataSeeder: AccountRequest objects with customerId
end
loop Batch Processing
DataSeeder->>AccountServiceClient: createAccountsBatch List AccountRequest
AccountServiceClient->>AccountService: POST /account
AccountService->>AccountDB: INSERT accounts with FK to customers
AccountDB-->>AccountService: Success
AccountService-->>DataSeeder: AccountResponse objects
end
DataSeeder-->>APIGateway: Complete dataset metrics
APIGateway-->>Client: Full dataset created
end
%% Data Export Operations
rect rgb(255, 255, 200)
Note over Client, AccountDB: Data Export Operations
Client->>APIGateway: GET /seed/export/jmeter-data.csv
APIGateway->>DataSeeder: Route request
%% Fetch existing data for export
par Parallel Data Fetching
DataSeeder->>CustomerServiceClient: getAllCustomers()
CustomerServiceClient->>CustomerService: GET /customer
CustomerService->>CustomerDB: SELECT * FROM customers
CustomerDB-->>CustomerService: All customers
CustomerService-->>DataSeeder: List CustomerResponse
and
DataSeeder->>AccountServiceClient: getAllAccounts()
AccountServiceClient->>AccountService: GET /account
AccountService->>AccountDB: SELECT * FROM accounts
AccountDB-->>AccountService: All accounts
AccountService-->>DataSeeder: List AccountResponse
end
DataSeeder->>DataSeeder: Join customer and account data
DataSeeder->>DataSeeder: Generate CSV with customer-account relationships
DataSeeder-->>APIGateway: CSV file content
APIGateway-->>Client: Download jmeter_testdata.csv
end
%% Key Constraints and Validations
Note over DataSeeder: Key Business Rules:<br>✓ Accounts ONLY created for existing customers<br>✓ Unique email constraint (usedEmails Set)<br>✓ Unique account numbers (usedAccountNumbers Set)<br>✓ Circuit breaker protection on all service calls<br>✓ Retry with exponential backoff (3 attempts, 1s delay)<br>✓ Rate limiting with 10ms delays<br>✓ Batch processing (100 customers, 100 accounts per batch)
- Port: 8088
- Service Name: DATA-SEEDER-SERVICE
- Database: Communicates with existing Customer and Account services
- Circuit Breaker: Configured with Resilience4j for fault tolerance
- Spring Boot Web & WebFlux
- Spring Cloud Netflix Eureka Client
- Spring Cloud Circuit Breaker (Resilience4j)
- Spring Cloud LoadBalancer
- DataFaker (for realistic data generation)
- OpenCSV (for CSV export functionality)
| Method | Endpoint | Description |
|---|---|---|
| POST | /seed/customers/{count} |
Generate specified number of customers |
| POST | /seed/accounts |
Generate accounts for existing customers |
| POST | /seed/full-dataset |
Generate complete dataset (customers + accounts) |
| GET | /seed/export/jmeter-data.csv |
Export JMeter-ready combined data as CSV |
| GET | /seed/export/customers.csv |
Export all customers as CSV |
| GET | /seed/export/accounts.csv |
Export all accounts as CSV |
| GET | /seed/stats |
Get seeding statistics |
| GET | /seed/health |
Health check endpoint |
| DELETE | /seed/cleanup |
Clean up all seeded data |
- Production Safety: No seeding code in business services
- Performance Testing Ready: Optimized for JMeter data consumption
- Industry Standards: Follows microservice best practices
- Separation of Concerns: Centralized data generation logic
- Fault Tolerance: Circuit breaker patterns for resilient operations
The apiRequests directory contains organized HTTP request collections for testing all microservices. These collections provide ready-to-use API calls for development and testing.
The seed.http file contains comprehensive API requests for the Data Seeder Service:
Generate Customers:
### Seed 500 customers
POST http://localhost:8085/seed/customers/250
Content-Type: application/jsonGenerate Accounts:
### Seed accounts for existing customers
POST http://localhost:8085/seed/accounts?minAccountsPerCustomer=1&maxAccountsPerCustomer=2
Content-Type: application/jsonGenerate Full Dataset:
### Seed full dataset
POST http://localhost:8085/seed/full-dataset?customerCount=300&minAccountsPerCustomer=1&maxAccountsPerCustomer=2
Content-Type: application/jsonExport Data for JMeter:
### Export combined JMeter-ready test data as CSV
GET http://localhost:8085/seed/export/jmeter-data.csv
Accept: text/csvStatistics Check:
### Statistics check
GET http://localhost:8085/seed/stat
Accept: application/jsonCleanup Seeded Data:
### Cleanup all seeded data
DELETE http://localhost:8085/seed/cleanup- Compatible with IntelliJ IDEA HTTP Client
- Compatible with VS Code REST Client extension
- Ready-to-execute requests for rapid development and testing
The jmeter-tests directory contains a comprehensive performance and load testing suite designed for the MicroBank360 banking platform.
- Professional Test Scripts: Industry-standard JMeter test plans
- Multiple Test Scenarios: Baseline, Load, Stress, and Spike testing
- Automated Execution: Shell scripts for different testing scenarios
- Realistic Data Sets: CSV files with banking test data
- Comprehensive Reporting: Detailed performance metrics and HTML reports
- Configurable Parameters: Flexible test configuration via command-line parameters
- microbank360-performance-test.jmx
- Main professional performance and load test suite
- Configurable parameters (threads, duration, ramp-up)
- Supports multiple test scenarios
- foolproof-test.jmx
- Simple test for validation
- Basic health checks and API calls
- run-microbank360-tests.sh
- Comprehensive test runner with multiple scenarios
- Professional reporting and metrics
- Supports baseline, load, stress, and spike tests
- quick-microbank360-test.sh
- Quick validation testing
- Minimal setup for rapid feedback
- customers.csv - Sample customer data with realistic information
- accounts.csv - Account data with various account types and balances
- jmeter_testdata.csv - Combined customer-account data for JMeter consumption
| Scenario | Virtual Users | Duration | Ramp-up | Expected TPS | Description |
|---|---|---|---|---|---|
| Baseline | 10 | 180s | 30s | 5 | Minimal load baseline |
| Load | 25 | 300s | 60s | 15 | Normal production load |
| Stress | 100 | 300s | 90s | 50 | High stress testing |
| Spike | 200 | 120s | 20s | 100 | Traffic spike simulation |
The performance tests cover critical banking endpoints:
- Health Checks:
/seed/health - Customer Operations:
/customer/{id} - Account Operations:
/account/{id} - Customer-Account Relations: Various customer and account combinations
- Real-time Metrics: Live performance monitoring during test execution
- CSV Results: Raw data for detailed analysis
- Pass/Fail Criteria: Automated test validation with success thresholds
- Progress Tracking: Real-time test execution progress
- Error Handling: Robust error detection and reporting
- Configurable Thresholds: Customizable success criteria
- Batch Processing: Efficient handling of large test datasets
git clone https://github.com/PritiAryal/MicroBank360.git
cd MicroBank360Update the following in all service application.properties files:
spring.datasource.url=jdbc:mysql://localhost:3306/{your_db_name}
spring.datasource.username=your_username
spring.datasource.password=your_passwordStart services in the following order:
-
Registry Service (Eureka Server)
cd registryService mvn spring-boot:run -
Customer Service
cd customerService mvn spring-boot:run -
Account Service
cd accountService mvn spring-boot:run -
API Gateway
cd gatewayService mvn spring-boot:run -
Data Seeder Service
cd dataSeederService mvn spring-boot:run
Use the Data Seeder Service to populate your database:
POST http://localhost:8088/seed/full-dataset?customerCount=100&minAccountsPerCustomer=1&maxAccountsPerCustomer=3Make sure Jmeter is installed and Navigate to the jmeter-tests directory and run:
cd jmeter-tests
./run-microbank360-tests.sh- Use the HTTP files in apiRequests directory with IntelliJ IDEA or VS Code
- Use Postman for manual API testing
- Check Eureka Dashboard at http://localhost:8761 for service registration
| Service | Port |
|---|---|
| Registry Service (Eureka) | 8761 |
| Customer Service | 8082 |
| Account Service | 8080 |
| API Gateway | 8084 |
| Data Seeder Service | 8088 |
- Ensure MySQL Server is running and databases exist
- All services will register with Eureka automatically
- API Gateway provides unified access to all services
- Use Data Seeder Service for generating realistic test data
- Performance and load tests require JMeter to be installed or available in the jmeter-tests directory




























