ArchSketch

Architecture templates › Event-driven

Event-driven architecture template

Free editable event-driven architecture diagram - producers, an event stream, independent consumers, a dead-letter queue and a read model.

Open and edit this diagramStart from a blank canvas

Event-driven architecture template diagram
Drawn with ArchSketch.

How it works

In an event-driven architecture, services communicate by publishing facts about what happened instead of calling each other directly. Producers do not know who is listening, so new consumers can be added without touching them.

This template pairs an event stream with a dead-letter queue for messages that keep failing and a separate read model that is built from the events (the CQRS pattern), so queries stay fast without loading the write database.

Step by step

  1. Services write to their own database and publish an event describing the change.
  2. Consumers subscribe to the stream and react independently - sending email, updating search, building analytics.
  3. Messages that fail repeatedly are moved to a dead-letter queue for inspection instead of blocking the stream.
  4. A projector turns events into a read-optimised store that the query API serves.

The YAML behind this diagram

Every diagram here is plain text. Paste it into ArchSketch (menu → Diagram from YAML) to edit it, or keep it in your repo next to the code.

nodes:
  - { id: client, kind: web, label: Client }
  - { id: cmd, kind: service, label: Command API, zone: Producers }
  - { id: orders, kind: service, label: Order service, zone: Producers }
  - { id: ordersdb, kind: sql, label: Orders DB, zone: Producers }
  - { id: stream, kind: stream, label: Event stream }
  - { id: email, kind: email, label: Email consumer, zone: Consumers }
  - { id: search, kind: worker, label: Search indexer, zone: Consumers }
  - { id: ship, kind: worker, label: Shipping consumer, zone: Consumers }
  - { id: proj, kind: worker, label: Projector, zone: Consumers }
  - { id: dlq, kind: queue, label: Dead-letter queue }
  - { id: idx, kind: search, label: Search index }
  - { id: read, kind: nosql, label: Read model }
  - { id: query, kind: service, label: Query API }
links:
  - client -> cmd : commands
  - cmd -> orders
  - orders -> ordersdb
  - orders -> stream : OrderPlaced
  - stream -> email
  - stream -> search
  - stream -> ship
  - stream -> proj
  - ship -> dlq : on repeated failure
  - search -> idx
  - proj -> read
  - client -> query : queries
  - query -> read

Use it in your README

Commit your own arch.yaml and embed the always-up-to-date picture:

![Architecture](https://cloudforge.in/render?src=OWNER/REPO/arch.yaml)

YAML format reference