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.Samples holds complete Trax sample apps and the dotnet new templates for an API, a scheduler or a hub. It sits
last in the stack and uses every other layer; the templates ship as
Trax.Samples.Templates, and trax generate in
Trax.Cli builds on the hub template.
dotnet new install Trax.Samples.Templates
dotnet new trax-hub -n MyApp # or trax-api, trax-scheduler
cd MyApp && dotnet runEach template stores runs in memory, so it needs no database; swap UseInMemory() for UsePostgres(...) to keep them.
Each sample is a working app with its own projects under samples/. ChatService is the most complete.
| Sample | What it shows | Storage |
|---|---|---|
| ChatService | A chat app: mutation trains, and a lifecycle hook that publishes each result to room-scoped GraphQL subscriptions over WebSockets, with a React client | SQLite |
| GameServer | A GraphQL API (API keys and JWT) that queues work, and a scheduler whose local workers run leaderboard, rewards and match trains, with the dashboard | Postgres |
| Bookworm | Two domains, each with its own schema and DbContext, joined by a cross-schema GraphQL edge; also adopts the architecture-guard fixtures | Postgres |
| GraphQLClient | A gateway calling two downstream Trax servers through keyed Trax GraphQL clients, all started by one dotnet run |
In memory |
| EnergyHub | A hub (GraphQL, scheduler, dashboard) that runs no trains itself, and a separate worker process that claims and runs them | Postgres, RabbitMQ |
| ContentShield | An API that sends queued and run mutations over HTTP to a runner process standing in for a Lambda function | Postgres, RabbitMQ |
| PersistedOperations | An API that accepts only persisted operations, and a client that uploads, queries and hot-fixes them | Postgres |
| StateMachine | Two snapshot state machines (turnstile, checkout) served over GraphQL, with a React client driving them through the stateMachine mutations |
Postgres |
| SignalRDashboard | A Blazor Server page showing live train lifecycle events from the SignalR broadcaster | Postgres |
| ApiAudit | Every GraphQL request captured as an audit entry and written in batches to a console sink | SQLite |
| JobHunt | The baseline of a job-hunt CRM: GraphQL, API keys, the dashboard and domain migrations, with a React client | Postgres |
| TestRunner | NUnit test projects run as queued trains, with results streamed to a React client over subscriptions | Postgres |
| DataPipeline | The scheduler running three Flowthru data pipelines as a dependency chain | Postgres |
Trax is split into layers, one repo each. Take the ones you need; the trains you wrote do not change. You are here: Trax.Samples.
| 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.
Read AGENTS.md before changing code. Report vulnerabilities privately as described in SECURITY.md.
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.