Skip to content

Why use Cratis Platform for event sourcing and CQRS?

Cratis Platform helps teams explain how current state arose, build new views from recorded history, and find typed frontend usages affected by a backend contract change. These are separate reasons to adopt it: choose the boundary your feature needs without replacing the rest of your system.

Why developers choose Cratis

Explain a change. Answer the next question.

Compare the day-to-day changes with the work your application needs before choosing a component. To try the event-store boundary, get started with Chronicle; for an API and React UI, build a full-stack feature.

Explain today’s state and build the next view

Section titled “Explain today’s state and build the next view”

An order’s current status tells you where it is now. When someone disputes a change or needs a different view of that order, the team needs the facts behind the status as well as the screen that displays it.

Trace the facts behind the current state

Chronicle keeps changes as events, with sequence numbers and correlation, identity, and causation context. A read model is a view derived from those facts for a particular question. The CLI and Workbench let you inspect events, their processing, and the resulting read models. The explanation reaches only as far as the facts and context you recorded; an event history is not a separate read/access audit.

Answer another question from the same history

A new order screen need not replace the recorded facts. Chronicle projections derive multiple focused read models from the same events. Supported replay can rebuild a view from available history, but cannot recover facts that were never recorded. Materialized views update asynchronously; a full replay takes its observer out of live processing until catch-up, so plan for capacity, failures, and side effects.

Find the frontend usages a contract change affects

When an order field changes in the backend, regenerate its TypeScript proxies and type-check the frontend for incompatible typed usages. Arc separates writes into commands and reads into queries, the pattern called Command Query Responsibility Segregation (CQRS), exposes them over HTTP, and generates the clients. Cratis Components uses them in React command forms and query-backed tables instead of hand-maintained contract copies. The proxy boundary explains the check: generation must run, and typed agreement does not replace runtime integration checks.

Agree on expected behavior before implementation

Section titled “Agree on expected behavior before implementation”

For the same order feature, keep commands, facts, views, and Given/When/Then specifications together in a Cratis Screenplay .play model. Cratis Studio is an optional paid workspace where the team can edit that model together. Supported scenarios execute in the in-memory reference evaluator; operation fixtures do not execute there, and model checks do not establish that the implementation behaves correctly.

You can carry the model into source generation instead of leaving the design in a separate diagram, subject to the renderer’s supported constructs and languages. Modeling and generation do not replace implementation, testing, or deployment.

Keep the code for one behavior together as a vertical slice: command, events, projection, screen, and specifications. Code analysis checks naming and discovery conventions, while Cratis AI packages those conventions for assistants. The Given/When/Then tests follow the same sequence as the design: existing facts, a command, and the facts or read models that should result. You still implement the domain rules and review generated or agent-written code.

Erase protected values without discarding the event sequence

Section titled “Erase protected values without discarding the event sequence”

When an erasure request concerns personal data, Chronicle can make protected values unreadable while retaining events, sequence numbers, and non-PII fields. Values must be marked as PII before append so they are encrypted under the subject’s key; erasure deletes the key revisions and blocks replacement keys unless explicitly authorized. Adding a marker later does not protect historical plaintext.

This is an erasure mechanism, not compliance certification. Repeat erasure in each relevant namespace and resolve partial failures. Identity display names and causation values are not erased by deleting the subject key; exported copies, stale read models, backups, and restore/re-erasure need their own handling. Event sourcing and GDPR and Chronicle compliance explain the mechanism and remaining responsibilities.

The products connect at explicit boundaries. A command describes intent, an event records what happened, a projection builds a read model, and a query serves it to the screen. Identity and tenant context travel through that flow too, but authentication, authorization, and storage isolation remain separate responsibilities:

