IntrepidDeveloper.Aspire.Hosting.Railway 13.5.0-preview.12

This is a prerelease version of IntrepidDeveloper.Aspire.Hosting.Railway.
dotnet add package IntrepidDeveloper.Aspire.Hosting.Railway --version 13.5.0-preview.12
                    
NuGet\Install-Package IntrepidDeveloper.Aspire.Hosting.Railway -Version 13.5.0-preview.12
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IntrepidDeveloper.Aspire.Hosting.Railway" Version="13.5.0-preview.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IntrepidDeveloper.Aspire.Hosting.Railway" Version="13.5.0-preview.12" />
                    
Directory.Packages.props
<PackageReference Include="IntrepidDeveloper.Aspire.Hosting.Railway" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IntrepidDeveloper.Aspire.Hosting.Railway --version 13.5.0-preview.12
                    
#r "nuget: IntrepidDeveloper.Aspire.Hosting.Railway, 13.5.0-preview.12"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IntrepidDeveloper.Aspire.Hosting.Railway@13.5.0-preview.12
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IntrepidDeveloper.Aspire.Hosting.Railway&version=13.5.0-preview.12&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=IntrepidDeveloper.Aspire.Hosting.Railway&version=13.5.0-preview.12&prerelease
                    
Install as a Cake Tool

Aspire Hosting for Railway

NuGet License: MIT

Aspire 13.5 hosting so aspire publish, aspire deploy, and aspire destroy can target Railway. Local aspire run stays the normal Aspire model and never needs a Railway token.

Status

Preview on nuget.org. Pack also publishes a GitHub Release and GitHub Packages. nuget.org uses Trusted Publishing (OIDC, no stored key). Current version: 13.5.0-preview.12 (from Directory.Build.props). MIT. Pinned to Aspire.Hosting 13.5.0 / net10.0. See CHANGELOG.md.

Packages

Package Role
IntrepidDeveloper.Aspire.Hosting.Railway Compute environment, pipeline, GraphQL client, PublishAsRailwayService
IntrepidDeveloper.Aspire.Hosting.Railway.PostgreSQL AddPostgres locally; PublishAsRailwayPostgres on deploy
IntrepidDeveloper.Aspire.Hosting.Railway.Redis AddRedis locally; PublishAsRailwayRedis on deploy
IntrepidDeveloper.Aspire.Hosting.Railway.Storage AddRailwayBucket: local S3-compatible container; Railway bucket on deploy
IntrepidDeveloper.Aspire.Railway.Storage Client: AddRailwayBucketClient registers IAmazonS3

AppHost extensions live in Aspire.Hosting. Resource types live in Aspire.Hosting.Railway / .PostgreSQL / .Redis / .Storage. Official Postgres and Redis templates are volume-backed, so Railway replicas cannot be used with them.

Quick start

using Aspire.Hosting.Railway;

var builder = DistributedApplication.CreateBuilder(args);

var ghcr = builder.AddContainerRegistry("ghcr", "ghcr.io", "intrepid-developer/playground");
var railway = builder.AddRailwayEnvironment("railway")
    .WithContainerRegistry(ghcr);

var db = builder.AddPostgres("postgres").PublishAsRailwayPostgres(s =>
{
    s.VolumeBackupDaily = true;
    s.VolumeBackupWeekly = true;
});
var cache = builder.AddRedis("redis").PublishAsRailwayRedis();
var uploads = builder.AddRailwayBucket("uploads");

builder.AddProject<Projects.Api>("api")
    .WithReplicas(2)
    .WithHttpHealthCheck("/health")
    .WithReference(db)
    .WithReference(cache)
    .WithReference(uploads)
    .WaitFor(db)
    .WithExternalHttpEndpoints()
    .PublishAsRailwayService(s =>
    {
        s.Region = RailwayRegion.UsWest2;
        s.Cpu = 1;
        s.MemoryGb = 2;
        s.HealthcheckTimeoutSeconds = 120;
        s.RestartPolicy = RailwayRestartPolicy.OnFailure;
        s.RestartPolicyMaxRetries = 10;
        s.CustomDomains.Add("api.example.com");
    });

