Skip to content
All projects
Case studyCS/19
StatusPersonal project
TypeSystems
Year2024

GraphEcomX

Event-driven e-commerce microservices behind a GraphQL gateway

User, Product and Order services, each with its own data, behind one GraphQL gateway. They communicate through Kafka events instead of calling each other.

  • 3 services
  • Kafka events
  • One GraphQL schema
  • Jest tests

§1

The problem

A monolithic store couples users, catalogue and orders, so one slow area drags down the rest and nothing scales independently.

§2

My role

Designed service boundaries, the gateway schema and event contracts; built and containerised every service.

§3

Architecture

Fig. 1 · GraphEcomX architecture
OrderCreatedCLIENTGRAPHQL GATEWAYone schemaUSER SERVICEPRODUCT SERVICEORDER SERVICEKAFKAdomain events
clientserviceevent

§4

Key decisions

  1. D/01

    GraphQL gateway

    Clients ask for exactly the shape they need in one round trip; the gateway resolves fields from the owning service.

  2. D/02

    Asynchronous events

    Order creation publishes to Kafka rather than calling other services, so one service being down doesn't block checkout.

  3. D/03

    Database per service

    Each service owns its MongoDB data. No shared tables, no hidden coupling.

§5

Challenges

  • Consistency across services without distributed transactions, using events and idempotent consumers.
  • Reproducible local setup with docker compose.

§6

Stack

  • Node.js
  • GraphQL
  • Kafka
  • MongoDB
  • Docker
  • Jest

Next case study

DivvyMate

Expense-sharing back end with equal, exact and percentage splits