Event Store Design

作者 wshobson46891e7e60da無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

AI 產生的概覽

指導事件溯源系統的事件存放區設計與實作,涵蓋架構、技術選擇與最佳實務。

功能
這個技能為事件溯源應用程式的事件存放區設計提供指引。它說明僅可附加的串流、排序、版本控制、訂閱與幂等性等核心概念,比較 EventStoreDB、PostgreSQL、Kafka、DynamoDB 與 Marten 等事件存放區技術,並列出最佳實務與常見誤區。它會指向一個參考檔案以取得範本與詳細範例。
適用情境
適合在建立事件溯源基礎架構、在各種事件存放區技術之間做選擇、實作自訂事件存放區,或規劃事件存放區結構與擴充時使用。也適合最佳化事件的儲存與擷取。
執行需求
沒有指令碼,只有說明內容。它會引用隨附的 references/details.md 檔案以取得範本與詳細範例。不需要憑證、套件或網路存取。

Event Store Design

Comprehensive guide to designing event stores for event-sourced applications.

When to Use This Skill

  • Designing event sourcing infrastructure
  • Choosing between event store technologies
  • Implementing custom event stores
  • Optimizing event storage and retrieval
  • Setting up event store schemas
  • Planning for event store scaling

Core Concepts

1. Event Store Architecture

┌─────────────────────────────────────────────────────┐│                    Event Store                       │├─────────────────────────────────────────────────────┤│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐ ││  │   Stream 1   │  │   Stream 2   │  │   Stream 3   │ ││  │ (Aggregate)  │  │ (Aggregate)  │  │ (Aggregate)  │ ││  ├─────────────┤  ├─────────────┤  ├─────────────┤ ││  │ Event 1     │  │ Event 1     │  │ Event 1     │ ││  │ Event 2     │  │ Event 2     │  │ Event 2     │ ││  │ Event 3     │  │ ...         │  │ Event 3     │ ││  │ ...         │  │             │  │ Event 4     │ ││  └─────────────┘  └─────────────┘  └─────────────┘ │├─────────────────────────────────────────────────────┤│  Global Position: 1 → 2 → 3 → 4 → 5 → 6 → ...     │└─────────────────────────────────────────────────────┘

2. Event Store Requirements

RequirementDescription
Append-onlyEvents are immutable, only appends
OrderedPer-stream and global ordering
VersionedOptimistic concurrency control
SubscriptionsReal-time event notifications
IdempotentHandle duplicate writes safely

Technology Comparison

TechnologyBest ForLimitations
EventStoreDBPure event sourcingSingle-purpose
PostgreSQLExisting Postgres stackManual implementation
KafkaHigh-throughput streamingNot ideal for per-stream queries
DynamoDBServerless, AWS-nativeQuery limitations
Marten.NET ecosystems.NET specific

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Use stream IDs that include aggregate type - Order-{uuid}
  • Include correlation/causation IDs - For tracing
  • Version events from day one - Plan for schema evolution
  • Implement idempotency - Use event IDs for deduplication
  • Index appropriately - For your query patterns

Don'ts

  • Don't update or delete events - They're immutable facts
  • Don't store large payloads - Keep events small
  • Don't skip optimistic concurrency - Prevents data corruption
  • Don't ignore backpressure - Handle slow consumers

來源與署名

來源:wshobson/agents位於plugins/backend-development/skills/event-store-design提交46891e7

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架