The backend that checks the client's work. State machines and workflows the server enforces, with every run recorded in your database. What Trax does · Docs · Getting started · Samples · NuGet · npm
dotnet new install Trax.Samples.Templates
dotnet new trax-hub -n MyApp # or trax-api, trax-schedulerEvery Trax package releases at one version, so install the same version of each one you take.
A train is a chain of junctions. Run it directly, queue it, schedule it, or let Trax.Api serve it as GraphQL; each
run writes a row to trax.metadata. A state machine marked [TraxMachine] is served as its own typed API, applied on
the server, and a machine state can run a train.
public class RecalculateLeaderboardTrain
: ServiceTrain<RecalculateLeaderboardInput, RecalculateLeaderboardOutput>,
IRecalculateLeaderboardTrain
{
protected override Task<Either<Exception, RecalculateLeaderboardOutput>> Junctions() =>
Chain<AggregateScoresJunction>()
.Chain<RankPlayersJunction>()
.Resolve();
}Trax is split into layers, one folder each, and every package releases at one version from this repository. Each .NET folder depends only on folders above it in this table; take the layers you need, and the trains you wrote do not change.
| Folder | What it adds |
|---|---|
| Trax.Core | Trains, junctions and the chain, with no database and no DI container |
| Trax.Effect | A recorded run for every execution (Postgres, SQLite or in memory), DI, effect providers |
| Trax.StateMachine | State machines a page drives and the server applies, in C# and TypeScript, held to one conformance kit |
| Trax.Mediator | The train bus: run a train by handing over its input, with every chain checked at startup |
| Trax.Scheduler | Cron and interval schedules, retries, dead letters, and workers on other machines or in Lambda |
| Trax.Api | GraphQL generated from your trains and machines: a mutation per machine event, authorization checked on the server, persisted operations, audit, live subscriptions and the operations console your host serves |
| Trax.Cli | The trax tool: scaffold a hub and trains from an OpenAPI or GraphQL schema, and state-machine codegen |
| Trax.Samples | Complete sample apps, and the trax-api, trax-scheduler and trax-hub templates |
| Trax.Docs | The documentation published at traxsharp.net/docs, and the decision records |
| Trax.Website | The source of traxsharp.net |
Trax used to be split into one repository per layer (TraxSharp/Trax.Core and the rest). Those are archived; their
history is here, under each folder.
Release notes, pull requests and the docs mark each change with the parts of Trax it touches. The parts are concepts,
not folders: Trax.Effect alone holds data, plumbing and trains. A change that crosses several shows
several squares, innermost first.
| Part | What it covers | |
|---|---|---|
| 🟨 | Data | The run-record tables, migrations and the Postgres, SQLite and in-memory providers |
| 🟫 | Plumbing | Effect and junction providers, broadcasters (RabbitMQ, SignalR), lifecycle hooks |
| 🟩 | Trains | Trains, junctions, chains, decisions, Parallel |
| 🟪 | Machines | State machines, in .NET and in @traxsharp/state-machine |
| 🟧 | Dispatch | The train bus, authorization, the scheduler (manifests, retries, dead letters), remote workers and Lambda |
| 🟦 | Surface | Trax.Api: GraphQL, auth, persisted operations, generated clients, the operations console |
| ⬛ | Tooling | The trax CLI, analyzers, architecture guards, CI, releases, the docs |
| 🟥 | Security | Not a part: a flag on any change to authentication, authorization or what is exposed |
A release note headed 🟧🟦🟥, for example, changes how work is dispatched and what the API serves, and it is worth reading for its security impact before you upgrade.
Trax is sponsored by Constituent Voice. To support it too, see GitHub Sponsors.
Read AGENTS.md before changing anything, then the AGENTS.md in the folder you are working in. Report
vulnerabilities privately as described in SECURITY.md.
MIT. There is no commercial edition, and there will not be one.
Trax is an independent open-source project and is not affiliated with the Utah Transit Authority, Trax Retail, or any other organization using the Trax name.
