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 discover and operations query namespaces, one page per namespace.
  • Mutations: the dispatch and operations mutation 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

Trax.Api