Skip to content

feat(dx): support standalone API run alongside Aspire #339

Description

@fpindej

Problem

When Aspire runs the full stack, the API is launched as an in-process project. There's no frictionless way to run additional API instances alongside Aspire — useful for testing multi-instance scenarios (concurrency, load balancing, distributed caching behavior, etc.).

Running the API standalone requires manually providing all connection strings and FileStorage config as environment variables, because appsettings.Development.json doesn't include them (Aspire injects them at runtime).

Proposed approach

Add a launchSettings.json profile (e.g. Standalone) that points at the Aspire-managed infrastructure using the default port allocation:

{
  "Standalone": {
    "commandName": "Project",
    "applicationUrl": "http://localhost:5142",
    "environmentVariables": {
      "ASPNETCORE_ENVIRONMENT": "Development",
      "ConnectionStrings__Database": "Host=localhost;Port={base+4};Database={slug};Username=postgres;Password=DevPassword123!",
      "FileStorage__Endpoint": "http://localhost:{base+5}",
      "FileStorage__AccessKey": "minioadmin",
      "FileStorage__SecretKey": "DevPassword123!",
      "FileStorage__BucketName": "{slug}-files",
      "FileStorage__UseSSL": "false"
    }
  }
}

The init script would replace the port/slug placeholders alongside the existing ones.

Alternatives

  • Just document the env vars — lower effort, but high friction for the developer
  • Add a --no-api flag to AppHost — infrastructure-only mode, more complex

Use cases

  • Testing concurrent API requests against shared DB/storage
  • Verifying distributed HybridCache behavior across instances
  • Load testing with multiple API processes
  • Debugging one instance while another handles traffic

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend (.NET)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions