projection-patterns

Create read models and projections from event streams for event-sourced systems.

Updated Feb 13, 2026
One-click install
npx skills add https://github.com/simplysmartai/5cypressautomation --skill projection-patterns-simplysmartai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: projection-patterns
Source: https://github.com/simplysmartai/5cypressautomation/tree/main/agents/plugins/backend-development/skills/projection-patterns
Command: npx skills add https://github.com/simplysmartai/5cypressautomation --skill projection-patterns-simplysmartai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires asyncpg, elasticsearch, and includes references (resource) components.

What problem does it solve?

This Skill provides a structured approach to building efficient read models and projections from event streams, crucial for optimizing query performance in event-sourced systems.

Core Features & Use Cases

  • CQRS Read Models: Implement the read side of Command Query Responsibility Segregation.
  • Materialized Views: Create and maintain denormalized views of event data for faster querying.
  • Real-time Dashboards: Power live dashboards by projecting events into queryable data stores.
  • Search Indexing: Populate search engines like Elasticsearch with event data.
  • Use Case: When a new OrderCompleted event occurs, this skill automatically updates the order_summaries table in your database to reflect the new total amount and status.

Quick Start

Use the projection-patterns skill to rebuild the 'order_summary' projection.

Frequently Asked Questions about projection-patterns

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

FAQPage Schema
How do I build read models from event streams in an event-sourced system?

To build read models from event streams, you process events through projectors that apply state changes to data stores like SQL databases or Elasticsearch. This requires defining event handlers and managing projection checkpoints for stateful processing.

What is the best way to implement CQRS read sides and materialized views?

Implementing CQRS read sides and materialized views involves creating projectors that consume event streams to populate denormalized data stores. This enables faster querying by maintaining separate read-optimized representations of event data.

How do I populate Elasticsearch with event data for real-time dashboards?

Populating Elasticsearch with event data for real-time dashboards is done by processing events through projectors that apply updates directly to search indexes. This allows live data visualization by maintaining queryable projections from continuous event streams.

Do I need projection checkpoints for stateful event processing?

Yes, managing projection checkpoints is required for stateful event processing. Checkpoints track the position of consumed events, ensuring reliable recovery and consistent state synchronization between the event stream and read models.

Can I use asyncpg to maintain SQL projections from event streams?

Yes, asyncpg can be used to maintain SQL projections from event streams. The system supports applying projected events to SQL databases, allowing you to update tables like order summaries automatically when new events occur.

When should I not use projections for database querying?

You should avoid using projections when your system does not require complex read models, real-time dashboards, or search indexing. Projections add architectural overhead through checkpoint management and event handler maintenance, making them unnecessary for simple CRUD applications.