About event-driven
A reference for developers using event-driven architecture, covering patterns such as Event Sourcing, CQRS, Saga, and event buses. It includes examples of rebuilding state, coordinating distributed transactions, and using Kafka and Symfony.
Key features
- 01Event Sourcing and state reconstruction
- 02CQRS read/write model separation
- 03Saga orchestration and choreography
- 04Kafka event bus example
- 05Symfony domain event example
Use cases
- 01Rebuild application state from an event log
- 02Separate read models from write models
- 03Coordinate distributed transactions across microservices
- 04Trigger domain operations through events
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ thebeardedbearsas/ claude-craft --skill event-drivenAfter installing, type/event-drivenin Claude Code to confirm it loaded.
Details
From the project READMEEvent-Driven — Event Sourcing, Saga, CQRS
Architecture événementielle pour découplage et scalabilité.
Patterns
Event Sourcing — Stocker events, pas état (audit, replay)
CQRS — Séparer Read/Write models (projections)
Saga — Transaction distribuée (microservices)
Event Bus — Pub/Sub découplé (Kafka, RabbitMQ)
Event Sourcing
events = [OrderCreated(...), OrderPaid(...), OrderShipped(...)]
def rebuild(events):
state = {}
for e in events: state = apply(state, e)
return state
Saga — Choreography vs Orchestration
Choreography — Events chain services (découplé, debug dur)
Orchestration — Central coordinator (visible, couplé)
Choreo: OrderCreated → Payment → Shipping
Orchestrator: ProcessPayment() → ShipOrder()
Kafka Event Bus
// Producer
producer.send({ topic: 'orders', messages: [{ ... }] });
// Consumer
consumer.run({
eachMessage: async ({ message }) => {
handleEvent(JSON.parse(message.value));
}
});
Domain Events (Symfony)
class OrderCreatedEvent {
public function __construct(public Order $order) {}
}
class SendEmail {
public function __invoke(OrderCreatedEvent $e) {
$this->mailer->send($e->order->email, 'Confirmation');
}
}
Voir @.claude/rules/21-cqrs.md, @.claude/skills/async/SKILL.md