Skip to content

Samples

Learn by running

Pick a journey. Open the code. Make it yours.

The samples keep the important parts close together: the intent, the events, the processing, and—where the sample has a frontend—the generated contracts and React experience.

Terminal window
# Choose a sample after cloning the repository
git clone https://github.com/Cratis/Samples.git
cd Samples

Learning track

Getting started

Meet Chronicle in a small application and follow an event from append to observation.

Start here None

Chronicle Backend

Append an immutable fact and read one event source's history through a focused HTTP API.

Chronicle
  • Configure one named Chronicle event store
  • Use ConceptAs and EventSourceId for clear domain values and identities
  • Read the stored history without introducing a projection
ASP.NET Core · Chronicle
Start here Terminal

Chronicle TypeScript Client

Append a fact from Node.js, let a reactor respond, and read the combined history.

Chronicle
  • Connect to Chronicle from Node.js with the @cratis/chronicle client
  • Append an immutable event and wait for its observers to catch up
  • Return a side-effect event from a reactor and read both facts back
Node.js · Chronicle
Start here Terminal

Learning path

Learn event sourcing step by step: append events, project a read model, serve it through Arc, react to checkout, specify behavior, evolve events, protect commands, and prepare for production.

ChronicleArc
  • Append events to the event log and read one event source's history back
  • Declare a projection with model-bound attributes and read the read model it builds
  • Turn the same events and read model into an Arc command and query API
Console · ASP.NET Core · Chronicle
Start here None

Chronicle with ASP.NET Core

Host the same event-processing concepts behind a small HTTP API.

Chronicle
  • Configure Chronicle through ASP.NET Core dependency injection
  • Register reducers, projections, reactors, and query services
  • Append events through minimal HTTP endpoints
ASP.NET Core · Chronicle · MongoDB

Learning track

Event processing

Turn recorded facts into useful views and follow-up behavior with projections, reducers, and reactors.

Focused None

Chronicle Processing

See one event stream feed a projection, reducer, and reactor without timing guesses.

ChronicleFundamentals
  • Use ConceptAs values and an EventSourceId identity throughout the model
  • Compare a model-bound projection with a prior-state reducer
  • Return a deterministic follow-up event from a reactor
ASP.NET Core · Chronicle
Focused Workbench and CLI

Chronicle Projection Styles

Build one order four ways and see where event counters differ from state-derived line counts.

ChronicleFundamentals
  • Compare model-bound attributes, a fluent projection, a stream-local reducer, and a PDL declaration
  • Join product names into keyed order lines and update the root timestamp from child-only events
  • Specify duplicate adds, quantity changes, removals, and cancellation without Docker
In-process read-model scenarios · ASP.NET Core · Chronicle Workbench

Learning track

Full-stack CQRS

Build typed commands and observable queries from C# through generated contracts to React.

Focused React

Idea Loom — Arc + React

Build a polished command-and-query experience with generated contracts and no event sourcing.

ArcComponentsFundamentals
  • Use ConceptAs values and validators in a model-bound Arc command
  • Generate TypeScript command, query, and read-model contracts
  • Compose React MVVM, an observable query, and a Cratis CommandDialog
ASP.NET Core · React
Focused React

Full-stack author registration

Register an author and watch the projected list update in a React screen.

ArcChronicleComponentsFundamentals
  • Return AuthorRegistered from the RegisterAuthor command
  • Project AuthorRegistered into an observable Author read model
  • Use generated command and query proxies in a React screen
ASP.NET Core · React · Chronicle · MongoDB

Learning track

Boundaries and isolation

Keep tenant data and bounded contexts separate while allowing explicit, typed communication.

Focused None

Chronicle Multi-Tenancy

Use Arc header tenancy to isolate the same workflow in separate Chronicle namespaces.

ArcChronicleFundamentals
  • Resolve the tenant from Arc's standard header
  • Map tenant context to Chronicle namespaces
  • Use the same EventSourceId safely in tenant A, tenant B, and Default
ASP.NET Core · Chronicle · MongoDB
Advanced None

Chronicle Cross-Store

Connect two named event stores through a typed outbox, filtered inbox, and local translation.

ChronicleFundamentals
  • Keep Orders and Fulfillment in separate event stores
  • Forward one narrow contract through source outbox and target inbox
  • Translate the contract into a target-owned event and read model
ASP.NET Core · Chronicle

Learning track

Operations

Create a known local symptom and learn to inspect Chronicle before taking action.

Focused Workbench and CLI

Chronicle Operations Diagnosis

Create one deterministic failed partition and find it with the CLI and Workbench.

ChronicleCratis CLIFundamentals
  • Use typed probe identity and name values
  • Create one stable reactor failure
  • Inspect the event, observer, and failed partition without repair actions
ASP.NET Core · Chronicle · CLI · Workbench

Learning track

Event-model views

View an application's event model and review a model generated from source.

Focused Event-model board

Coffee counter — Arc runtime event model

Open an Arc + Chronicle application's embedded event model in the browser.

ArcChronicleScreenplayCratis CLI
  • Map the viewer explicitly in Development
  • Explore commands, events, and an orders projection
  • Use cratis view without starting the application or Chronicle
ASP.NET Core · Chronicle · MongoDB
Focused Event-model board

Community kitchen — from Marten and Wolverine

