Trax.Effect.StateMachine
1.57.4
Prefix Reserved
dotnet add package Trax.Effect.StateMachine --version 1.57.4
NuGet\Install-Package Trax.Effect.StateMachine -Version 1.57.4
<PackageReference Include="Trax.Effect.StateMachine" Version="1.57.4" />
<PackageVersion Include="Trax.Effect.StateMachine" Version="1.57.4" />
<PackageReference Include="Trax.Effect.StateMachine" />
paket add Trax.Effect.StateMachine --version 1.57.4
#r "nuget: Trax.Effect.StateMachine, 1.57.4"
#:package Trax.Effect.StateMachine@1.57.4
#addin nuget:?package=Trax.Effect.StateMachine&version=1.57.4
#tool nuget:?package=Trax.Effect.StateMachine&version=1.57.4
Trax.Effect
Part of Trax: business logic you can call, schedule, or serve as an API, with every run recorded in your Postgres. Docs · Getting started · All repos
Trax.Effect adds run records, dependency injection and storage providers to Trax trains, plus the portable state-machine engine. Its ServiceTrain runs the same chain as a Trax.Core Train, resolves junctions from DI, and writes a metadata row for every run. Trax.Mediator, Trax.Scheduler and the layers above it all run trains through it.
Install
dotnet add package Trax.Effect
dotnet add package Trax.Effect.Data.Postgres # or Trax.Effect.Data.Sqlite, or Trax.Effect.Data.InMemory
Install one storage package, since runs are recorded only through one: Postgres for production, SQLite for a single process, InMemory for tests.
Example
Adapted from the game server sample:
builder.Services.AddTrax(trax => trax
.AddEffects(effects => effects
.UsePostgres(connectionString)
.SaveTrainParameters()
.AddJunctionLogger()));
builder.Services.AddScopedTraxRoute<IRecalculateLeaderboardTrain, RecalculateLeaderboardTrain>();
public interface IRecalculateLeaderboardTrain
: IServiceTrain<RecalculateLeaderboardInput, RecalculateLeaderboardOutput>;
public class RecalculateLeaderboardTrain
: ServiceTrain<RecalculateLeaderboardInput, RecalculateLeaderboardOutput>,
IRecalculateLeaderboardTrain
{
protected override Task<Either<Exception, RecalculateLeaderboardOutput>> Junctions() =>
Chain<AggregateScoresJunction>()
.Chain<RankPlayersJunction>()
.Resolve();
}
public class RankPlayersJunction(ILogger<RankPlayersJunction> logger)
: Junction<RecalculateLeaderboardInput, RecalculateLeaderboardOutput> { /* ... */ }
Inject IRecalculateLeaderboardTrain and call Run(input). Each run writes a row to trax.metadata: when it started,
how it ended, and on failure the junction that threw and its exception. SaveTrainParameters() adds the input and output.
Where this fits
Trax is split into layers, one repo each. Take the ones you need; the trains you wrote do not change. You are here: Trax.Effect.
| Repo | 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, the state-machine engine |
| 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, with authentication, audit and typed clients |
| Trax.Dashboard | A Blazor Server UI for runs, schedules and dead letters, mounted in your app |
| 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 |
Docs live in Trax.Docs and are published at traxsharp.net/docs.
Contributing
Read AGENTS.md before changing code. Report vulnerabilities privately as described in SECURITY.md.
License
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.
| 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
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Trax.Effect.StateMachine:
| Package | Downloads |
|---|---|
|
Trax.Effect.StateMachine.Persistence
Persistence for the Trax snapshot state-machine engine: a user-scoped snapshot store with optimistic concurrency, the FE-drives/BE-validates draft service, and a generic exactly-once effect primitive (lease + fence token). |
|
|
Trax.Effect.StateMachine.Testing
Cross-runtime differential conformance for Trax state machines: replay a generated differential corpus through the C# engine and get back the cases it fails to reproduce. The corpus is produced by the TypeScript oracle (@trax/state-machine); this proves the two engine ports stay behaviorally identical. Framework-agnostic — returns a diff list you assert on. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.57.4 | 3 | 9/30/2026 |
| 1.57.3 | 46 | 9/30/2026 |
| 1.57.2 | 116 | 9/29/2026 |
| 1.57.1 | 118 | 9/29/2026 |
| 1.57.0 | 116 | 9/28/2026 |
| 1.56.0 | 147 | 9/27/2026 |
| 1.55.0 | 91 | 9/25/2026 |
| 1.54.2 | 150 | 9/24/2026 |
| 1.54.1 | 181 | 9/17/2026 |
| 1.54.0 | 910 | 9/15/2026 |
| 1.53.0 | 102 | 9/15/2026 |
| 1.51.0 | 863 | 8/19/2026 |
| 1.50.0 | 182 | 8/13/2026 |
| 1.49.0 | 135 | 8/13/2026 |
| 1.48.1 | 131 | 8/12/2026 |
| 1.48.0 | 128 | 8/12/2026 |
| 1.47.0 | 173 | 8/12/2026 |
| 1.46.0 | 278 | 8/1/2026 |
| 1.45.0 | 140 | 8/1/2026 |
| 1.44.2 | 137 | 8/1/2026 |