GraphQL API
The Trax GraphQL endpoint, served by HotChocolate as a named schema. API explains the layer; these pages describe it.
using Trax.Api.GraphQL.Extensions;
using Trax.Effect.Data.Postgres.Extensions;
using Trax.Effect.Extensions;
using Trax.Mediator.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddTrax(trax => trax
.AddEffects(effects => effects.UsePostgres(connectionString))
.AddMediator(typeof(Program).Assembly)
);
builder.Services.AddTraxGraphQL();
var app = builder.Build();
app.UseTraxGraphQL(); // default: /trax/graphql
app.Run();Trax.Api.GraphQL
- AddTraxGraphQL: registration, the builder methods, endpoint mapping.
- Queries: the
discoverandoperationsquery namespaces, one page per namespace. - Mutations: the
dispatchandoperationsmutation namespaces, one page per namespace. - Subscriptions: lifecycle, junction, machine instance and data change events; WebSocket and authentication.
- Machines root: each exposed state machine as its own typed operations.
- Views root: each view a host serves from features, read only by its readers.
- ConfigureFiltering: opt-in filter operators.
- Cross-schema data loaders: batched lookups across
DbContexts. - Error codes: every code in
extensions.code.
Trax.Effect
- TraxQuery and TraxMutation: expose a train as a query or mutation.
- TraxBroadcast: stream a train's lifecycle events.
- TraxQueryModel: expose an EF Core entity as a query.
Trax.Api
- AddTraxHealthCheck: the ASP.NET Core health check.