Skip to content

How Do I...?

A task-oriented index into the Protean documentation. Find the guide you need by what you're trying to accomplish.

Model My Domain

I want to... Guide
Define a root entity with business logic Aggregates
Add a child object with identity to an aggregate Entities
Create an immutable descriptive value (Money, Email, Address) Value Objects
Choose between an entity and a value object Deciding Between Elements
Connect entities with relationships Relationships
Add typed attributes to domain objects Fields
Define a domain event Events

Add Business Rules

I want to... Guide
Validate field values Validations
Enforce business invariants Invariants
Change aggregate state safely Aggregate Mutation
Raise domain events from an aggregate Raising Events
Coordinate logic across multiple aggregates Domain Services

Handle Requests and Change State

I want to... Guide Pathway
Handle a user request synchronously Application Services DDD
Define a command representing user intent Commands CQRS, ES
Process a command and update an aggregate Command Handlers CQRS, ES
Save an aggregate to the database Persist Aggregates All
Load an aggregate by ID or query Retrieve Aggregates All
Manage transactions Unit of Work All

React to State Changes

I want to... Guide
Run side effects when an event fires Event Handlers
Build a read-optimized view from events Projections
Listen to messages from an external broker Subscribers

Set Up and Configure

I want to... Guide
Register domain elements Register Elements
Initialize and activate a domain Initialize Domain
Configure databases, brokers, and caches Configuration
Understand identity and ID generation Identity
Understand stream categories Stream Categories

Run in Production

I want to... Guide
Process events and commands asynchronously Server
Understand subscriptions and event processing Subscriptions
Use the outbox pattern for reliable messaging Outbox
Use the CLI for development and operations CLI

Choose an Architecture

I want to... Guide
Understand the three architectural pathways Choose a Path
Use pure DDD with application services DDD Pathway
Separate reads and writes with CQRS CQRS Pathway
Use event sourcing for full audit trails Event Sourcing Pathway
Decide between CQRS and Event Sourcing Architecture Decision

Test My Code

I want to... Guide
Test domain model logic Domain Model Tests
Test application workflows (BDD-style) Application Tests
Test with real databases and brokers Integration Tests
Set up test fixtures and patterns Fixtures and Patterns

Use Specific Technologies

I want to... Guide
Use PostgreSQL PostgreSQL Adapter
Use Elasticsearch Elasticsearch Adapter
Use Redis as a message broker Redis Broker
Use Redis as a cache Redis Cache
Use Message DB as an event store Message DB
Build a custom broker adapter Custom Brokers