Skip to content

Orleans tutorials and samples

Use this page to choose the right kind of learning material:

  • Quickstarts lead you through a focused task.
  • Tutorials teach a capability step by step.
  • Explanations describe how a complete application is modeled.
  • Samples are maintained, buildable applications which you can inspect and run.

For the bare minimum application, start with Orleans Hello World. It hosts a silo and calls a grain from one process.

For a more typical project structure, Build your first Orleans app using separate grain contract, implementation, silo, and external-client projects.

TutorialWhat it teaches
Deploy an Orleans application to Azure Container AppsRun, deploy, observe, and verify a multi-process Orleans application.
Test an Orleans application end to endProgress from a first cluster test to reusable fixtures and topology changes.
Build and recover a streaming applicationFollow events through a real provider and verify recovery from checkpoints.
Custom grain storageImplement and register an IGrainStorage provider.
Deploy and scale on AzureDeploy an Orleans app to Azure Container Apps and configure shared providers.
ArticleWhat it explains
Adventure game sampleHow rooms, players, and objects map to grains and ordinary values.
Why OrleansThe benefits and tradeoffs of the virtual actor model.
Orleans architecture design principlesThe design goals which shape Orleans APIs and runtime behavior.

The samples directory contains the official Orleans samples. Its sample catalog is generated from the repository manifest and is validated together with the sample projects.

SampleDemonstrates
Hello WorldA single-project silo, grain contract, implementation, reference, and call.
AdventureDomain modeling with grains and a standalone client.
ChirperPersistence, observers, and reentrant grains.
Simple StreamingStream producers, consumers, and subscriptions.
SampleDemonstrates
Shopping CartBlazor, persistence, and a multi-project application.
Blazor ServerA Blazor Server application backed by grains.
Blazor WebAssemblyA hosted WebAssembly client with an Orleans-backed server.
GPS TrackerASP.NET Core SignalR and IoT-style device updates.
Presence ServiceObservers and cooperating grains in a gaming scenario.
SampleDemonstrates
Bank AccountACID transactions across stateful grains.
Journaled Todo ListExperimental Journaling APIs, Aspire, and durable journaled grain state.
Journaling with Azure Blob JSONExperimental Journaling APIs with Azure Blob Storage.
Chat RoomA terminal chat application using Orleans Streams.
StocksGrain timers, HTTP calls, and temporary caching.

The Journaling samples use the experimental Microsoft.Orleans.Journaling package. They are separate from the supported Orleans Event Sourcing model.

SampleDemonstrates
Azure Container AppsA cluster, clients, dashboard, scaler, and Bicep deployment.
Azure App ServiceA multi-instance Orleans application on App Service.
Transport Layer SecurityMutual TLS for Orleans network communication.
VotingKubernetes-oriented deployment and the Orleans Dashboard.

The repository catalog also includes F#, Visual Basic, games, custom stream adapters, and other focused examples.

After cloning the Orleans repository, run the sample validation script from the repository root:

Terminal window
pwsh ./samples/Validate-Samples.ps1

The script validates the gallery manifest and builds every project in samples/Samples.slnx. Cloud credentials are needed only to run samples which connect to cloud services, not to compile them.