Skip to main content
ship it and sleep

The E-Commerce Platform Architecture and Pipeline Topology

8 min read Chapter 3 of 66

The E-Commerce Platform Architecture and Pipeline Topology

The Five Services

Product Catalog

The catalog service is the simplest in the platform. It serves product listings from a PostgreSQL read replica, caches aggressively in Redis, and exposes a REST API consumed by the frontend shell and the checkout service (for price validation).

PropertyValue
Repositoryacme/catalog-service
RuntimeNode.js 20
Data storePostgreSQL (read replica), Redis (cache)
API surfaceREST: GET /products, GET /products/:id, GET /search
Deploy frequency3-5 times per week
Risk profileLow. A bad deploy shows stale products. No data loss, no revenue impact.

The catalog pipeline is the simplest: build, test, scan, promote to staging. No special gates beyond the standard security scan. This makes it a good candidate for introducing pipeline concepts before adding complexity.

Inventory

The inventory service tracks stock levels, handles reservations during checkout, and processes restocking events from a warehouse integration. It is write-heavy and race-condition-sensitive. Two concurrent checkout requests for the last unit of a product must not both succeed.

PropertyValue
Repositoryacme/inventory-service
RuntimeJava 21, Spring Boot 3
Data storePostgreSQL (primary), Redis (distributed locks)
API surfaceREST: POST /reserve, POST /release, GET /stock/:sku
Deploy frequency2-3 times per week
Risk profileMedium. A bad deploy can oversell inventory. Financial impact, but recoverable with manual order cancellation.

The inventory pipeline adds a database migration gate. Every deployment that includes a schema change must pass a backward-compatibility check (covered in CH9). The Locust scenario for this service simulates concurrent reservation requests to catch race conditions.

Checkout

The checkout service orchestrates the purchase flow. It validates the cart against the catalog, reserves inventory, initiates payment, and creates the order record. It calls three other services synchronously and is the most latency-sensitive path in the platform.

PropertyValue
Repositoryacme/checkout-service
RuntimeGo 1.22
Data storePostgreSQL (orders), Redis (cart sessions)
API surfaceREST: POST /checkout, GET /orders/:id
Deploy frequency1-2 times per week
Risk profileHigh. A bad deploy means customers cannot complete purchases. Revenue loss is immediate and measurable.

The checkout pipeline is the most complex. It includes contract tests against the catalog, inventory, and payments APIs (covered in CH6). It has the strictest Locust gate: p99 latency must stay below 800ms on the checkout flow with 200 concurrent users. Deployment uses canary with Argo Rollouts and automated rollback.

Payments

The payments service handles payment processor integration, tokenization, and PCI-scoped operations. It has the strictest security requirements and the most restrictive deployment policy.

PropertyValue
Repositoryacme/payments-service
RuntimeJava 21, Spring Boot 3
Data storePostgreSQL (transactions), Vault (tokenized card data)
API surfaceREST: POST /charge, POST /refund, GET /transactions/:id
Deploy frequencyWeekly, with mandatory approval
Risk profileCritical. A bad deploy can double-charge customers or leak payment data. Financial and regulatory impact.

The payments pipeline adds PCI-specific gates: no secrets in logs, no debug endpoints exposed, mandatory mTLS verification, SAST scan with zero tolerance for injection vulnerabilities. Deployment requires manual approval in the GitHub Actions workflow and a successful canary with a 30-minute bake time.

Frontend Shell

The frontend shell is a server-side rendered application that composes responses from the catalog, inventory, and checkout services. It is the only service that end users interact with directly.

PropertyValue
Repositoryacme/frontend-shell
RuntimeNext.js 14
Data storeRedis (session store)
API surfaceHTTP: serves HTML pages, proxies API calls to backend services
Deploy frequency3-5 times per week
Risk profileHigh visibility, medium financial impact. A bad deploy is immediately visible to every user but does not directly cause data loss or payment issues.

The frontend pipeline includes Lighthouse CI as a performance gate (page load time, bundle size) in addition to the standard Locust gate. Deployment uses blue-green with instant traffic switch because partial rollouts on a frontend create inconsistent user experiences.

Inter-Service Dependencies

┌──────────────┐
│ Frontend     │
│ Shell        │
└──┬───┬───┬───┘
   │   │   │
   v   v   v
┌──┴─┐┌┴──┐┌┴───────┐
│Cat-││Inv-││Check-  │
│alog││ent-││out     │
│    ││ory ││        │
└────┘└──┬─┘└┬───┬───┘
         │   │   │
         │   v   v
         │ ┌─┴─┐┌┴───────┐
         │ │Inv-││Payments│
         │ │ent-││        │
         │ │ory ││        │
         │ └────┘└────────┘

         v
    (async: warehouse
     restocking events)

The frontend shell calls catalog, inventory (for stock status display), and checkout. The checkout service calls catalog (price validation), inventory (reservation), and payments (charge). Inventory receives asynchronous restocking events from the warehouse system via a message queue.

This dependency graph matters for deployment ordering. Deploying a breaking change to the inventory API while the checkout service still expects the old contract breaks the checkout flow. Contract tests (CH6) catch this before deployment. Canary deployments (CH8) catch it during deployment.

The Infra Repo in Detail

The ecommerce-infra repository holds every Kubernetes manifest, Helm values file, Kustomize overlay, and ArgoCD application definition for the platform. No Kubernetes resource is applied directly from a service repo. Every change to the cluster state goes through this repo.