Generate, validate, and review an event-model starting point from original C# source.

ScreenplayCratis CLI
  • Generate with the critter-stack provider without starting PostgreSQL
  • Compare unchanged generated output with a separately reviewed model
  • Inspect explicit Marten writes and a Wolverine aggregate handler
ASP.NET Core · Marten · Wolverine · PostgreSQL

Learning track

Model-first

Describe behavior as an executable model, compile it, and run its specifications.

Focused None

Model-First Library

Compile one Screenplay model and run its accepted and rejected examples through Stage.

ScreenplayStage
  • Describe concepts, a command, validation, and an event in one model
  • Keep accepted and rejected examples beside the behavior
  • Compile with Screenplay and run model specifications with Stage
Screenplay compiler · Stage specification runner
Focused None

Generated Values Shop

Declare server-owned identifiers once in a model, render them with Stage, write them by hand in Arc, and pin them in specs.

ScreenplayStageArcFundamentals
  • Choose a generation strategy per concept: prefixed ULID, TypeID, NanoID and random bytes
  • Keep generated identifiers out of the request with [GeneratedValue] Handle parameters
  • Use the command's received time for TypeID orders through IGeneratableInContext
Screenplay compiler and evaluator · Cratis CLI renderer · Arc command scenarios

Learning track

Full applications

Explore how Cratis products fit together across backend, frontend, runtime, and local composition.

Showcase React

Library

Tour a larger Cratis application with separate lending and membership experiences.

ArcChronicleComponents
  • Organize behavior as cohesive vertical slices
  • Generate TypeScript contracts from backend commands and queries
  • Compose separate lending and membership applications for local development
ASP.NET Core · React · Aspire · Chronicle · MongoDB

At a glance

Compare the samples

Choose by experience, stack, and the tools you already have installed.

Sample Experience Products Runtime Prerequisites
Chronicle Backend None Chronicle ASP.NET Core, Chronicle .NET 10 SDK, Docker, curl
Chronicle TypeScript Client Terminal Chronicle Node.js, Chronicle Node.js 23 or newer, npm, Docker
Learning path Terminal Chronicle, Arc Console, ASP.NET Core, Chronicle .NET 10 SDK, Docker, curl
Chronicle Processing None Chronicle, Fundamentals ASP.NET Core, Chronicle .NET 10 SDK, Docker, curl
Chronicle Projection Styles Workbench and CLI Chronicle, Fundamentals In-process read-model scenarios, ASP.NET Core, Chronicle Workbench .NET 10 SDK, Docker and a browser only for the optional Workbench preview
Idea Loom — Arc + React React Arc, Components, Fundamentals ASP.NET Core, React .NET 10 SDK, Node.js 23 or newer, Yarn
Full-stack author registration React Arc, Chronicle, Components, Fundamentals ASP.NET Core, React, Chronicle, MongoDB .NET 10 SDK, Node.js 23 or newer, npm, Docker
Chronicle Multi-Tenancy None Arc, Chronicle, Fundamentals ASP.NET Core, Chronicle, MongoDB .NET 10 SDK, Docker, curl
Chronicle Cross-Store None Chronicle, Fundamentals ASP.NET Core, Chronicle .NET 10 SDK, Docker, curl
Chronicle with ASP.NET Core None Chronicle ASP.NET Core, Chronicle, MongoDB .NET 10 SDK, Docker, curl
Chronicle Operations Diagnosis Workbench and CLI Chronicle, Cratis CLI, Fundamentals ASP.NET Core, Chronicle, CLI, Workbench .NET 10 SDK, Docker, Cratis CLI, curl
Coffee counter — Arc runtime event model Event-model board Arc, Chronicle, Screenplay, Cratis CLI ASP.NET Core, Chronicle, MongoDB .NET 10 SDK, Docker, Browser
Community kitchen — from Marten and Wolverine Event-model board Screenplay, Cratis CLI ASP.NET Core, Marten, Wolverine, PostgreSQL .NET 10 SDK, VS Code or an MCP Apps-capable chat client or a browser
Model-First Library None Screenplay, Stage Screenplay compiler, Stage specification runner .NET 10 SDK, Built Screenplay checkout, Built Stage checkout
Generated Values Shop None Screenplay, Stage, Arc, Fundamentals Screenplay compiler and evaluator, Cratis CLI renderer, Arc command scenarios .NET 10 SDK
Library React Arc, Chronicle, Components ASP.NET Core, React, Aspire, Chronicle, MongoDB .NET 10 SDK, Node.js 23 or newer, Corepack/Yarn, Docker, Bash
  1. Read its README. Each sample starts with the shape of the application and the shortest path to running it.
  2. Run the happy path. Start the sample as instructed, perform its documented action, and check its expected result before changing code.
  3. Open Chronicle Workbench when Chronicle is involved. Compare the resulting events and read-side state with the action you just performed.
  4. Change one thing. Add a fact, a view, or a user interaction and see which parts of the slice move together.

A focused sample intentionally leaves things out so one concept stays easy to see. The larger applications show how those concepts meet in a real repository. Neither is a production template. Follow the selected sample’s README for its prerequisites and local-development assumptions. If the sample does not build at your installed package version, report the failure in the Samples repository instead of treating the documentation site’s build as a sample check.