A framework for readable .NET — build business logic as typed pipelines where each step has one job and errors short-circuit automatically. Start with zero infrastructure, then add execution logging, scheduling, and a monitoring dashboard as you need them.
Most service code is a sequence of steps: validate, transform, persist, notify. But the actual logic gets buried under try/catch blocks, null checks, and scattered side effects.
Trax replaces that with a pipeline — a typed chain of steps where each step's output feeds the next. If any step fails, the rest are skipped automatically. No try/catch required.
public class CreateUserTrain : Train<CreateUserRequest, User>
{
protected override async Task<Either<Exception, User>> RunInternal(CreateUserRequest input)
=> Activate(input)
.Chain<ValidateEmailStep>()
.Chain<CreateUserInDatabaseStep>()
.Chain<SendWelcomeEmailStep>()
.Resolve();
}A compile-time Roslyn analyzer catches type mismatches between steps before you ever run the code.
Trax is a stack of independent layers. Each one is a standalone package that builds on the one below it. You stop at whatever layer solves your problem.
dotnet add package Trax.Core # Just pipelines — no DI, no database, no infrastructure
dotnet add package Trax.Effect # + execution logging, DI, pluggable storage
dotnet add package Trax.Mediator # + decoupled dispatch (callers don't know which train runs)
dotnet add package Trax.Scheduler # + cron schedules, retries, dead-letter queues
dotnet add package Trax.Dashboard # + Blazor monitoring UI that mounts into your app
You have a sequence of steps and you want them composed with type safety and automatic error propagation. That's it. No database. No DI container. Just Activate -> Chain -> Resolve.
Good for: validation pipelines, data transformations, CLI tools, anywhere you'd write nested try/catch.
dotnet add package Trax.Corevar result = await train.Run(input); // Either<Exception, TOutput>Wraps every pipeline run with persistent metadata — state, timing, inputs, outputs, errors. Steps are resolved from your DI container. Pick a storage provider and every execution becomes a queryable record.
Good for: web APIs, services where you need to know what ran and why it failed.
dotnet add package Trax.Effect
dotnet add package Trax.Effect.Data.Postgres # or Trax.Effect.Data.InMemorybuilder.Services.AddTrax(trax =>
trax.AddEffects(effects =>
effects.UsePostgres(connectionString)
)
);Your controller or parent pipeline shouldn't reference concrete train types. TrainBus scans your assemblies, builds an input-to-train mapping, and dispatches by input type.
Good for: larger apps where multiple callers trigger trains, or where trains trigger other trains.
dotnet add package Trax.Mediatorbuilder.Services.AddTrax(trax =>
trax.AddEffects(effects =>
effects.UsePostgres(connectionString)
)
.AddMediator(typeof(Program).Assembly)
);
// In a controller or another train:
var user = await trainBus.Send<CreateUserRequest, User>(request);Cron-based and interval-based scheduling with retries, dead-letter handling, and dependent jobs. Every scheduled run is a normal pipeline execution — same logging, same visibility, same dashboard.
Good for: recurring jobs, ETL pipelines, nightly reports, periodic cleanup — anywhere you'd reach for Hangfire or Quartz.
dotnet add package Trax.SchedulerA Blazor Server dashboard that mounts directly into your existing ASP.NET Core app. No separate deployment. Browse executions, inspect failures, view schedules, toggle effect providers at runtime.
Good for: any app using Trax.Effect that needs operational visibility without building custom admin pages.
dotnet add package Trax.Dashboardbuilder.Services.AddTraxDashboard();
// ...
app.UseTraxDashboard();
// Dashboard available at /traxThe fastest way to get a full project with scheduling and the dashboard:
dotnet new install Trax.Samples.Templates
dotnet new trax-server -n MyApp| Package | Purpose |
|---|---|
| Trax.Core | Trains, steps, Memory, error propagation, compile-time analyzer |
| Trax.Effect | ServiceTrain, execution metadata, pluggable effect providers, DI |
| Trax.Effect.Data.Postgres | PostgreSQL storage provider |
| Trax.Effect.Data.InMemory | In-memory storage provider (dev/testing) |
| Trax.Mediator | TrainBus — route inputs to trains by type |
| Trax.Scheduler | Manifest-based scheduling, retries, dead-letter handling |
| Trax.Api.GraphQL | GraphQL API layer for train operations |
| Trax.Dashboard | Blazor Server monitoring UI |
| Trax.Samples | Sample apps and dotnet new trax-server template |
| Trax.Website | Source for traxsharp.net |
All packages are on NuGet.
MIT
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.