Trax
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.
The Problem
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.
The Fix
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.
Use Only What You Need
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
Trax.Core — Type-safe pipelines
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.Core
var result = await train.Run(input); // Either<Exception, TOutput>
Trax.Effect — Execution logging and DI
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) ) );
Trax.Mediator — Decoupled dispatch
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.Mediator
builder.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);
Trax.Scheduler — Background job scheduling
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.Scheduler
Trax.Dashboard — Monitoring UI
A 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.Dashboard
builder.Services.AddTraxDashboard(); // ... app.UseTraxDashboard(); // Dashboard available at /trax
Quick Start
The fastest way to get a full project with scheduling and the dashboard:
dotnet new install Trax.Samples.Templates dotnet new trax-server -n MyApp
Packages
| 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.
Documentation
License
MIT
Trademark & Brand Notice
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.