composable-rust-event-sourcing

Implement event-sourced aggregates and state reconstruction in Composable Rust with PostgreSQL.

Updated Nov 5, 2025
One-click install
npx skills add https://github.com/jonathanbelolo/composable-rust --skill composable-rust-event-sourcing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: composable-rust-event-sourcing
Source: https://github.com/jonathanbelolo/composable-rust/tree/main/.claude/skills/composable-rust-event-sourcing
Command: npx skills add https://github.com/jonathanbelolo/composable-rust --skill composable-rust-event-sourcing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive expert guidance for implementing event sourcing in the Composable Rust framework. It helps developers design EventStore traits, batch append, state reconstruction, and versioning patterns, enabling auditable, replayable systems.

Core Features & Use Cases

  • Event-store design and persistence guidance for Rust services using PostgreSQL, including append/load semantics and optimistic concurrency.
  • State reconstruction from event streams and snapshot strategies, with examples of applying events to reach a current domain state.
  • CQRS-oriented projections and read models, with guidelines for idempotent projections and forward-compatible event schemas.
  • Use Case: Build a order processing domain where events drive state and projections update read models.

Quick Start

  • Start by reviewing the event-sourcing fundamentals described in this skill.
  • Implement an EventStore trait for your Rust service and wire it to PostgreSQL, then reconstruct state with from_events and load.
  • Validate with a minimal scenario: append an OrderPlaced event and replay to rebuild current order state.

Frequently Asked Questions about composable-rust-event-sourcing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement event sourcing in Rust with PostgreSQL persistence?

To implement event sourcing in Rust with PostgreSQL persistence, you design an EventStore trait, wire it to a transaction-based PostgreSQL database, and use bincode for event serialization. This enables immutable event storage and state reconstruction.

How does state reconstruction from event streams work in Rust?

State reconstruction from event streams works by applying immutable events sequentially to rebuild current domain state. You use methods like from_events and load to replay the stream, optionally utilizing snapshot strategies to optimize the reconstruction process.

How do I handle optimistic concurrency in a Rust event store?

You handle optimistic concurrency in a Rust event store by tracking event versions during batched appends. The transaction-based PostgreSQL event store enforces version tracking, ensuring concurrent writes do not corrupt the immutable event stream.

What is the best way to build CQRS projections in Rust?

The best way to build CQRS projections in Rust is to create idempotent projections that update read models from event streams. This approach ensures forward-compatible event schemas and prevents duplicate updates when replaying events.

Do I need bincode to serialize events in a Rust event sourcing system?

Yes, you need bincode to serialize events in this Rust event sourcing system. The implementation specifically relies on bincode for serializing and deserializing immutable events persisted in the PostgreSQL transaction-based event store.