How anpk1011/shopnow works
Purpose and Scope
The repository tree is a Shopnow e-commerce system: a React frontend backed by Spring Boot microservices for users, products, and shopping carts. The supplied README describes an unrelated DerScanner DAST deployment bundle; it does not correspond to the checked-in Shopnow paths, so architecture should be derived from the tree.
Entry Points and Deployment
Each backend service is independently buildable/runnable Spring Boot application, containerized with its own Dockerfile. The frontend is a separate Node/React application.
• shopnow-backend/docker-compose.yaml
• shopnow-backend/api-gateway/src/main/java/com/techcareer/apigateway/ApiGatewayApplication.java
• shopnow-frontend/src/index.js
Edge Gateway and Security Boundary
The API gateway is the intended external backend entry point. Its security configuration forms the cross-service request boundary before traffic reaches domain services. Configuration is centrally supplied rather than duplicated in each service.
• shopnow-backend/api-gateway/src/main/java/com/techcareer/apigateway/config/SecurityConfig.java
• shopnow-backend/api-gateway/src/main/resources/application.properties
• shopnow-backend/config-server/src/main/resources/config/api-gateway.yaml
Service Discovery and Central Configuration
A dedicated discovery server supports service registration/location, while the config server publishes service-specific runtime configuration. This separates deployment topology and environment values from application code.
• shopnow-backend/discovery-server/src/main/java/com/techcareer/discoveryserver/DiscoveryServerApplication.java
• shopnow-backend/config-server/src/main/java/com/techcareer/configserver/ConfigServerApplication.java
• shopnow-backend/config-server/src/main/resources/config/product-service.yaml
Product Domain
Product service owns product-facing HTTP endpoints, product entities, persistence access, and business operations. Its controller → service → repository layering is the canonical backend request/data flow.
• shopnow-backend/product-service/src/main/java/com/techcareer/productservice/controller/ProductController.java
• shopnow-backend/product-service/src/main/java/com/techcareer/productservice/service/ProductService.java
• shopnow-backend/product-service/src/main/java/com/techcareer/productservice/repository/ProductRepository.java
User and Cart Domains
User service handles account/authentication-oriented requests and profile updates; cart service manages cart operations and its product/cart persistence model. Both expose domain boundaries through controllers and encapsulate persistence behind repositories.
• shopnow-backend/user-service/src/main/java/com/techcareer/userservice/controller/UserController.java
• shopnow-backend/user-service/src/main/java/com/techcareer/userservice/service/UserService.java
• shopnow-backend/shopping-cart-service/src/main/java/com/techcareer/shoppingcartservice/controller/ShoppingCartController.java
• shopnow-backend/shopping-cart-service/src/main/java/com/techcareer/shoppingcartservice/service/ShoppingCartService.java
Frontend Flow and External Services
The React SPA enters through index.js and composes routes/views in App.js. Redux actions/reducers maintain client state; service modules isolate HTTP calls for authentication, products, carts, and profiles. Keycloak realm export indicates Keycloak is the identity-provider integration; backend services also expose OpenAPI configuration. Docker Compose and per-service Dockerfiles are the material local/container runtime infrastructure.
• shopnow-frontend/src/App.js
• shopnow-frontend/src/store.js
• shopnow-frontend/src/services/AuthService.js
• shopnow-backend/keycloak-realms/realm-export.json
Main entry points: ApiGatewayApplication.java API gateway · DiscoveryServerApplication.java Discovery server · App.js Routes and views · SecurityConfig.java Gateway security
Components 19
React frontend
- SPA entry
shopnow-frontend/src/index.js - Routes and views
shopnow-frontend/src/App.js - Client state
shopnow-frontend/src/store.js - Auth API client
shopnow-frontend/src/services/AuthService.js
Platform services
- Docker Compose · Coordinates the local backend service runtime.
shopnow-backend/docker-compose.yaml - Keycloak identity provider · Realm export defines the identity integration.
shopnow-backend/keycloak-realms/realm-export.json - API gateway · External backend entry point.
shopnow-backend/api-gateway/src/main/java/com/techcareer/apigateway/ApiGatewayApplication.java - Gateway security · Applies the cross-service request boundary.
shopnow-backend/api-gateway/src/main/java/com/techcareer/apigateway/config/SecurityConfig.java - Gateway runtime config
shopnow-backend/config-server/src/main/resources/config/api-gateway.yaml - Config server · Publishes service-specific runtime configuration.
shopnow-backend/config-server/src/main/java/com/techcareer/configserver/ConfigServerApplication.java - Discovery server · Supports service registration and lookup.
shopnow-backend/discovery-server/src/main/java/com/techcareer/discoveryserver/DiscoveryServerApplication.java - Product runtime config
shopnow-backend/config-server/src/main/resources/config/product-service.yaml
Domain services
- Product API
shopnow-backend/product-service/src/main/java/com/techcareer/productservice/controller/ProductController.java - Product operations
shopnow-backend/product-service/src/main/java/com/techcareer/productservice/service/ProductService.java - Product persistence
shopnow-backend/product-service/src/main/java/com/techcareer/productservice/repository/ProductRepository.java - User service · Handles authentication-oriented requests and profile updates.
shopnow-backend/user-service/src/main/java/com/techcareer/userservice/service/UserService.java - User API
shopnow-backend/user-service/src/main/java/com/techcareer/userservice/controller/UserController.java - Cart API
shopnow-backend/shopping-cart-service/src/main/java/com/techcareer/shoppingcartservice/controller/ShoppingCartController.java - Cart operations · Manages cart operations and cart/product persistence.
shopnow-backend/shopping-cart-service/src/main/java/com/techcareer/shoppingcartservice/service/ShoppingCartService.java
Connections 24
- SPA entry → Routes and views: boots
- Routes and views → Client state: uses state
- Routes and views → Auth API client: auth requests
- Auth API client → Keycloak identity provider: identity flow
- Routes and views → API gateway: backend API requests
- API gateway → Gateway security: enforces
- Gateway security → Product API: authorized product traffic
- Gateway security → User API: authorized user traffic
- Gateway security → Cart API: authorized cart traffic
- Product API → Product operations: delegates
- Product operations → Product persistence: persists products
- User API → User service: delegates
- Cart API → Cart operations: delegates
- Config server → Gateway runtime config: publishes
- Config server → Product runtime config: publishes
- Gateway runtime config → API gateway: configures
- Product runtime config → Product operations: configures
- API gateway → Discovery server: registers and locates
- Product operations → Discovery server: registers
- User service → Discovery server: registers
- Cart operations → Discovery server: registers
- Docker Compose → API gateway: runs
- Docker Compose → Config server: runs
- Docker Compose → Discovery server: runs