All templates
Microservicesevent sourcingCQRSKafka

Event sourcing + CQRS

Event-sourced write side with append-only event store, plus separate read models materialised from event stream.

The prompt

Event sourcing with CQRS. Write side: Command Service receives commands, validates them, and appends events to an Event Store (Kafka or EventStoreDB). The Event Store is the single source of truth. Read side: multiple Projection workers consume the event stream and materialise denormalised read models — one in PostgreSQL for transactional reads, one in Elasticsearch for search, one in Redis for hot cache. Each read model is independently rebuildable by replaying events from offset zero. Show the snapshot mechanism that periodically saves aggregate state to avoid replaying millions of events.

What it generates

A diagram showing the command path, event store, multiple read models, and the snapshot/replay mechanics.

When to use it

When you need a complete audit log, time-travel debugging, or the ability to derive new read models from historical data without rewriting writes.

Generate this diagram in seconds

Copy the prompt above, sign in for free, and paste it into the generator.

Related microservices templates