GraphQL API

Trax exposes a GraphQL endpoint powered by HotChocolate. It provides queries for inspecting trains, manifests, manifest groups, and executions, mutations for queuing/running trains and managing the scheduler, and real-time subscriptions for train lifecycle events via WebSocket.

var builder = WebApplication.CreateBuilder(args);
 
builder.Services.AddTrax(trax => trax
    .AddEffects(effects => effects.UsePostgres(connectionString))
    .AddMediator(typeof(Program).Assembly)
);
 
builder.Services.AddTraxGraphQL();  // Requires AddTrax() first — throws InvalidOperationException otherwise
 
var app = builder.Build();
 
app.UseTraxGraphQL(); // default: /trax/graphql (named schema — won't conflict with your own)
 
app.Run();

Navigate to the endpoint URL in a browser to open Banana Cake Pop, the built-in GraphQL IDE. It provides schema exploration, autocompletion, and query execution without any extra tooling.

Pages

PageDescription
AddTraxGraphQLRegistration and endpoint mapping
TraxQuery & TraxMutation AttributesOpt trains into the typed GraphQL schema with [TraxQuery] or [TraxMutation]
Querieshealth, trains, manifests, manifest, manifestGroups, executions, execution
MutationsGrouped into dispatch (auto-generated train mutations) and operations (scheduler control mutations)
SubscriptionsReal-time WebSocket events for train lifecycle transitions (onTrainStarted, onTrainCompleted, onTrainFailed, onTrainCancelled)
TraxBroadcast AttributeOpt trains into subscription events with [TraxBroadcast]

Package

dotnet add package Trax.Api.GraphQL