Concern Where Cratis carries it
Domain behavior Arc turns it into commands and queries, Chronicle records the facts as the default source of truth for information systems; Studio (an optional paid workspace) and Screenplay model it
Frontend contract Arc generates TypeScript proxies from backend commands and queries, and Components renders those proxies as forms, dialogs, and live tables
Chronicle client boundary Chronicle exposes gRPC/protobuf contracts to TypeScript, Kotlin/Java, Elixir, .NET, and Go clients; feature coverage varies by client
Chronicle storage MongoDB, PostgreSQL, Microsoft SQL Server, and SQLite implementations let the event store fit the deployment
Runtime scale Chronicle runs its kernel on .NET Orleans, so event sequences, observers, jobs, and long-running processing live on a distributed actor runtime
Authentication and tenant resolution AuthProxy handles the edge and forwards trusted identity and tenant context into the app
Authorization Arc gates commands and queries at the boundary, with identity details available in backend and React
Tenant isolation Arc resolves the tenant per request and routes Chronicle work to that tenant’s namespace; tenant selection, membership authorization, and storage isolation are separate decisions, so you still check that a caller belongs to the tenant they select. Arc MongoDB resolves a tenant-specific database, while EF Core isolation is yours to implement (details)
Operations and observability Workbench, CLI, OpenTelemetry, recommendations, replay, jobs, failed partitions, and diagnostics expose what the runtime is doing
Testing Cratis Specifications, Arc command scenarios, and Chronicle in-process scenarios turn an event-model column into executable given/when/then specs
AI assistance Cratis AI rules and skills in .cratis/ai, analyzers, the CLI catalog, and the Chronicle MCP server give agents the same rails developers use
Agent-work governance Direct defines journeys and evaluates recorded evidence at gates before work proceeds; people retain review and approval responsibilities

For product capabilities, dependencies, and terms, use the Cratis Platform capability map.

Use this map to locate a responsibility before configuring it. For example, choosing a tenant in a request does not establish that the caller may access it; Auth and compliance end to end follows that distinction through the application.

Chronicle is a client-server event-sourcing database and runtime with an open protocol boundary and a kernel built for long-running event processing. Your application’s language is separate from the kernel’s .NET implementation.

Compare the work you do today with the conventions you would adopt:

Instead of… You work with…
Duplicating backend request and response shapes in the frontend Backend command/query declarations, generated into typed TypeScript proxies
Spreading one feature across controllers, handlers, clients, and UI folders A vertical slice organized by behavior
Rebuilding screens by hand after a write Observable queries and components that follow the read model
Rebuilding authentication, tenancy, and identity plumbing per service AuthProxy at the edge, Arc identity and tenancy inside the app, Chronicle namespaces underneath
Teaching every developer and AI assistant a project-specific architecture from scratch Strong conventions, analyzers, and Cratis AI guidance that make each feature look like the rest
Locking event history to one application language or database engine Chronicle’s gRPC boundary, .NET/TypeScript/Kotlin/Java/Elixir clients, and MongoDB/PostgreSQL/SQL Server/SQLite storage implementations
Debugging from logs alone Events, observers, read models, and replay visible through the tools
Treating CQRS and event sourcing as the same decision Arc for the command/query boundary and Chronicle for event history; adopt either separately or connect them

The result is a workflow that stays close to the language developers already use: “what happened?”, “what state does this screen need?”, “what command changes it?”, and “what did the runtime do with it?”

Chronicle

The event-sourcing database and runtime. Language-specific clients over gRPC/protobuf, storage choice underneath, and Orleans-powered processing inside.

Arc

The application framework. Exposes commands and queries and generates TypeScript proxies from backend declarations for the frontend to call.

Components

The React library. Build command forms, data tables, and dialogs that consume Arc’s generated proxies.

AuthProxy

The edge gateway. Handles authentication, tenant resolution, identity enrichment, routing, and invite-based onboarding.

Control how far agent work proceeds

Set a progression ceiling and inspect the evidence behind the next step. Cratis Direct is the control plane for agentic engineering. Journeys define stages of work; gates evaluate recorded evidence. Governance depends on the rules activated, and an LLM assessment is judgment, not proof; people retain review and approval responsibilities. It runs Cratis’s own engineering today. Access opens in stages to enabled accounts, who sign in with GitHub; a GitHub account alone does not grant access. Public docs cover the Direct Agent Runner.

CLI

A terminal window into a running store — inspect events, watch observers, and diagnose issues.

You do not have to adopt the whole stack. Start with the boundary you need, keeping the dependencies of that choice in view:

  • Chronicle on its own records event history in a service, worker, console app, or API. Choose a client for your language and check its support for projections, reactors, and testing. No Arc or React is required.
  • Arc on its own supplies commands, queries, and generated TypeScript proxies without requiring an event log. Choose an Arc backend for your runtime and persistence needs. The .NET backend, for example, integrates with MongoDB and EF Core / SQL; CQRS without event sourcing explains that adoption boundary.
  • Components without Chronicle is a React library that renders Arc’s generated proxies as forms, tables, and dialogs. Those compositions still need Arc contracts; they are not a frontend-only integration for an arbitrary backend.
  • AuthProxy on its own is a gateway for authentication, tenancy, identity enrichment, routing, and invites in front of any backend and frontend you point it at.

Cratis recommends event sourcing for information systems and CQRS for separating changes from reads. Those are separate decisions: you can use Chronicle without Arc, and Arc can run without Chronicle.

