Skip to content

Latest commit

History

1,653 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Cratis Samples

Learn the Cratis stack by running real applications

From a small Chronicle process to a React application composed with Arc, Components, and Aspire.

BuildUpdate dependenciesDocumentation

Explore the samples · Run locally · Browse the documentation


Pick a sample

SampleExperienceProductsStart here
Chronicle BackendHTTP APIChronicleAppend one immutable fact and read an event source's history.
Chronicle ProcessingHTTP APIChronicle, FundamentalsCompare a projection, reducer, and reactor on one event stream.
Idea Loom — Arc + ReactReactArc, Components, FundamentalsFollow a typed command and observable query from C# to a polished UI.
Chronicle Multi-TenancyHTTP APIArc, Chronicle, FundamentalsIsolate the same typed workflow across tenant namespaces.
Chronicle Cross-StoreHTTP APIChronicle, FundamentalsConnect two event stores through an outbox, inbox, and local translation.
Chronicle Operations DiagnosisCLI + WorkbenchChronicle, CLI, FundamentalsCreate one known failure and learn to inspect it before repair.
Chronicle with ASP.NET CoreHTTP APIChronicleHost Chronicle through dependency injection and expose focused endpoints.
Model-First LibraryExecutable modelScreenplay, StageCompile one modeled workflow and run its accepted and rejected examples.
LibraryReact + APIsArc, Chronicle, ComponentsExplore separate lending and membership applications under one local composition.

Tip

Start with Chronicle Backend for the smallest HTTP path, then open Chronicle Processing to compare projections, reducers, and reactors. Move to Library when you want generated TypeScript contracts and React.

What the journey looks like

Arc: command → current-state store → observable query → React
Chronicle: append → event history → projections / reactions → views
Model-first: .play model → Screenplay compiler → Stage specifications

Choose the path matching what you want to learn. The focused samples keep one idea in view; Library brings several paths together in a larger application.

Run locally

You will need

  • .NET 10 SDK
  • Docker or another compatible container runtime
  • Node.js 23 or newer for the React applications
  • Corepack/Yarn for frontend work

Clone the repository and validate the catalog:

git clone https://github.com/Cratis/Samples.git
cd Samples
corepack enable
yarn install
yarn samples:validate
yarn lint:ci
yarn build

Build the .NET samples:

dotnet restore Samples.slnx
dotnet build Samples.slnx --configuration Debug
dotnet test Samples.slnx --configuration Debug --no-build
dotnet build Samples.slnx --configuration Release -p:CratisProxiesOutputPath=

Each sample README contains its own infrastructure and run commands, a short tour of the code, and ideas to try next.

How the repository is organized

Arc/ standalone Arc and React samples
Chronicle/ focused Chronicle samples
ModelFirst/ executable Screenplay and Stage samples
Library/ the larger React and multi-service showcase
samples.json the catalog used by repository checks and the documentation site
scripts/ catalog and repository checks

The catalog is deliberately machine-readable. The Cratis documentation sample roster is generated from it so descriptions and source links stay aligned with the runnable projects. A sample can add previewUrl and previewLabel when a real read-only experience, such as an event-model viewer, is available.

Samples are for learning

These projects favor clarity and visible behavior. They demonstrate exact, documented combinations of Cratis packages and local infrastructure; they are not production templates or support commitments. Every sample calls out the pieces it intentionally leaves out.

Contributing a sample

A sample should be enjoyable to explore and easy to understand:

  1. Give it one clear learning goal.
  2. Keep it independently runnable.
  3. Include an inviting README.md with an architecture sketch, exact commands, expected behavior, and a few ideas to try.
  4. Add tests for the behavior the sample teaches.
  5. Add the entry to samples.json.
  6. Run yarn samples:validate and the sample's own build and test commands.

Build something, change it, and watch the model and runtime tell the same story.

About

Samples using the different parts of Cratis

Resources

Code of conduct

Contributing

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages