How dragon-slayer99/microservice_ecommerce works
1. Overall shape
This is a Spring Boot microservices e-commerce platform with a thin React frontend and five backend support services. The backend is split into infrastructure services, business-domain services, and a gateway that is the primary ingress point.
2. Request entry path
All external client traffic is intended to go through the API Gateway on port 8080. The gateway is responsible for routing and JWT-based request filtering before traffic reaches the domain services. This makes the gateway the main boundary between untrusted client traffic and internal service-to-service calls.
3. Infrastructure layer
There are two core platform services:
• Config Server for centralized configuration.
• Eureka Server for service discovery and registration.
Each microservice has its own application.yml / application.yaml, and the README indicates they are meant to pull shared config from the config server and locate one another through Eureka.
4. Identity and access boundary
The User Service owns authentication and user lifecycle concerns. Its structure includes login/register/refresh DTOs, a RefreshToken model, JWT utilities, and a Spring Security config. That suggests it issues and refreshes tokens, persists refresh tokens, and exposes both user and admin-facing endpoints.
5. API Gateway security
The gateway contains a JwtAuthFilter and JwtUtil, which means it validates or inspects JWTs before forwarding requests. This creates a clear security boundary: token issuance lives in the user service, while token enforcement happens at the edge.
6. Product domain
The Product Service is the catalog subsystem. It is structurally simple: controller, service, repository, Product entity, and DTOs. It appears to own product persistence and product CRUD/business logic without depending on other domain services.
7. Cart domain
The Cart Service owns user-specific cart state. It has Cart and CartItem entities plus repositories, and exposes cart operations through CartController and CartService. It also uses a Feign client to call the Product Service, with a fallback implementation, so cart operations can enrich or validate items against product data.
8. Order domain
The Order Service coordinates checkout and order lifecycle. It has Order and OrderItem entities, repositories, and DTOs for placing orders and changing order status. It depends on both the Cart Service and Product Service through Feign clients, again with fallbacks, which makes order placement a cross-service orchestration flow.
9. Service-to-service communication
Internal communication is done with Spring Cloud OpenFeign. The presence of FeignConfig and fallback clients in cart/order/user services shows that these services are synchronous consumers of other services and are designed to degrade gracefully if a dependency is unavailable. That is an important architectural boundary for resilience.
10. Data ownership
Each business service owns its own persistence model and repository layer, which implies database-per-service ownership rather than a shared application database. The README calls out separate PostgreSQL databases per service, and the db/init.sql script supports initial provisioning. This keeps domain data isolated across services.
11. Frontend boundary
The ecommerce_frontend directory is a separate React SPA that talks to the backend through the gateway. It is not part of the Spring runtime, but it is the user-facing presentation layer and should be shown as a client tier consuming the gateway API.
12. Delivery and runtime
The repo is designed for containerized deployment. Each service has its own Dockerfile, the root docker-compose.yml orchestrates the stack, and Jenkinsfile defines CI/CD. So the practical deployment unit is the containerized service, not a monolith process.
13. What to show in a diagram
A good architecture diagram should emphasize:
• frontend → API Gateway
• API Gateway → user/product/cart/order services
• user service ↔ token management / auth boundary
• cart/order services → product service and cart/order persistence
• config server and Eureka as shared platform dependencies
• separate database per service
• fallback paths on Feign-based service calls
14. Main architectural style
This is a classic Spring Cloud microservice system: centralized configuration, service discovery, gateway-based ingress, JWT security, and domain-owned persistence. The important diagram boundaries are not just the services themselves, but the contracts between them: auth, catalog lookup, cart orchestration, and order orchestration.
Main entry points: ApiGatewayApplication.java API Gateway · docker-compose.yml Compose Stack · OrderServiceApplication.java Order Service · UserServiceApplication.java User Service
Components 19
Client tier
User-facing frontend and external traffic entry
- Frontend · Thin browser client that talks to backend APIs through the gateway
ecommerce_frontend
Edge layer
Gateway and request filtering boundary
- API Gateway · Primary ingress that routes requests and enforces JWT checks
api-gateway/src/main/java/com/techouts/api_gateway/ApiGatewayApplication.java - JWT Filter · Edge filter that validates or inspects bearer tokens before routing
api-gateway/src/main/java/com/techouts/api_gateway/filter/JwtAuthFilter.java - JWT Util · Gateway-side token utility used by the request filter
api-gateway/src/main/java/com/techouts/api_gateway/utils/JwtUtil.java
Platform services
Shared discovery and configuration infrastructure
- Config Server · Centralized external configuration source for the services
config-server/src/main/java/com/techouts/config_server/ConfigServerApplication.java - Eureka Server · Discovery registry for locating services at runtime
eureka-server/src/main/java/com/techouts/eureka_server/EurekaServerApplication.java
Identity boundary
Authentication, authorization, and token lifecycle
- User Service · Owns login, registration, refresh tokens, and user/admin endpoints
user-service/src/main/java/com/techouts/user_service/UserServiceApplication.java - Security Config · Spring Security setup for authentication and protected endpoints
user-service/src/main/java/com/techouts/user_service/config/SecurityConfig.java - JWT Util · User-service token generation and refresh support
user-service/src/main/java/com/techouts/user_service/utils/JwtUtil.java - Refresh Token · Persistent refresh-token entity backing token renewal
user-service/src/main/java/com/techouts/user_service/model/RefreshToken.java - Product Client · User-side client for product-related admin or supporting calls
user-service/src/main/java/com/techouts/user_service/feignclient/ProductClient.java
Commerce services
Catalog, cart, and order domain services
- Product Service · Catalog persistence and product CRUD/business logic
product-service/src/main/java/com/techouts/product_service/ProductServiceApplication.java - Cart Service · Manages per-user cart state and item operations
cart-service/src/main/java/com/techouts/cart_service/CartServiceApplication.java - Product Client · Cart-side synchronous client to look up product data
cart-service/src/main/java/com/techouts/cart_service/feignclient/ProductClient.java - Order Service · Coordinates checkout, order creation, and status changes
order-service/src/main/java/com/techouts/order_service/OrderServiceApplication.java - Cart Client · Order-side client used to read cart contents during checkout
order-service/src/main/java/com/techouts/order_service/feignclient/CartClient.java - Product Client · Order-side client used to validate or enrich order items
order-service/src/main/java/com/techouts/order_service/feignclient/ProductClient.java
Delivery
Containerized deployment and CI/CD
- Compose Stack · Container orchestration for the full microservice stack
docker-compose.yml - Jenkinsfile · Pipeline definition for building and delivering the system
Jenkinsfile
Connections 35
- Frontend → API Gateway: API calls · Browser traffic is intended to flow through the gateway
- API Gateway → JWT Filter: filters · Gateway applies JWT-based request filtering before routing
- JWT Filter → JWT Util: validates · Filter relies on token utility for JWT parsing and checks
- API Gateway → User Service: routes auth · Login and registration traffic is routed to the user service
- API Gateway → Product Service: routes catalog · Gateway forwards catalog requests to the product service
- API Gateway → Cart Service: routes cart · Gateway forwards cart requests to the cart service
- API Gateway → Order Service: routes orders · Gateway forwards order and checkout requests to the order service
- Config Server → API Gateway: shared config · Gateway is expected to consume centralized configuration
- Config Server → User Service: shared config · User service consumes centralized configuration
- Config Server → Product Service: shared config · Product service consumes centralized configuration
- Config Server → Cart Service: shared config · Cart service consumes centralized configuration
- Config Server → Order Service: shared config · Order service consumes centralized configuration
- Eureka Server → API Gateway: registry · Gateway participates in service discovery
- Eureka Server → User Service: registry · User service registers for discovery
- Eureka Server → Product Service: registry · Product service registers for discovery
- Eureka Server → Cart Service: registry · Cart service registers for discovery
- Eureka Server → Order Service: registry · Order service registers for discovery
- User Service → Security Config: uses · Security config governs authentication and endpoint access
- User Service → JWT Util: issues tokens · User service uses JWT utilities to generate and refresh tokens
- User Service → Refresh Token: persists · Refresh tokens are stored as part of auth lifecycle
- Cart Service → Product Client: calls product · Cart service enriches or validates items through product lookups
- Cart Service → Product Service: fallback path · Cart operations depend on product data and degrade through fallback clients
- Order Service → Cart Client: reads cart · Order placement pulls cart contents through Feign
- Order Service → Product Client: validates items · Order placement consults product data through Feign
- Order Service → Cart Service: orchestrates · Order service depends on cart state during checkout
- Order Service → Product Service: orchestrates · Order service depends on catalog data during checkout
- Product Client → Product Service: calls catalog · User service has a supporting Feign integration to product data
- Compose Stack → API Gateway: runs · Compose stack includes the gateway container
- Compose Stack → User Service: runs · Compose stack includes the user service container
- Compose Stack → Product Service: runs · Compose stack includes the product service container
- Compose Stack → Cart Service: runs · Compose stack includes the cart service container
- Compose Stack → Order Service: runs · Compose stack includes the order service container
- Compose Stack → Config Server: runs · Compose stack includes the config server container
- Compose Stack → Eureka Server: runs · Compose stack includes the discovery server container
- Jenkinsfile → Compose Stack: builds · CI/CD pipeline supports containerized delivery of the stack