This page explains the services behind BlueShop, how they share data and how changes are tested and deployed. It also covers permissions, monitoring and recovery.
1. Engineering Purpose
The architecture assigns business decisions to services and defines how those services communicate. Tests and monitoring help find problems when those interactions fail.
Clear names and consistent patterns help developers and agents find the right place to make a change. Permissions, constraints and tests help catch mistakes.
BlueShop combines service ownership, API contracts, database constraints, access checks, tests and monitoring.
01Business behavior firstBusiness rules define the allowed operations and state changes. Adapters connect those rules to APIs, databases and events.
02One authority per decisionStock owns availability, Cart owns quotes, Order owns order
history and downstream projections do not rewrite those
facts.
03Sharing changesHTTP is used for immediate decisions; Kafka carries committed
facts and rebuildable projections.
04Finding failuresTraces, logs, metrics, correlation IDs and retained events
connect visible symptoms to the responsible boundary.
2. System Context
Customer and employee Angular applications enter through Traefik and
the API Gateway. Reactive domain services own operational decisions.
Kafka connects asynchronous facts to projections, notifications and
analytics.
From a request to a report
Customers and employeesStorefront, backoffice and identity experience
→
Traefik + API GatewayRouting, token validation and edge policy
→
Domain servicesReactive business decisions and service-owned state
→
Kafka projectionsSearch, notifications, recommendations and analytical
facts
→
ClickHouse + MetabaseReports built from events; services still own transactions
Operational decisions stay in the domain services. Analytics is
downstream and rebuildable; it never participates in transactional
writes.
Layer
Technology in this snapshot
Architectural role
Applications
Angular 22.0.8, Nx, signals, Signal Store, Playwright
Customer and role-scoped employee experiences
Edge
Traefik, Spring Cloud Gateway, Keycloak
Ingress, routing, authentication and edge policy
Services
Java 25, Spring Boot 4.1.1, WebFlux, Reactor
Domain behavior and non-blocking orchestration
Operational data
PostgreSQL/R2DBC, Redis, Elasticsearch
Service-owned state, cache/session and search projections
Committed facts, projections and workflow decoupling
Analytics
ClickHouse, Metabase, bounded JDBC scheduler
Event-sourced facts and dashboard read models
Platform
K3s, ArgoCD, Kustomize, Terraform, Vault, SigNoz
Self-hosted runtime, desired state, secrets and observability
3. Domain Ownership
A deployment unit is not automatically a bounded context. BlueShop
treats business services as candidate boundaries only where they own a
domain model, language and integration contract.
Each arrow passes facts or requests. It does not transfer ownership
of the source decision.
Boundary
Authoritative responsibility
Important boundary rule
Catalog
Product identity and content; variant-owned prices, costs and fees; categories, brands and curated relations
Search and inventory visibility are projections, not new
product authorities
Stock
Variant availability, movements and reservations
Only Stock may grant the final unit
Cart
Shopping session, selected variants, checkout preparation and authoritative quote
Downstream services snapshot accepted value
Order
Order identity, history and commercial snapshots
Does not recompute historical price or own shipment work
Payment
Provider transactions and payment lifecycle
Order derives payment state from outcomes
Customer
Profiles, addresses and loyalty state
Marketing owns campaigns, not customer identity
Logistics
Shipment and delivery lifecycle
Reports accepted warehouse facts to Order
Recommendation
Candidate generation, ranking, serving and measurement
Projects source facts; does not own products, stock or
purchases
Support and Review
Case recovery and moderated feedback
Validate against Order evidence without absorbing Order
ownership
Analytics
Derived facts and dashboards
Never becomes a transactional write dependency
4. Connecting Rules, Code and Tests
Requirement IDs connect business rules to test scenarios and saved results.
From a rule to its test result
Business ruleUbiquitous language and invariant
→
Requirement + ACStable IDs and expected outcome
→
Gherkin scenarioGiven, When, Then behavior
→
ImplementationDomain model and adapters
→
Saved test reportTest result tied back to the criterion
The specification checker validates the schema, IDs, references and rule tags. A scenario needs a saved test report before it can be marked verified.
5. Immediate Decisions and Asynchronous Facts
HTTP answers questions that must be decided now. Events report
committed facts and let independent projections move at their own
pace.
Two communication paths
Answer now
Customer asks→Owner checks identity and rules→Non-blocking database and API work→Return one answer
Share a fact
Save state and event together⇢Publish the committed fact⇢Ignore duplicate delivery⇢Update the local projection
If a consumer creates another business fact, that follow-up event is
saved with its own local update. It is optional, not a step every
projection performs.
Immediate path
Answer while the customer waits.
The owning service validates the request, applies its domain rules
and composes PostgreSQL or downstream API work without holding a
thread open. Timeouts and resilience policies bound every
dependency before one response returns.
WebFlux, Reactor, R2DBC and WebClient implement this path.
Production request code does not call .block().
Sharing changes
Notify other services
The producer saves business state and its outbox event in one
transaction. After publication, a consumer records the event
identity before applying the local effect, so redelivery cannot
repeat that effect.
CloudEvent IDs identify duplicate deliveries. Aggregate keys keep related events ordered within a partition. Inbox/outbox transactions protect the local database effect. ClickHouse JDBC is a blocking adapter and runs on a bounded scheduler.
6. Data Architecture
Storage follows ownership and workload. Operational services retain
transaction authority; projections remain rebuildable and analytics
remains downstream.
Store
Used for
Boundary
PostgreSQL
Operational service schemas, aggregates, outbox/inbox and RLS
Rebuildable through aliases and durable index work
Kafka
Retained integration facts and projection feeds
Transport and ordering boundary, not a domain database
ClickHouse
Event-sourced analytical facts and dimensions
Read-time deduplication; no operational write dependency
Longhorn volumes
Persistent state for self-hosted workloads
Shutdown and recovery ordering matter for stateful safety
Migration discipline: applied Flyway migrations are
immutable. New changes receive new versions. Analytics uses versioned
ClickHouse SQL applied through its migration runner rather than
application-startup DDL.
TRUST AND OPERATION
Checking access and handling failures
Access checks limit what callers can do. Tests, monitoring and recovery procedures help the system handle failures.
7. Identity and Access Checks
Identity is propagated across protected boundaries. Internal routing
and agent tooling do not become authorization bypasses.
Access checks at each layer
Identity
Keycloak OIDCUser and service rolesBearer propagationKafka workload identity
A valid route is not sufficient. The caller needs a valid identity,
the correct application authority and a permitted data context.
Defense in depth: PostgreSQL RLS filters rows, not
sensitive columns. APIs and dedicated views still control field-level
exposure.
8. Self-Hosted Platform
Agents first built and evolved the infrastructure, then used it as the
execution environment for the commerce system and its engineering
feedback loops.
How the platform operates
Build and deliver
Agents change Git→GitLab tests and builds→Harbor stores the image→ArgoCD reconciles K3s
Serve traffic
Traefik receives the request→Applications run on K3s→PostgreSQL, Kafka and projections hold state
Identity, secrets and monitoring
Keycloak proves identity·Vault supplies secrets·OpenTelemetry sends traces and metrics to SigNoz
Kustomize and Terraform describe desired state; ArgoCD applies the
Git-managed workload state. Longhorn and network policies support
the runtime beneath these paths.
Running the platform exposes problems with scheduling, credential rotation, storage and recovery that local mocks may not catch.
9. What the Tests Check
Different checks answer different questions. A successful compile
cannot prove a state machine, a browser journey or a safe distributed
failure path.
Check every affected part
StructureTypes, null safety and architecture boundaries
→
BehaviorDomain rules, transitions and failure branches
→
IntegrationDatabase, event, HTTP and security boundaries
→
AcceptanceBusiness scenarios and browser journeys
→
System checksCross-service behavior, load and runtime traces
Test a changed rule directly. For shared code, events or permissions, also check the services and callers affected by it.
Quality question
What the check covers
Does the behavior match the rule?
Domain invariants, legal transitions, reactive success and
failure paths behave as specified.
Does the customer experience still work?
Components render correctly, remain accessible, complete the
browser journey and build in every impacted application.
Did the architecture drift?
Domain ownership, non-blocking execution and dependency
boundaries remain intact.
Are the tests strong enough?
Critical branches are exercised and mutation analysis exposes
assertions that would miss behavioral changes.
Are integrations compatible?
API, event and specification changes preserve required
consumers and traceability.
05Stateful shutdownVault, PostgreSQL, Kafka, ClickHouse, Elasticsearch and
persistent volumes drain before K3s stops.
06Declarative recoveryRecovery changes are recorded in Git so the configuration stays reproducible.
Example: an unsafe host shutdown once produced an
all-NUL Vault lease file. The durable correction was an ordered
stateful drain plus repeated power-cycle checks, rather than a startup retry
hiding storage corruption.
11. Observability and Root-Cause Debugging
OpenTelemetry connects customer-visible behavior to edge, service,
event and persistence evidence in SigNoz. Diagnosis follows the path
of the request or fact instead of guessing from deployment status.
From a reported problem to a fix
Visible symptomBrowser, API, business outcome or failed assertion
→
CorrelationTrace ID, entity ID, route and time window
→
Logs, traces and resource usageSpans, logs, Kafka offsets, SQL and resource pressure
→
Locate the causeCode, policy, data, contract or infrastructure boundary
→
RegressionSmallest check that fails if the defect returns
Logs and traces can show that the first explanation was wrong. A regression test checks that the identified bug does not return.
Signals connected
HTTP route and status;
reactive service spans;
database calls and pool pressure;
Kafka produce, consume and lag;
trace and correlation identifiers;
CPU throttling, memory and pod scheduling.
Questions answered
Did the request reach the owner?
Was the state committed?
Was the event emitted and consumed?
Did the projection apply the correct identity?
Was latency compute, pool, network or dependency?
Did the user-visible result agree?
12. The Engineering Feedback Loop
After fixing a bug, add a regression test and record anything that will help future work. Then check the fix in the running system.
Design, build and learn
Design
Business language→Ownership and contract→Acceptance scenario
Build
Domain behavior→Adapters and infrastructure→Tests and quality checks
Learn
Running system→Findings and root cause→Regression test + project notes ↺
Useful findings are added to the tests, specifications and project notes.
01Not every service is a proven bounded contextThe context map remains incomplete and deployment topology must
not substitute for domain evidence.
02Payment is not externally integratedThe documented order flow records a selected method but does not
prove authorization, capture, refund or chargeback.
03Fulfilment ownership is transitionalCart currently commits the Stock reservation after Order creation
while Kafka provides idempotent recovery; a future Fulfilment
boundary is only a candidate.
04Recommendation rejects missing availabilityRecommendation now requires a published product, a default variant, positive available-to-sell quantity and IN_STOCK or LOW_STOCK status. Missing or unknown eligibility is rejected. This does not establish that every search or display path uses the same policy.
05Development topology is not universal HASingle-node components and the self-hosted laboratory should not
be presented as a production-scale availability claim.
06Traceability remains partialThe specification corpus is structurally checked, but most active
scenarios are not yet tied to durable verified reports.
Result
Making changes easier to understand
Service responsibilities, APIs and tests give developers and agents a place to start. Permissions and data constraints help protect the system when a change is wrong.
Checked on 12 September 2026: backend d305706a, frontend 74f5d216.
Frontend versions ·
Recommendation eligibility.
Source checks describe implemented rules, not a fresh runtime test. Payment integration, fulfilment ownership, traceability coverage and recovery history were not comprehensively re-audited in this update. The Review service still has a delivered-purchase fallback that returns a zero order ID and the current timestamp when its Order check fails; this source limitation was not exercised in a live outage.