The dependency only runs one way. Arc is a layer that can sit on top of Chronicle — but Chronicle’s clients never depend on Arc, which is why each works without the other. (Chronicle’s own server and Workbench happen to use Arc internally; that does not add Arc to your application.) AuthProxy sits at the edge and can front the app whether Arc is backed by MongoDB, EF Core, or Chronicle. What the full combination changes is how much of the application is handled by one coherent set of conventions.

Arc
command / query
+ typed proxies

MongoDB

EF Core / SQL

Chronicle
event sourcing

You want… Reach for Event sourcing?
History as the source of truth, from any backend or client runtime Chronicle on its own Yes
An event store over MongoDB, PostgreSQL, Microsoft SQL Server, or SQLite Chronicle with the matching storage backend Yes
A typed full-stack app over a traditional database Arc + Components over MongoDB / EF Core Not required
Authentication, tenancy, identity enrichment, and routing at the edge AuthProxy in front of your services Optional
A typed full-stack app and a full event history Arc + Chronicle + Components — the domain loop Yes
A SaaS application with edge routing, identity, tenant isolation, typed UI, history, and operations AuthProxy + Arc + Components + Chronicle + CLI Default

The last row is our default recommendation for a new information system. New to the stack? Choosing where to start walks through how to start there, or how to adopt one piece at a time in an existing system.

With AuthProxy at the edge, Chronicle as Arc’s persistence, and Components in React, one user action crosses the following boundaries. AuthProxy resolves identity and tenant context; Arc authorizes the operation before the command records a fact:

typed proxy via AuthProxy

tenant + identity

appends

projected into

served by query

typed proxy

Browser

AuthProxy
auth + tenant + identity

React UI
(Components)

Command
(Arc)

Event
(Chronicle)

Read model
(Chronicle)

Query
(Arc)

You write the command, event, and read-model definition on your chosen backend. Arc generates the client contract, and Components uses it in the screen. Chronicle keeps the events in the selected tenant’s namespace. You must still configure tenant membership checks and the storage isolation your application requires.

Cratis recommends immutable, past-tense, single-purpose events as the default source of truth for information systems. If an event needs nullable fields to describe different outcomes, consider whether those outcomes are separate facts. Keep the behavior and its specifications together in a vertical slice so the code can be read alongside the model.

The protocol and storage choices are separate from that domain model. Chronicle’s clients use the same gRPC/protobuf kernel boundary, with feature coverage documented per client. MongoDB, PostgreSQL, Microsoft SQL Server, and SQLite are storage options; choosing one does not require changing your event vocabulary.

Configuration still matters where responsibilities meet. Follow identity and access, authorization, tenancy, AuthProxy, and Chronicle namespaces for the boundaries your application uses. Naming and discovery conventions reduce repetitive registration, but they do not choose your access policy. Likewise, generated contracts, analyzers, and AI guidance help you check and navigate a feature; they do not establish that its behavior is correct.

When Cratis is a good fit — and when it isn’t

Section titled “When Cratis is a good fit — and when it isn’t”

Because the products are separable, “is Cratis a good fit?” is really a set of connected questions.

Arc is worth evaluating when you maintain the same contract in your backend and again in the frontend. Choose among TypeScript on Node.js, Kotlin or Java on Spring Boot, Elixir on Plug or Phoenix, and C# on ASP.NET Core. Its command/query boundary and generated proxies replace that duplication. You adopt its conventions for declaring and discovering endpoints, so try one feature before applying them across an existing application.

For event sourcing, Cratis’s default recommendation is yes for information systems. Choose Chronicle when decisions, processes, or integrations need a record of how they reached their current state. For a genuinely current-state-only slice, such as reference data or settings, Arc over a database can be the simpler boundary. Why Event Sourcing explains the recommendation and its trade-offs.

For a throwaway prototype, decide what you need to demonstrate. Evaluate event history or a typed command/query boundary in a small slice if either is part of the question. If neither is, leave Cratis out of the prototype.

When neither fits — a couple of static pages, say — Cratis is more than you need, and that’s fine. Your backend language narrows the choice more than it rules Cratis out: Arc and Chronicle have different language and feature coverage. Check Arc backends and Chronicle clients for the behavior you need; a language with a gRPC implementation can also implement Chronicle’s contracts.

Try modeled behavior before generating an application

Section titled “Try modeled behavior before generating an application”

Keep commands, events, and views together in a Screenplay .play model, then send a modeled command and see its resulting state in Stage. Stage runs only supported behavior in a disposable sandbox, not a production host; bind published ports to 127.0.0.1.