Host Arc for .NET
Choose the host and integrations before copying a bootstrap. Arc is standalone
CQRS; Chronicle is optional and its client connects to a separate event store.
Nothing in AddCratis() runs the Chronicle engine in your application.
Read references/connection-resolution.md when MongoDB or EF Core connections must resolve per tenant or use separate runtime and schema identities.
Verified product sources
| Package | Purpose |
|---|---|
Cratis, Cratis.Arc, Cratis.Arc.Core |
Composition, ASP.NET hosting and standalone host |
Cratis.Arc.Chronicle, Cratis.Arc.MongoDB, Cratis.Arc.EntityFrameworkCore |
Optional client/storage integrations |
Cratis.Arc.Screenplay.Embedded |
Optional embedded event-model explorer |
Source: Arc. Check signatures against the consumer's installed version.
Choose one bootstrap
| Setup | Configure before Build | Activate after Build |
|---|---|---|
ASP.NET, full event-sourced stack (Cratis) |
builder.AddCratis(...) |
app.UseCratis() |
ASP.NET, Arc only (Cratis.Arc) |
builder.AddCratisArc(...) |
app.UseCratisArc() |
Standalone HTTP host (Cratis.Arc.Core) |
ArcApplication.CreateBuilder(args), then builder.AddCratisArc(...) |
app.UseCratisArc() |
Full-stack ASP.NET bootstrap (requires the Cratis package and configured
Chronicle connection; it deliberately does not opt into unsigned headers):
// Copyright (c) Cratis. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.AspNetCore.Builder;
var builder = WebApplication.CreateBuilder(args);
builder.AddCratis();
var app = builder.Build();
app.UseCratis();
app.Run();
AddCratis composes Arc, WithChronicle and the Microsoft Identity Platform
header scheme. For your own authentication use AddCratisArc plus
WithChronicle, not AddCratis. For Arc without event sourcing use
AddCratisArc and your storage/services. On the standalone host the listen URL
comes from ArcOptions.Hosting.ApplicationUrl, not an argument to UseCratisArc.
Read integrations and publish boundaries
when selecting storage, disabling MVC, adding generated JSON contracts, or
configuring the explorer.
Keep trust and discovery explicit
- Forwarded identity headers are ignored by default. Set
Cratis:Arc:TrustForwardedIdentityHeaders=trueonly behind an authenticating, header-stripping ingress that prevents direct backend access.AddCratisregistering a scheme does not make the headers trusted. - Discovery is anonymous only in Development by default. Elsewhere it requires
authentication, or is unmapped (404) if the host cannot authenticate.
Introspection.RequireAuthenticationunset chooses that default; assigning false deliberately exposes it everywhere.Rolesimplies authentication and cannot combine with false. Disable bothIntrospection.EnabledandIntrospection.IdentityDiscoveryto remove all discovery;/.cratis/meremains. /.cratis/meuses the authenticated principal, not a readable identity cookie. Configure a real authentication mechanism before treating protected endpoints as usable. Seecratis-arc-authentication-authorization-and-identityfor the full ingress, identity and authorization contract.
Source: secure defaults.
Verify the host, not just the compilation
- Build in the actual shipping configuration and publish mode, zero warnings.
- Start against the intended Chronicle/storage services. Confirm activation maps one intended command and query; a successful Build alone proves neither.
- Exercise anonymous and authenticated requests in Development and Production. Check discovery switches and protected invocation independently.
- For trimmed/NativeAOT output, run that published binary and exercise JSON
responses (including each
CommandResult<TResponse>), not only an untrimmed Debug host. Missing metadata or service support is a failed publish check. - Confirm MVC and the embedded explorer are absent wherever they are not intended.
Route near misses
- Define the command and its proxy:
cratis-arc-command. - EF schema/migrations:
cratis-arc-ef-core-migration. - Authentication and identity:
cratis-arc-authentication-authorization-and-identity. - A standalone Chronicle client or running store: the Chronicle client/CLI skills.
- Several Arc services with their own event stores:
cratis-multi-service-architecture; running them together locally:cratis-multi-service-local-orchestration.