This project demonstrates a complete e-commerce application integrated with a banking system using Spring Cloud OpenFeign for microservices communication.
- EcommerceApp (Port 8081): Main e-commerce application
- BankApp (Port 8080): Banking service for payment processing
- Integration: OpenFeign client for seamless communication
MacOS
brew services start zookeeper
brew services start kafka
kafka-topics --create --topic test --bootstrap-server localhost:9092 --partitions 2 --replication-factor 1
# Verify topics
kafka-topics --list --bootstrap-server localhost:9092-
User Registration & Login
- User registration with bank account linking
- Authentication system
- User profile management
-
Product Management
- Product catalog with categories
- Search functionality (works with/without login)
- Stock management
-
Shopping Cart
- Add/remove products
- Quantity management
- Cart total calculation
-
Purchase System
- Order creation with bank verification
- Payment processing via OpenFeign
- Order status tracking
-
Dashboard Analytics
- Monthly order reports
- Date range filtering
- Purchase history
-
Account Verification
- Verify customer bank account exists
- Real-time account validation
-
Payment Processing
- Check sufficient funds before purchase
- Transfer funds from customer to e-commerce account
- Transaction ID tracking
@FeignClient(name = "bank-service", url = "${bank.service.url}")
public interface BankServiceClient {
@GetMapping("/api/accounts/{accountNumber}")
ResponseEntity<Account> getAccountByNumber(@PathVariable String accountNumber);
@PostMapping("/api/transfers")
ResponseEntity<Transaction> transferFunds(@RequestBody TransferRequest request);
}POST /api/users/register- Register new userPOST /api/users/login- User loginGET /api/users/{id}- Get user details
GET /api/products- Get all productsGET /api/products/search?keyword={keyword}- Search productsGET /api/products/category/{category}- Get products by category
POST /api/cart/add- Add product to cartGET /api/cart/user/{userId}- Get cart itemsDELETE /api/cart/remove/{cartItemId}- Remove from cart
POST /api/orders/purchase/{userId}- Purchase cart itemsGET /api/orders/user/{userId}- Get user ordersGET /api/orders/dashboard/{userId}- Get monthly dashboard
GET /api/demo/complete-flow- Demonstrate full e-commerce flowGET /api/demo/features-overview- List all featuresGET /api/demo/test-bank-connectivity- Test bank integration
cd BankApp
mvn spring-boot:runcd ecommerceapp
mvn spring-boot:runcurl http://localhost:8081/api/demo/complete-flowcurl http://localhost:8081/api/demo/test-bank-connectivity- ECM001: E-commerce company account (receives payments)
- CUST001: John Doe - $1000.00 balance
- CUST002: Jane Smith - $750.00 balance
- Classic Denim Jacket - $79.99
- Cotton T-Shirt - $24.99
- Skinny Jeans - $59.99
- Summer Dress - $89.99
- Sneakers - $99.99
- Register User: Create user with bank account CUST001
- Login: Authenticate user
- Search Products: Find products by keyword
- Add to Cart: Add selected products
- Verify Bank Account: Check account exists and has funds
- Purchase: Process payment via OpenFeign integration
- Dashboard: View purchase history
- Bank service connectivity issues
- Insufficient funds validation
- Stock availability checks
- Invalid account number handling
- Spring Boot 3.5.3
- Spring Cloud OpenFeign
- Spring Data JPA
- H2 Database
- Lombok
- Maven
Both applications use H2 in-memory databases:
- BankApp: jdbc:h2:mem:test
- EcommerceApp: jdbc:h2:mem:ecommerce
Access H2 consoles:
- BankApp: http://localhost:8080/h2-console
- EcommerceApp: http://localhost:8081/h2-console