ecommerce-infra/
├── base/
│   ├── catalog/
│   │   ├── deployment.yaml
│   │   ├── service.yaml
│   │   ├── hpa.yaml
│   │   └── kustomization.yaml
│   ├── inventory/
│   │   ├── deployment.yaml
│   │   ├── service.yaml
│   │   ├── hpa.yaml
│   │   ├── pdb.yaml
│   │   └── kustomization.yaml
│   ├── checkout/
│   │   ├── deployment.yaml
│   │   ├── service.yaml
│   │   ├── hpa.yaml
│   │   ├── pdb.yaml
│   │   └── kustomization.yaml
│   ├── payments/
│   │   ├── deployment.yaml
│   │   ├── service.yaml
│   │   ├── networkpolicy.yaml
│   │   ├── pdb.yaml
│   │   └── kustomization.yaml
│   └── frontend/
│       ├── deployment.yaml
│       ├── service.yaml
│       ├── ingress.yaml
│       ├── hpa.yaml
│       └── kustomization.yaml
├── overlays/
│   ├── staging/
│   │   ├── catalog/
│   │   │   └── kustomization.yaml
│   │   ├── inventory/
│   │   │   └── kustomization.yaml
│   │   ├── checkout/
│   │   │   └── kustomization.yaml
│   │   ├── payments/
│   │   │   └── kustomization.yaml
│   │   └── frontend/
│   │       └── kustomization.yaml
│   └── production/
│       ├── catalog/
│       │   └── kustomization.yaml
│       ├── inventory/
│       │   └── kustomization.yaml
│       ├── checkout/
│       │   └── kustomization.yaml
│       ├── payments/
│       │   └── kustomization.yaml
│       └── frontend/
│           └── kustomization.yaml
└── argocd/
    ├── app-of-apps.yaml
    ├── catalog-staging.yaml
    ├── catalog-production.yaml
    ├── inventory-staging.yaml
    ├── inventory-production.yaml
    ├── checkout-staging.yaml
    ├── checkout-production.yaml
    ├── payments-staging.yaml
    ├── payments-production.yaml
    ├── frontend-staging.yaml
    └── frontend-production.yaml

Base Manifests

The base/ directory contains the canonical Kubernetes resources for each service. These are environment-agnostic: no replica counts, no image tags, no environment-specific configuration. Every resource includes:

  • namespace (set per overlay)
  • Labels: app.kubernetes.io/name, app.kubernetes.io/part-of: ecommerce, app.kubernetes.io/managed-by: argocd
  • Resource requests and limits (defaults in base, overridden per environment)
  • Readiness and liveness probes
# base/checkout/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout-service
  labels:
    app.kubernetes.io/name: checkout-service
    app.kubernetes.io/part-of: ecommerce
    app.kubernetes.io/managed-by: argocd
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: checkout-service
  template:
    metadata:
      labels:
        app.kubernetes.io/name: checkout-service
        app.kubernetes.io/part-of: ecommerce
    spec:
      containers:
        - name: checkout
          image: ghcr.io/acme/checkout-service
          ports:
            - containerPort: 8080
              protocol: TCP
          resources:
            requests:
              cpu: 250m
              memory: 256Mi
            limits:
              cpu: "1"
              memory: 512Mi
          readinessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 15
            periodSeconds: 20
          env:
            - name: CATALOG_URL
              value: "http://catalog-service.$(NAMESPACE).svc.cluster.local:8080"
            - name: INVENTORY_URL
              value: "http://inventory-service.$(NAMESPACE).svc.cluster.local:8080"
            - name: PAYMENTS_URL
              value: "http://payments-service.$(NAMESPACE).svc.cluster.local:8080"

Overlays

Each overlay sets the environment-specific values: namespace, replica count, image tag, resource scaling, and any configuration overrides.

# overlays/production/checkout/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: production

resources:
  - ../../../base/checkout

replicas:
  - name: checkout-service
    count: 5

images:
  - name: ghcr.io/acme/checkout-service
    newTag: "a1b2c3d"

patches:
  - target:
      kind: Deployment
      name: checkout-service
    patch: |
      - op: replace
        path: /spec/template/spec/containers/0/resources/requests/cpu
        value: "500m"
      - op: replace
        path: /spec/template/spec/containers/0/resources/requests/memory
        value: "512Mi"
      - op: replace
        path: /spec/template/spec/containers/0/resources/limits/cpu
        value: "2"
      - op: replace
        path: /spec/template/spec/containers/0/resources/limits/memory
        value: "1Gi"

Pipeline Topology by Risk Profile

The five services share a common pipeline structure but differ in gate strictness and deployment strategy:

ServiceSecurity ScanContract TestsLocust GateDeployment StrategyApproval Required
CatalogStandardNop99 < 200msRolling updateNo
InventoryStandardYes (checkout)p99 < 500msCanary (10min bake)No
CheckoutStandardYes (catalog, inventory, payments)p99 < 800msCanary (20min bake)No
PaymentsEnhanced + SASTYes (checkout)p99 < 300msCanary (30min bake)Yes
FrontendStandard + LighthouseNop99 < 1000msBlue-greenNo

This table is the map. Every chapter that adds a pipeline stage or deployment pattern references it to show where the new concept applies and where it does not.