builder.Build().Run();

AddContainerRegistry is required (GHCR or Docker Hub; Railway has no registry). Pass owner/repo as the third argument. Aspire marks the registry APIs experimental (ASPIRECOMPUTE003). See Getting started for the rest.

In the API project:

builder.AddNpgsqlDataSource("postgres");
builder.AddRedisClient("redis");
builder.AddRailwayBucketClient("uploads"); // IAmazonS3

Restore from nuget.org. No extra feed or PAT. These are prerelease packages, so use --prerelease or pin the version in PackageReference as below.

dotnet add package IntrepidDeveloper.Aspire.Hosting.Railway --prerelease
dotnet add package IntrepidDeveloper.Aspire.Hosting.Railway.PostgreSQL --prerelease
dotnet add package IntrepidDeveloper.Aspire.Hosting.Railway.Redis --prerelease
dotnet add package IntrepidDeveloper.Aspire.Hosting.Railway.Storage --prerelease
dotnet add package IntrepidDeveloper.Aspire.Railway.Storage --prerelease

GitHub Packages feed: see Getting started. Do not commit PATs or packageSourceCredentials.

AppHost (IntrepidDeveloper.Aspire.Hosting.Railway*):

<PackageReference Include="IntrepidDeveloper.Aspire.Hosting.Railway" Version="13.5.0-preview.12" />
<PackageReference Include="IntrepidDeveloper.Aspire.Hosting.Railway.PostgreSQL" Version="13.5.0-preview.12" />
<PackageReference Include="IntrepidDeveloper.Aspire.Hosting.Railway.Redis" Version="13.5.0-preview.12" />
<PackageReference Include="IntrepidDeveloper.Aspire.Hosting.Railway.Storage" Version="13.5.0-preview.12" />

API / consuming project (AddRailwayBucketClient plus the usual Aspire clients):

<PackageReference Include="IntrepidDeveloper.Aspire.Railway.Storage" Version="13.5.0-preview.12" />
<PackageReference Include="Aspire.Npgsql" Version="13.5.0" />
<PackageReference Include="Aspire.StackExchange.Redis" Version="13.5.0" />

Auth

Use an account or workspace token. Project tokens cannot call projectCreate.

Where What
AppHost parameter railway-token (Aspire resource names cannot contain underscores)
Local / config RAILWAY_TOKEN
CI RAILWAY_API_TOKEN or RAILWAY_TOKEN
Adopt existing railway-project-id / railway-environment-id, bound from RAILWAY_PROJECT_ID / RAILWAY_ENVIRONMENT_ID

Local aspire run needs no token.

Publish vs deploy

Publish Deploy Destroy
Command aspire publish aspire deploy aspire destroy (--yes / --non-interactive --yes skip the prompt)
Talks to Railway? No Yes (GraphQL) Yes (GraphQL)
Output railway-plan.json plus a .env.example of captured parameter names Created or adopted Railway project, environment, services, templates, buckets Tears down resources this integration created in the mapped Railway environment
Secrets Parameter names and Railway expressions when you use AddParameter. WithEnvironment string literals are written as-is Resolves the token and parameter values in memory; never writes those to the plan or deployment state Same token rules as deploy; never writes secrets

AddRailwayEnvironment is the Railway project (compute environment). The Railway environment name is mapped from Aspire --environment: Production → production, Staging → staging (lowercase). Override with WithRailwayEnvironmentName.

Limits

  • Railway has no image registry. Push to GHCR or Docker Hub, then deploy sets source.image.
  • This integration does not shell out to railway up. Railpack has no .NET support; use an image or a Dockerfile.
  • aspire destroy tears down resources this integration created in the mapped Railway environment (production / staging). Adopted resources (AsExisting(), railway-project-id / railway-environment-id, or a live name match) are skipped. The Railway project is not deleted. Buckets are skipped — public GraphQL has no bucketDelete. This is not in-deploy overlap/drain.
  • PR / ephemeral Railway environments are not in this release.
  • MySQL, MongoDB, and HA / PgBouncer are later. PITR enable is HA-only and is not in this slice.
  • Railway buckets are private. Use S3 credentials or presigned URLs. They are not on private DNS.
