DOCUMENTOVERVIEW

Orders system overview

How the orders system fits together — context, landscape, one module, one flow.

Context
01 · C4 model
SECTION 01 · C4 model

The orders system in its world

C4 · CONTEXT
C4 diagram: 4 elements, 3 relationshipsPERSONShopperSYSTEMOrders systemEXTPaymentsEXTShippingplaces orderschargesnotifies
LegendPERSONpersonSYSTEMsoftware systemEXTexternal systemoutside the boundaryusesthe system in scope
Orders system overview2 / 5
Landscape
02 · Architecture
SECTION 02 · Architecture

Services and backbone

ARCH
Layered architecture: 2 layers, 4 nodesORDERS PLATFORMAppsBackboneStorefrontNext.jsCLIENTOrders APIFargateSVCEvent busmanagedQUEUEorders-dbPostgresDB
LegendCLIENTclientSVCserviceQUEUEqueueDBdatabasecalls
Orders system overview3 / 5
One module — the API internals
03 · Frontend logic
SECTION 03 · Frontend logic

Orders API — the request chain

LOGIC
Module graphorders/apiEgressCONTROLLERcreateOrderPOST /ordersSERVICEOrderServicevalidate + placeREPOSITORYOrderRepopersistGATEWAYPaymentGatewaychargeorders-dbPostgresDBPaymentsthird-partyEXT12345
1calls2saves3charges4SQL5HTTPS
LegendCONTROLLERcontroller / routeSERVICEservice / use caseREPOSITORYrepositoryGATEWAYgatewayDBdatabaseEXTexternalcontract / externalpassive (state, middleware, store)usesnetwork callentry point
Orders system overview4 / 5
One flow
04 · Sequence
SECTION 04 · Sequence
SEQUENCE
Sequence diagram: 4 messages between 3 actorsClientOrders APIPayments1POST /orders2charge3ok4201 Created
Legendcallresponsethe answer the caller getsactive
Orders system overview5 / 5
1 / 5
Document