A production-ready microservices platform demonstrating event-driven architecture, asynchronous communication, and distributed systems design patterns using Spring Boot, Apache Kafka, and PostgreSQL.
Client → Order Service → Kafka → Inventory Service
↓ ↓
PostgreSQL PostgreSQL
- Event-Driven Architecture: Asynchronous communication via Apache Kafka
- Microservices: Independently deployable services with separate databases
- RESTful APIs: Clean, well-documented endpoints
- Transaction Management: ACID compliance with Spring @Transactional
- Docker Support: Containerized infrastructure (Kafka, Zookeeper, PostgreSQL)
- Database-Per-Service Pattern: Service autonomy and fault isolation
- Backend: Java 17+, Spring Boot 3.4.0
- Messaging: Apache Kafka 7.4.0
- Database: PostgreSQL 18
- ORM: Spring Data JPA (Hibernate)
- Build Tool: Maven
- Containerization: Docker & Docker Compose
- JDK 17 or higher
- Docker Desktop
- Maven 3.6+
- PostgreSQL 18 (or use Docker)
docker-compose up -dcd order-service
mvn spring-boot:runcd inventory-service
mvn spring-boot:run# Create an order
curl -X POST http://localhost:8080/api/orders \
-H "Content-Type: application/json" \
-d '{
"customerId": "CUST001",
"productId": "PROD123",
"quantity": 5,
"totalPrice": 249.99
}'
# Check inventory
curl http://localhost:8081/api/inventory/PROD123POST /api/orders- Create new orderGET /api/orders- Get all ordersGET /api/orders/{id}- Get order by IDGET /api/orders/customer/{customerId}- Get orders by customerPATCH /api/orders/{id}/status?status=CONFIRMED- Update order status
GET /api/inventory/{productId}- Get inventory for productGET /api/inventory- Get all inventoryPOST /api/inventory?productId=X&initialStock=100- Create inventory
- Client sends POST request to Order Service
- Order Service persists order to PostgreSQL
- Order Service publishes
ORDER_CREATEDevent to Kafka topicorder.events - Inventory Service consumes event from Kafka
- Inventory Service updates inventory in its PostgreSQL database
# List topics
docker exec -it kafka kafka-topics --list --bootstrap-server localhost:9092
# View messages
docker exec -it kafka kafka-console-consumer \
--bootstrap-server localhost:9092 \
--topic order.events \
--from-beginning
# Check consumer groups
docker exec -it kafka kafka-consumer-groups \
--bootstrap-server localhost:9092 \
--describe \
--group inventory-service-group# Run tests
mvn test
# Build
mvn clean installMIT
Ayush Pathak
Contributions welcome! Please open an issue or PR.