Trax.Api.GraphQL.Testing
1.44.1
Prefix Reserved
See the version list below for details.
dotnet add package Trax.Api.GraphQL.Testing --version 1.44.1
NuGet\Install-Package Trax.Api.GraphQL.Testing -Version 1.44.1
<PackageReference Include="Trax.Api.GraphQL.Testing" Version="1.44.1" />
<PackageVersion Include="Trax.Api.GraphQL.Testing" Version="1.44.1" />
<PackageReference Include="Trax.Api.GraphQL.Testing" />
paket add Trax.Api.GraphQL.Testing --version 1.44.1
#r "nuget: Trax.Api.GraphQL.Testing, 1.44.1"
#:package Trax.Api.GraphQL.Testing@1.44.1
#addin nuget:?package=Trax.Api.GraphQL.Testing&version=1.44.1
#tool nuget:?package=Trax.Api.GraphQL.Testing&version=1.44.1
Trax.Api
GraphQL API for Trax, a .NET framework for building trains (typed pipelines of junctions) with execution logging, scheduling and dispatch. Trax.Api exposes train discovery, execution, and scheduler operations over HTTP via HotChocolate, generates queries over your own [TraxQueryModel] entities, and ships optional authentication and audit packages.
The Trax Stack
Trax is a layered framework split across several repos. You can stop at whatever layer solves your problem. You are here: Trax.Api.
| Repo | Adds |
|---|---|
| Trax.Core | Pipelines, junctions, railway error propagation |
| Trax.Effect | Execution logging, DI, pluggable storage |
| Trax.Mediator | Decoupled dispatch via TrainBus |
| Trax.Scheduler | Cron schedules, retries, dead-letter queues |
| Trax.Api | GraphQL API for remote access |
| Trax.Dashboard | Blazor monitoring UI |
| Trax.Cli | trax-cli project scaffolding tool |
| Trax.Samples | Sample apps and a dotnet new template |
Full documentation: traxsharp.net/docs.
What This Does
Adds a programmatic interface to your train network. External consumers can discover registered trains, run them on demand, queue work for the scheduler, and manage manifests, all through a typed GraphQL schema.
The API is designed to run on a separate machine from the scheduler. Both share a PostgreSQL database: the API writes work queue entries, the scheduler polls and dispatches. This means the API server is a thin HTTP layer with no polling services or background workers.
Installation
dotnet add package Trax.Api.GraphQL
dotnet add package Trax.Effect.Data.Postgres # the data provider behind UsePostgres below
Trax.Api.GraphQL depends on Trax.Api and Trax.Mediator, so you don't need to reference them directly.
Setup
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)
);
// AddTraxGraphQL requires AddTrax to have been called first, and throws otherwise.
builder.Services.AddTraxGraphQL();
var app = builder.Build();
app.UseTraxGraphQL(); // maps at /trax/graphql
app.Run();
Two Execution Modes
| Mode | How It Works | When to Use |
|---|---|---|
| Queue | Creates a WorkQueue entry. The scheduler picks it up and dispatches on the scheduler machine. |
Heavy trains, recurring work, dedicated scheduler infrastructure. |
| Run | Calls ITrainBus.RunAsync in-process on the API machine. |
Lightweight on-demand trains where you need the result immediately. |
Trains opt into the GraphQL schema with [TraxQuery] or [TraxMutation] attributes. Only annotated trains get typed fields generated.
Authentication
UseTraxGraphQL accepts a configure callback for endpoint-level auth:
app.UseTraxGraphQL(configure: endpoint => endpoint
.RequireAuthorization("AdminPolicy"));
For per-train authorization, decorate train classes with [TraxAuthorize]:
[TraxAuthorize("Admin")]
[TraxMutation(GraphQLOperation.Run)]
public class SensitiveTrain : ServiceTrain<SensitiveInput, Unit>, ISensitiveTrain { ... }
Security Disclaimer
NO WARRANTY. Trax auth is plumbing, not a security product. You are solely responsible for securing systems that use it. See SECURITY-DISCLAIMER.md.
Trax.Api ships authentication (Trax.Api.Auth, Trax.Api.Auth.ApiKey) and audit (Trax.Api.GraphQL.Audit) packages. They provide the glue between ASP.NET Core's auth primitives and Trax's train dispatch. They do not guarantee that a system using them is secure. Read SECURITY-DISCLAIMER.md before deploying.
Packages
| Package | Description |
|---|---|
Trax.Api |
Core library: DTOs, health check, shared service registration |
Trax.Api.GraphQL |
HotChocolate schema (queries, mutations, subscriptions) |
Trax.Api.GraphQL.Client |
Runtime-validated GraphQL client: hand-written queries checked against the server schema at startup |
Trax.Api.GraphQL.Client.Trax |
Trax integration for the client: query junctions, log correlation, schema discovery |
Trax.Api.GraphQL.Client.Typed |
Queries derived from POCOs, built against the live schema at startup |
Trax.Api.GraphQL.PersistedOperations |
Server-managed persisted operations, so shipped clients can be hot-fixed |
Trax.Api.GraphQL.Testing |
Architecture-guard checkers for cross-schema edges and loaders |
Trax.Api.Auth |
Principal abstraction and claim-type constants (no scheme). NO WARRANTY. |
Trax.Api.Auth.ApiKey |
API-key authentication handler. NO WARRANTY. |
Trax.Api.Auth.Jwt |
JWT bearer authentication, plus Google, Auth0, Entra and Cognito presets. NO WARRANTY. |
Trax.Api.Auth.Jwt.Cognito |
Amazon Cognito token validation and claim normalization. NO WARRANTY. |
Trax.Api.Auth.Jwt.Cognito.Issuer |
Cognito-shaped token minting and a refresh-token store. NO WARRANTY. |
Trax.Api.Auth.Jwt.Testing |
JWKS server and token minters for integration tests. NO WARRANTY. |
Trax.Api.Auth.Oidc |
OpenID Connect code flow with a session cookie. NO WARRANTY. |
Trax.Api.GraphQL.Audit |
GraphQL request audit pipeline (listener, channel, writer, sink). NO WARRANTY. |
Reference: GraphQL API, API Auth, API Security.
Next Layer
When you need a monitoring UI for inspecting trains, browsing execution history, and managing manifests from a browser, move up to Trax.Dashboard.
License
MIT
Trademark & Brand Notice
Trax is an open-source .NET framework provided by TraxSharp. This project is an independent community effort and is not affiliated with, sponsored by, or endorsed by the Utah Transit Authority, Trax Retail, or any other entity using the "Trax" name in other industries.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- HotChocolate (>= 16.6.2)
- HotChocolate.AspNetCore (>= 16.6.2)
- HotChocolate.AspNetCore.Authorization (>= 16.6.2)
- HotChocolate.CostAnalysis (>= 16.6.2)
- HotChocolate.Data (>= 16.6.2)
- HotChocolate.Data.EntityFramework (>= 16.6.2)
- HotChocolate.Execution.Projections (>= 16.6.2)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.9)
- Microsoft.CodeAnalysis.CSharp (>= 5.9.0)
- Microsoft.EntityFrameworkCore (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- NUnit (>= 4.6.1)
- Trax.Api.GraphQL (>= 1.44.1)
- Trax.Core.Testing (>= 1.7.4)
- Trax.Effect (>= 1.57.1)
- Trax.Effect.Data (>= 1.57.1)
- Trax.Mediator (>= 1.23.0)
- Trax.Scheduler (>= 1.34.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.44.2 | 0 | 10/1/2026 |
| 1.44.1 | 113 | 9/29/2026 |
| 1.44.0 | 61 | 9/29/2026 |
| 1.43.2 | 119 | 9/24/2026 |
| 1.43.1 | 143 | 9/16/2026 |
| 1.43.0 | 88 | 9/16/2026 |
| 1.42.0 | 93 | 9/15/2026 |
| 1.41.1 | 105 | 9/2/2026 |
| 1.41.0 | 105 | 9/2/2026 |
| 1.40.0 | 208 | 7/29/2026 |
| 1.39.0 | 136 | 7/8/2026 |
| 1.38.1 | 155 | 7/6/2026 |
| 1.38.0 | 166 | 6/2/2026 |
| 1.37.0 | 134 | 6/2/2026 |
| 1.36.0 | 130 | 6/2/2026 |