
Event Sourcing
Implementation guide for event sourcing and CQRS with event stores, aggregates, projections, and snapshots.
- skills.sh installs
- 893
- GitHub stars
- 387
- last updated
- Aug 21, 2026
What it does
- Covers event store design, read-model projections, PostgreSQL-backed storage, and snapshots for performance
- Includes a TypeScript quick start with a
DomainEventshape, versioned aggregates, and anEventStoreclass - Enforces optimistic concurrency on appends and keeps reads on projections rather than the event store
- Designed for systems needing audit trails, temporal queries, or full history, such as financial and compliance workloads
Install
$ npx -y skills add aj-geddes/useful-ai-prompts --skill event-sourcing -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Event Sourcing
Table of Contents
Overview
Store state changes as a sequence of events rather than the current state, enabling temporal queries, audit trails, and event replay.
When to Use
- Audit trail requirements
- Temporal queries (state at any point in time)
- Event-driven microservices
- CQRS implementations
- Financial systems
- Complex domain models
- Debugging and analysis
- Compliance and regulation
Quick Start
Minimal working example:
interface DomainEvent {
id: string;
aggregateId: string;
aggregateType: string;
eventType: string;
data: any;
metadata: {
userId?: string;
timestamp: number;
version: number;
};
}
interface Aggregate {
id: string;
version: number;
}
class EventStore {
private events: DomainEvent[] = [];
async appendEvents(
aggregateId: string,
expectedVersion: number,
events: Omit<DomainEvent, "id" | "metadata">[],
// ... (see reference guides for full implementation)
Reference Guides
Details
- Repository
- github.com/aj-geddes/useful-ai-prompts
- Categories
- Backend & APIs, Databases
- First seen
- May 16, 2026
More from aj-geddes/useful-ai-prompts
All 258- Mobile First Design877
- Api Security Hardening872
- Mobile App Testing833
- Technical Specification815
- User Story Writing797
- Access Control Rbac769
- User Guide Creation764
- Kubernetes Deployment763
- Logging Best Practices744
- Visual Regression Testing741
- Flutter Development727
- E2e Testing Automation698
- Business Case Development687
- React Component Architecture686
- Docker Containerization683
- Agile Sprint Planning679
- Log Analysis678
- Security Compliance Audit676
- Project Estimation674
- Gitlab Cicd Pipeline673
- Websocket Implementation669
- Requirements Gathering666
- Image Optimization665
- Ruby Rails Application661
Similar to Event Sourcing
More Backend & APIs
event-store-designwshobson/agents11.4K installsDesign and implement event stores for event-sourced systems, comparing EventStoreDB, PostgreSQL, Kafka, DynamoDB, and Marten.
projection-patternswshobson/agents11K installsPractical patterns for building read models and projections from event streams in CQRS systems.
event-driven-architectpatricio0312rev/skills292 installsArchitecture patterns for event sourcing, CQRS, and domain events, with TypeScript event buses and handlers.
cqrs-implementationsickn33/agentic-awesome-skills207 installsArchitecture guide for separating read and write models, with CQRS patterns and projection workflows.
transaction-managementaj-geddes/useful-ai-prompts462 installsDatabase transaction guidance for PostgreSQL and MySQL covering ACID, isolation levels, and locking.