E-commerce microservices architecture
A C4 container diagram of an online shop: gateway, catalog, cart, order and payment services, an event broker and a database per service.
By ArchynoE-commerceUpdated November 29, 2026Diagrams: 1Elements: 16Relationships: 14
Licensed under CC BY 4.0: reuse and change it, and credit Archyno
Created with ArchynoUse this template
It opens in the editor as an editable model. No account is needed to change and export it. A free account saves it. Keep the credit to the author.
Open and customizeWhen this architecture fits
Use it when several teams change the shop at the same time, or when one part, such as the catalog, needs far more capacity than the rest. A small shop with one team is usually better off with one application and one database. The boundaries on this diagram still help there: draw them as modules first and split them later.
How an order moves through it
The browser talks to one gateway, so no service is public. The order service is the only one that knows the state of an order.
- The shopper fills the cart. The cart service keeps it in a fast store, because a lost cart is annoying but not a loss of money.
- The order service stores the order first, then asks the payment service to charge it.
- It publishes an event when the payment is done. Fulfilment reacts to the event and books the parcel.
- Nothing after the payment blocks the shopper. A slow carrier delays a parcel, never a checkout.
Change these parts first
Rename the technologies to the ones you run. Then check three decisions with your team.
- Who owns stock? Here the catalog does. With several warehouses it deserves its own service.
- Is the payment call synchronous? Keep it so if you must show the result at once.
- Which events may be lost? If the answer is none, add an outbox to the order service.
Common mistakes
Two services that share a database are one service with two names. A chain of more than two synchronous calls makes the checkout as weak as its weakest part. And a retry without an idempotency key charges a card twice.
What is in this model
- API gatewayContainer
- One public entry. Checks tokens and limits requests.
- Cart serviceContainer
- The open cart of each shopper.
- Cart storeDatabase
- Carts, kept for 30 days.
- Catalog databaseDatabase
- Products and stock levels.
- Catalog serviceContainer
- Products, prices and search.
- Event brokerContainer
- Carries order events between services.
- Fulfilment serviceContainer
- Reserves stock and ships orders.
- Order databaseDatabase
- Orders and their states.
- Order serviceContainer
- Takes an order and drives it to done.
- Parcel carrierExternal system
- Delivers parcels and reports their status.
- Payment databaseDatabase
- Payments and refunds.
- Payment providerExternal system
- Charges cards and wallets.
- Payment serviceContainer
- Takes and refunds payments.
- ShopperPerson
- Browses the shop and places orders.
- Web shopContainer
- Shows products, the cart and the checkout.
- Online shopBoundary
- No description.