Skip to content

Cratis Arc CQRS framework with TypeScript clients

Last released · v25.23.0

Cratis Arc is a full-stack CQRS framework that exposes backend commands and queries over HTTP and generates TypeScript clients for your frontend. CQRS separates requests to change data (commands) from requests to read it (queries). Arc handles validation and authorization around those requests. Write the backend in C#, Kotlin or Java, TypeScript, or Go; each has a TypeScript client generator, with different coverage and verification limits. You can use current-state storage or add event sourcing.

Cratis Arc

CQRS application framework for C#, Kotlin, Java, TypeScript, and Go

Keep one feature’s command, read model, query, frontend, and specs together as a vertical slice. Arc exposes the backend contracts over HTTP and generates the TypeScript callers, so you can work on that feature without maintaining a second set of request types and HTTP calls. Start with application services or a database; Cratis Chronicle adds optional event sourcing, and Cratis Components adds optional React compositions.

Choose a host below to build your first command and query. On the C# path, configure proxy generation to produce TypeScript clients from recognized commands, queries, and included referenced types. A proxy is the generated frontend class that calls a backend command or query. After a backend contract changes, regenerate and type-check the frontend to catch structural mismatches. Runtime and integration checks are still needed; understand the proxy boundary before connecting your first screen.

Arc has implementations for ASP.NET Core, Spring Boot, Node.js, and Go. The TypeScript backend is published on npm (@cratis/arc.core, @cratis/platform). Arc for Go records its supported contracts and verification limits separately. Neither claims full parity with C#. Choose a backend below and compare the backend capabilities before relying on a shared example. The shared HTTP contract is verified for C# and JVM; TypeScript and Go document their coverage separately.

Starting the host verifies the setup path only. Commands, queries, generated proxies, persistence integrations, and frontend packages each have additional configuration and version requirements.

Arc supports model-bound commands and read-model query methods. C# also supports controller-based endpoints; the JVM implementation does not. The command and query pipelines handle dependency injection, validation, authorization, filters, execution scopes, result conversion, and HTTP exposure in C# and on the JVM. TypeScript implements a subset of these capabilities; consult its capability reference. For Go pipelines, hosting, and generated clients, use the Go guides and parity reference, not the framework-specific APIs below. The scenario recipes show the same task, such as validating a command, with backend examples where the capability is available.

Use a request/response query for a single result. Use an observable query when a screen needs updated results through a subscription, with a configured source of change notifications. The guides below explain transport, subscription, and lifecycle behavior. The TypeScript generator creates clients for recognized commands, queries, referenced types, validation rules, and identity details.

@cratis/arc supplies the TypeScript command, query, validation, identity, and messaging runtime used by generated proxies. @cratis/arc.react adds hooks, command forms, dialog infrastructure, identity composition, and query components. The composed CommandDialog used in the tutorial comes from the separate @cratis/components package. The optional React/MVVM package adds view models, dependency injection, route parameters, and browser abstractions.

Explore Arc’s frontend packages to choose the TypeScript, React, or React/MVVM path. Components is separate: applications may use Arc without Components, and may use the generated TypeScript clients without Arc’s React packages.

Arc includes pluggable identity and access behavior, identity-detail providers, server-side authorization and role checks, and frontend identity context. Tenant resolution can use a header, query parameter, claim, subdomain, fixed value, or development setting before provider-specific database or namespace mapping — see tenancy on C# or tenancy on Kotlin and Java.

Frontend visibility helpers do not replace server-side authorization. Tenant resolution also does not by itself establish isolation for an application or storage topology.

Choose storage for the feature you are building. Commands and queries can use application services or current-state persistence without an event log; Arc does not depend on Chronicle. If you want event sourcing, choose the Chronicle guide for your backend. Each backend integrates with its own ecosystem’s data access.

Arc can describe registered commands, queries, identity schemas, and OpenAPI operations at runtime. Repository packages also include analyzers, source generators, command-scenario testing, proxy-generation checks, Vite helpers, and Arc-specific ESLint rules.

These C# packages add capabilities a host opts into:

  • Agent tools over MCP — Cratis.Arc.Mcp serves chosen commands and queries as Model Context Protocol tools through the same pipelines
  • Availability gates — Cratis.Arc.Availability refuses commands and queries for parts of the application that are not available to a caller
  • Personal access tokens — Cratis.Arc.PersonalAccessTokens issues and verifies personal access tokens for capability endpoints
  • Azure connection authentication — Cratis.Arc.Connections.Azure signs connection resolution in with a managed or workload identity