Skip to content

Latest commit

 

History

1,260 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trax .NET

CI NuGet npm License: MIT Docs

A headless web framework for .NET. Build a more robust frontend: whatever goes wrong, the backend gets it right, and every run is recorded in your Postgres. Docs · Getting started · Samples · NuGet · npm

Install

dotnet new install Trax.Samples.Templates
dotnet new trax-hub -n MyApp      # or trax-api, trax-scheduler

Every Trax package releases at one version, so install the same version of each one you take.

Example

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();
}

Where this fits

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, 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 and machines: a mutation per machine event, authorization checked on the server, persisted operations, audit and live subscriptions
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 Start here. Complete sample apps, and the trax-api, trax-scheduler and trax-hub templates
Trax.Api.StateMachine @traxsharp/state-machine, the TypeScript twin of the state-machine engine
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.

Contributing

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.

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.