How thefabric-io/eventsourcing works
Core Components (Middle Layer)
a. Aggregate Component
• As a central component
• Generic type parameter [S AggregateState]
b. Event Component
• Adjacent to Aggregate
• Generic type parameter [S AggregateState]
• Connection to EventStore interface
• AggregateState
• EventState
• Identifiable
• InceptionRecorder
• ModificationRecorder
• StorageNamer
Storage Layer (Bottom)
• EventStore Interface (Abstract)
• PostgreSQL Implementation (Concrete)
• Database tables/schema structure
Specific details
• PostgreSQL event store implementation details
• Schema name: "eventsourcing"
• Event tables based on aggregate types
• Version tracking mechanism
Interaction flows
• Event application flow
• Storage operations (Save, Load, History)
• State changes propagation
Detailed Component Relationships:
Client Application
• ↓
[Aggregate Manager]
• ↙ ↓ ↘
[Events] → [State] → [Version]
• ↓
[Event Store Interface]
• ↓
[PostgreSQL Implementation]
• ↓
[Database]
Key Elements to Include:
Type System
• Generic type relationships
• Interface implementations
• Type constraints
Data Flow
• Event creation and application
• State mutations
• Storage operations
Storage Layer
• Table structure
• Schema organization
• Event serialization
Configuration
• Environment variables
• Connection settings
• Schema definitions
• Blue: Core components
• Green: Interfaces
• Yellow: Implementation details
• Red: Critical paths
• Gray: External systems
• Component relationships
Remember to include notes about:
• Generic type safety
• Version management
• Event application flow
• Storage naming conventions
• Transaction boundaries
This will provide a clear understanding of both the architectural patterns and the practical implementation details of the library.