All Projects
BackendDeployment

Microservices Architecture (Spring Boot)

Production microservices: Spring Boot, Apache Kafka event streaming, OAuth2/Keycloak auth, gRPC inter-service calls, API gateway, Docker. Event-driven design with per-service PostgreSQL isolation.

Approach

Event-driven Kafka + Keycloak OAuth2 + gRPC sync calls + Spring Cloud Gateway

Tech Stack
JavaSpring BootApache KafkaKeycloakgRPCDockerPostgreSQL
Keywords
Spring BootKafkaKeycloakgRPCDockerJavaMicroservices
Deep Dive

Production microservices system with event-driven architecture.

Service Topology

Client → Spring Cloud Gateway (API gateway)
  → Keycloak (OAuth2/OIDC auth)
  → Service A ←→ Kafka ←→ Service B
  → Service C --gRPC--> Service D
  → PostgreSQL (per-service DB isolation)

Key Decisions

ProblemSolutionRationale
Async communicationApache KafkaDecoupling + durability + replay
Sync internal callsgRPCTyped contracts + 5–10× faster than REST
AuthenticationKeycloak OAuth2Centralized, industry-standard
Service routingSpring Cloud GatewayFilter chains + circuit breaking

Kafka Events OrderCreated, PaymentProcessed, InventoryUpdated — 7-day retention enables service replay after failures.

gRPC vs REST

  • Internal (service→service): gRPC (binary, typed, fast)
  • External (browser→gateway): REST/JSON (compatibility, debuggability)

Keycloak OAuth2 JWT tokens with service-level scopes. Service accounts for machine-to-machine auth. Token introspection at gateway — no per-service auth logic.