case studies / Personal Engineering Project
Event-Driven E-commerce Microservices Architecture
Decoupled microservice cluster powered by Kafka Avro serialization, Keycloak 24 OAuth2 gateway, and Resilience4j circuit breaking.
metrics & scope
context & constraints
Synchronous inter-service HTTP communication creates tight coupling: when inventory verification or payment gateways slow down, order placement threads exhaust connection pools and crash the entire platform.
Order creation response time must remain invariant under downstream dependency outages. Schema modifications between services must be strictly backward and forward compatible.
decision log
1. Asynchronous Event Sourcing with Kafka & Avro
chosen design: Decoupled checkout processing from inventory allocation using Apache Kafka. Events are serialized with Apache Avro schemas registered in Confluent Schema Registry for strict contract validation.
rejected alternative: Considered REST calls with retry policies; rejected because retry storms exacerbate downstream database saturation.
2. Spring Cloud Gateway OAuth2 Resource Server
chosen design: Consolidated authentication and route authorization into an API Gateway acting as a stateless OAuth2 resource server validating JWT tokens issued by Keycloak 24.
rejected alternative: Considered service-to-service mTLS without central gateway; rejected due to high configuration complexity in development environments.
3. Resilience4j Circuit Breakers & Dead Letter Queues
chosen design: Configured circuit breakers with fallback queues: when inventory lookups exceed latency thresholds, orders enter a pending state and inventory is reconciled asynchronously without dropping customer orders.
rejected alternative: Considered failing fast with immediate 503 errors; rejected due to lost customer conversions.