How goodnyong/high-tension works
1. This is a Gradle multi-module MSA commerce platform, not a single application. Each business capability is its own Spring Boot service, and most services follow the same four-layer boundary: presentation, application, domain, infrastructure. The repo also includes platform modules for central config and service discovery/registry.
2. The edge entry point is the Gateway service. It handles JWT authentication, token blacklist checks, request rate limiting, circuit breaking, timeout protection, and header propagation of user identity/role into downstream services. It also exposes fallback endpoints, so most external traffic is expected to pass through it before reaching any business service.
3. The Config service centralizes runtime configuration. Its config-repo holds per-service YAML files for cart, coupon, order, payment, product, user, orchestration, and external services, which means deploy-time behavior is externally managed rather than embedded inside each service jar.
4. The User service is the identity and access backbone. It owns login, signup, refresh tokens, RBAC, passkey/WebAuthn flows, and internal user lookup APIs. It persists users, passkeys, and passkey challenges in relational storage, uses Redis for token/security-related state, and provides a Feign-based client path to the Coupon service for user coupon views.
5. The Order service owns the order aggregate and order items. It creates and updates orders locally, then participates in the larger checkout flow through Kafka events and Feign clients to Coupon, Product, and Payment. Its domain model separates order-level status from item-level status so partial cancellation and shipping-state tracking are possible.
6. The Orchestration service is the saga coordinator for order creation. It keeps saga state in its own store, consumes step outcome events, and publishes the next command or a compensation command based on success/failure. This is the central place where order creation, stock deduction, payment, coupon usage, and rollback are wired together.
7. The Product service owns product catalog and stock management. It uses JPA for product/stock persistence, Redis for caching and distributed locking, and Kafka for stock deduction/restore commands and results. It also has outbox and deduplication pieces to keep stock changes safe under retries and duplicate saga messages.
8. The Payment service owns payment records, payment saga state, and outbox publishing. It integrates with the Iamport PG through outbound adapters, verifies webhook data against the PG response, and then emits payment completion events to Kafka. It also has a consumer for payment requests coming from the orchestration flow.
9. The Coupon service manages coupon definitions, coupon issues, and coupon usage. It combines JPA, Redis Lua scripting for concurrent first-come issuance, Caffeine for hot coupon metadata caching, and Kafka consumers/producers for async issue/use processing. It also exposes internal APIs and outbound order integration to support coupon validation and restoration inside the saga.
10. The Cart service is the only MongoDB-backed business service. It stores carts as a document with embedded cart items, optimized for frequent read/update access. It also listens for a clear-cart Kafka event so that successful order completion can asynchronously empty the shopper’s cart.
11. The External service is the notification and audit boundary. It consumes Kafka events for order success and system alerts, sends Slack notifications through a Slack API adapter, and stores Slack record history in its own relational model. It is also the place where master-only admin APIs expose Slack notification history and manual notification operations.
12. Cross-cutting reliability is a major architectural concern. Kafka is the main async backbone between services; outbox patterns are used where event loss would be costly; DLQ/retry topics handle transient failures; saga compensation handles business rollback; Redis is used for rate limiting, caches, locks, and token state; and the ELK pipeline collects JSON logs from all services for search, dashboards, and error-to-Slack alerting.
13. From an architecture-diagram perspective, the key data flows are: client traffic enters through Gateway; reads/writes hit the owning service directly; checkout becomes a multi-step saga coordinated by Orchestration over Kafka; payment confirmation comes back via webhook then Kafka; cart cleanup and Slack alerts are event-driven side effects; and logs flow out-of-band into the ELK stack with alerting back into External.
14. The strongest service boundaries are ownership-based: User owns identity, Product owns catalog/stock, Cart owns shopping carts, Order owns order state, Payment owns payment state, Coupon owns coupon lifecycle, Orchestration owns saga state, External owns notifications, and Gateway owns edge policy. That separation is the main thing to preserve in any diagram.
Main entry points: OrderApplication.java Order · CouponApplication.java Coupon · GatewayApplication.java Gateway · PaymentApplication.java Payment
Components 19
Platform
Shared edge and runtime platform services
- Gateway · JWT auth, blacklist, rate limit, circuit breaker, timeout, and header propagation at the traffic edge
gateway/src/main/java/com/high/gateway/GatewayApplication.java - Config · Externalized runtime configuration via config-repo for all services
config/src/main/java/com/high/config/ConfigApplication.java - Server · Service registry / discovery platform module
server/src/main/java/com/high/server/ServerApplication.java
Commerce
Business capability services
- User · Accounts, login, signup, refresh tokens, RBAC, passkeys, and internal user lookup
user/src/main/java/com/high/user/UserApplication.java - Coupon · Coupon definitions, issuance, usage, restoration, and internal validation APIs
coupon/src/main/java/com/high/coupon/CouponApplication.java - Cart · Mongo-backed shopping carts with async clear-cart handling
cart/src/main/java/com/high/cart/CartApplication.java - Order · Order aggregate, order items, status transitions, and checkout-facing APIs
order/src/main/java/com/high/order/OrderApplication.java - Product · Product catalog, stock management, locking, deduplication, and stock saga handling
product/src/main/java/com/high/product/ProductApplication.java - Payment · Payment records, PG integration, webhook verification, outbox, and payment saga state
payment/src/main/java/com/high/payment/PaymentApplication.java - Orchestration · Order-create saga state machine that sequences commands and compensations
orchestration/src/main/java/com/high/orchestration/OrchestrationApplication.java
Operations
Logging, alerting, and admin visibility
- External · Slack notifications, alert history, and admin-facing notification operations
external/src/main/java/com/high/external/ExternalApplication.java - Kafka · Main async backbone for saga steps, side effects, retries, and DLQ handling
- Redis · Used for token state, rate limiting, caches, distributed locks, and concurrent coupon issuance
- SQL stores · Relational databases used by user, order, coupon, payment, product, orchestration, and external
create_schema.sql - MongoDB · Document persistence for carts
cart/src/main/java/com/high/cart/infrastructure/persistence/CartMongoDbRepository.java - Slack API · Outbound adapter used by External service to send notifications
external/src/main/java/com/high/external/infrastructure/client/slcak/SlackApiAdapter.java - Iamport PG · External payment provider integrated by Payment service
payment/src/main/java/com/high/payment/infrastructure/adapter/out/client/IamportClientAdapter.java - ELK · Centralized logs, search, dashboards, and alerting pipeline
filebeat/filebeat.yml - Logstash · Log processing and forwarding stage for service logs
logstash/config/logstash.conf
Connections 45
- Gateway → User: auth traffic · External requests are authenticated at the edge before reaching identity APIs
- Gateway → Order: route traffic · Gateway forwards business traffic to order APIs after policy checks
- Gateway → Cart: route traffic · Gateway fronts cart access for external clients
- Gateway → Coupon: route traffic · Gateway fronts coupon access for external clients
- Gateway → Payment: route traffic · Gateway fronts payment APIs for external clients
- Gateway → Product: route traffic · Gateway fronts product and stock APIs for external clients
- Gateway → External: admin traffic · Admin and operational access passes through edge policy
- Config → User: configures · Central config supplies user-service runtime settings
- Config → Coupon: configures · Central config supplies coupon-service runtime settings
- Config → Order: configures · Central config supplies order-service runtime settings
- Config → Payment: configures · Central config supplies payment-service runtime settings
- Config → Product: configures · Central config supplies product-service runtime settings
- Config → Orchestration: configures · Central config supplies orchestration-service runtime settings
- Kafka → Orchestration: saga events · Saga steps and outcomes flow through Kafka consumers and producers
- Orchestration → Order: create command · Orchestrator issues order creation and rollback commands
- Orchestration → Product: stock command · Orchestrator drives stock deduction and restoration
- Orchestration → Payment: payment command · Orchestrator sends payment request commands and receives results
- Orchestration → Coupon: coupon command · Orchestrator coordinates coupon use and restore steps
- Order → Kafka: publish events · Order emits saga-related events and success/failure messages
- Product → Kafka: publish events · Product publishes stock deduction and restore results with outbox safety
- Payment → Kafka: publish events · Payment emits completion and failure events to the saga
- Coupon → Kafka: publish events · Coupon publishes issue/use events for async processing
- Cart → Kafka: consume clear · Cart listens for clear-cart events after successful checkout
- Payment → Iamport PG: call pg · Payment service verifies and completes charges through the PG adapter
- Payment → User: validate user · Payment uses user lookup/validation during payment flows
- Order → Coupon: lookup coupon · Order consults coupon data during checkout flows
- Order → Product: lookup product · Order consults product data during checkout flows
- Order → Payment: invoke payment · Order integrates with payment during checkout and cancellation flows
- User → Coupon: user coupons · User service has a Feign path for coupon views
- Coupon → Order: order integration · Coupon service validates against order information and restores usage state
- User → Redis: token state · Redis stores token, security, and challenge state for identity flows
- Gateway → Redis: rate limit · Redis backs token buckets and blacklist checks at the edge
- Product → Redis: cache/lock · Redis backs caching, distributed locking, and deduplication support
- Coupon → Redis: issue lock · Redis Lua scripting supports concurrent first-come coupon issuance
- User → SQL stores: persist users · Identity data is stored in relational storage
- Order → SQL stores: persist orders · Order aggregate and items are stored in relational storage
- Coupon → SQL stores: persist coupons · Coupon definitions and issues are stored in relational storage
- Payment → SQL stores: persist payments · Payment records, saga state, and outbox data are stored in relational storage
- Product → SQL stores: persist stock · Product and stock state are stored in relational storage
- Orchestration → SQL stores: persist saga · Saga state is stored in its own relational store
- External → SQL stores: persist slack · Slack notification history is stored relationally
- Cart → MongoDB: persist carts · Carts are stored as MongoDB documents
- External → Slack API: send alerts · External service sends notifications through the Slack adapter
- External → ELK: log output · Operational logs and alerting data flow into ELK
- Logstash → ELK: forward logs · Logstash forwards parsed service logs into the observability stack