Trax.StateMachine.Persistence
1.68.0
Prefix Reserved
dotnet add package Trax.StateMachine.Persistence --version 1.68.0
NuGet\Install-Package Trax.StateMachine.Persistence -Version 1.68.0
<PackageReference Include="Trax.StateMachine.Persistence" Version="1.68.0" />
<PackageVersion Include="Trax.StateMachine.Persistence" Version="1.68.0" />
<PackageReference Include="Trax.StateMachine.Persistence" />
paket add Trax.StateMachine.Persistence --version 1.68.0
#r "nuget: Trax.StateMachine.Persistence, 1.68.0"
#:package Trax.StateMachine.Persistence@1.68.0
#addin nuget:?package=Trax.StateMachine.Persistence&version=1.68.0
#tool nuget:?package=Trax.StateMachine.Persistence&version=1.68.0
Trax.StateMachine
Part of Trax .NET: business logic you can call, schedule, or serve as an API, with every run recorded in your Postgres. Docs · Getting started · Repository
Trax.StateMachine is the portable state-machine engine: a multi-step flow's state as language-neutral JSON, with
each event's guard, reducer and caller rule declared as data. Trax.StateMachine.Persistence stores each
instance per user, runs a machine's one irreversible effect exactly once, and lets a state invoke a train.
@traxsharp/state-machine on npm runs the same machine in the browser.
Install
dotnet add package Trax.StateMachine.Persistence
dotnet add package Trax.StateMachine.Testing # in a test project
Example
From Author and serve a machine:
[TraxMachine]
public sealed class CheckoutMachine : Machine<CheckoutState, CheckoutTrigger>
{
protected override void Configure(IMachineBuilder<CheckoutState, CheckoutTrigger> m)
{
m.Id("checkout").Version(1) /* start, rules on Get, Watch and Discard */;
m.In(CheckoutState.Review)
.Context<CartContext>()
.On(CheckoutTrigger.Pay)
.AnyAuthenticated()
.WithInput<PayInput>()
.RunsOnce<ICharge>("checkout:charge")
.To(CheckoutState.Paid);
m.In(CheckoutState.Paid).Context<PaidContext>().Committed();
}
}
builder.Services.AddTrax(trax =>
trax.AddEffects(effects => effects.UsePostgres(connectionString))
.AddStateMachines(typeof(CheckoutMachine).Assembly)
.AddMediator(typeof(CheckoutMachine).Assembly));
The server runs ICharge once per send and fires Pay with its receipt. A client never fires Pay itself.
Where this fits
Trax is split into layers, one folder of this repository each. Take the ones you need; the trains you wrote do not change. You are here: Trax.StateMachine.
| 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, with authentication, audit and typed clients, 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 |
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 .NET 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
- Microsoft.EntityFrameworkCore (>= 10.0.12)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection (>= 10.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging (>= 10.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.13)
- Npgsql (>= 10.0.3)
- Trax.Effect (>= 1.68.0)
- Trax.Effect.Data (>= 1.68.0)
- Trax.StateMachine (>= 1.68.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Trax.StateMachine.Persistence:
| Package | Downloads |
|---|---|
|
Trax.Mediator
Decoupled dispatch for Trax .NET trains: ITrainBus runs the train registered for an input's type, so callers never reference a concrete train. Adds assembly scanning, the train registry, [TraxAuthorize] train authorization and concurrency limits. Install it when callers should hand over an input rather than inject a specific train. |
|
|
Trax.StateMachine.Testing
Cross-runtime differential conformance for Trax .NET 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 (@traxsharp/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.68.0 | 82 | 10/20/2026 |