Where Settings
Aspire-core WithReplicas, WithHttpHealthCheck, WithExternalHttpEndpoints
PublishAsRailwayService Region / ReplicaRegions, Serverless, Cpu / MemoryGb, HealthcheckTimeoutSeconds, RestartPolicy, StartCommand / PreDeployCommand, OverlapSeconds / DrainingSeconds, CronSchedule, CustomDomains
PublishAsRailwayPostgres VolumeBackupDaily / Weekly / Monthly

Full mapping and constraints (5-minute cron floor, no replicas with volumes, cron vs replicas/serverless, DNS TXT for custom domains, image start is exec form / wrap $PORT) live in Publish and deploy.

Kitchen-sink service: region, CPU/RAM, sleep-when-idle, healthcheck timeout, restart, start / pre-deploy, overlap / drain, and a custom hostname. Image start is exec form — wrap $PORT.

builder.AddProject<Projects.Api>("api")
    .WithReplicas(2)
    .WithHttpHealthCheck("/health")
    .WithComputeEnvironment(railway)
    .PublishAsRailwayService(s =>
    {
        s.Region = RailwayRegion.EuropeWest4;
        s.Cpu = 1;
        s.MemoryGb = 2;
        s.Serverless = true;
        s.HealthcheckTimeoutSeconds = 120;
        s.RestartPolicy = RailwayRestartPolicy.OnFailure;
        s.RestartPolicyMaxRetries = 10;
        s.StartCommand = "/bin/sh -c \"exec dotnet MyApp.dll --urls http://*:$PORT\"";
        s.PreDeployCommand = "dotnet MyApp.dll --migrate";
        s.OverlapSeconds = 60;
        s.DrainingSeconds = 10;
        s.CustomDomains.Add("api.example.com");
    });

Cron worker: five-field crontab, UTC. The service must exit. Do not combine with replicas greater than 1 or Serverless.

builder.AddProject<Projects.Worker>("nightly")
    .PublishAsRailwayService(s =>
    {
        s.CronSchedule = "0 3 * * *"; // 03:00 UTC
    });

Multi-region: ReplicaRegions wins over WithReplicas + Region.

builder.AddProject<Projects.Api>("api")
    .WithComputeEnvironment(railway)
    .PublishAsRailwayService(s =>
    {
        s.ReplicaRegions = new()
        {
            [RailwayRegion.UsWest2] = 2,
            [RailwayRegion.EuropeWest4] = 1
        };
        s.Serverless = false;
    });

Docs

  • Getting started — restore, AppHost, first publish/deploy, token setup
  • Publish and deploy — pipeline, plan vs apply, adopt, staging, images, settings
  • Storage — buckets, local S3Mock, IAmazonS3, connection strings
  • GraphQL — confirmed operations only
  • CHANGELOG.md — preview.11 and later
  • AGENTS.md — contract for coding agents working this repo
  • SECURITY.md — never commit secrets; how to report issues

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on IntrepidDeveloper.Aspire.Hosting.Railway:

Package Downloads
IntrepidDeveloper.Aspire.Hosting.Railway.Storage

Aspire resource for a local S3-compatible container and a Railway bucket on deploy.

IntrepidDeveloper.Aspire.Hosting.Railway.PostgreSQL

Publish official Aspire Postgres resources as Railway-managed Postgres on deploy.

IntrepidDeveloper.Aspire.Hosting.Railway.Redis

Publish official Aspire Redis resources as Railway-managed Redis on deploy.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.5.0-preview.12 0 8/20/2026
13.5.0-preview.11 0 8/20/2026
13.5.0-preview.10 0 8/20/2026
13.5.0-preview.9 0 8/20/2026
13.5.0-preview.8 0 8/20/2026
13.5.0-preview.7 0 8/20/2026
13.5.0-preview.6 0 8/20/2026
13.5.0-preview.5 0 8/20/2026
13.5.0-preview.4 0 8/20/2026
13.5.0-preview.3 0 8/20/2026
13.5.0-preview.2 0 8/20/2026
13.5.0-preview.1 0 8/20/2026
0.1.0-preview.12 0 8/20/2026