Stackship.Infrastructure.Module 1.0.12

dotnet add package Stackship.Infrastructure.Module --version 1.0.12
                    
NuGet\Install-Package Stackship.Infrastructure.Module -Version 1.0.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="Stackship.Infrastructure.Module" Version="1.0.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Stackship.Infrastructure.Module" Version="1.0.12" />
                    
Directory.Packages.props
<PackageReference Include="Stackship.Infrastructure.Module" />
                    
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 Stackship.Infrastructure.Module --version 1.0.12
                    
#r "nuget: Stackship.Infrastructure.Module, 1.0.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 Stackship.Infrastructure.Module@1.0.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=Stackship.Infrastructure.Module&version=1.0.12
                    
Install as a Cake Addin
#tool nuget:?package=Stackship.Infrastructure.Module&version=1.0.12
                    
Install as a Cake Tool

Stackship.Infrastructure.Module

Stackship.Infrastructure.Module is a reusable SDK that helps Stackship microservices register themselves with the Stackship platform. It wires up authentication, dynamic module registration, heartbeat monitoring, and graceful shutdown so your service can focus on business logic.

Features

  • Client credentials – obtain and cache bearer tokens for talking to the Stackship API.
  • Dynamic module registration – advertise your module key, display name, base URL, and supported resource types.
  • Automatic heartbeats – keep the backend informed that the module is healthy; configurable intervals and timeouts.
  • Graceful teardown – optional auto-unregister on shutdown to clean up routing entries.
  • HTTP proxy compatibility – exposes the metadata required for the Stackship gateway to route resource-scoped requests.

Getting started

  1. Add the package

    dotnet add package Stackship.Infrastructure.Module
    

    Alternatively, reference the project directly from this repository.

  2. Configure your module – add a Stackship section to appsettings.json (or another configuration source):

    "Stackship": {
      "BackendBaseUrl": "https://localcloud-api",
      "Key": "apps",
      "DisplayName": "Applications",
      "ResourceTypes": ["apps"],
      "BaseUrl": "https://module-apps",
      "Keycloak": {
        "Url": "https://auth.stackship.local",
        "Realm": "stackship",
        "ClientId": "module-apps",
        "ClientSecret": "<client-secret>",
        "Audience": "stackship-kubernetes-client"
      }
    }
    
  3. Register services – in Program.cs / the DI setup, bind the options and register the hosted service:

    builder.Services.AddHttpContextAccessor();
    builder.Services.AddStackshipModule(builder.Configuration.GetSection("Stackship"));
    

    The extension validates the configuration on startup and automatically registers the module when the host begins running.

Configuration reference

Setting Description
BackendBaseUrl Base URL of the Stackship API. Requests are issued to internal/modules/* endpoints.
Key Unique identifier for the module. Must match the backend allow-list.
DisplayName Human-friendly name shown in the platform.
ResourceTypes One or more resource type strings (e.g., "apps", "databases") that this module manages.
BaseUrl Public URL of the module service; the gateway proxies matching requests here.
Keycloak.Url / Realm / ClientId / ClientSecret Keycloak client credentials used to obtain access tokens.
Keycloak.Audience Optional audience claim requested when fetching tokens.
HeartbeatInterval (Optional) How often to send heartbeats; default 30s. Must be shorter than the timeout.
HeartbeatTimeout (Optional) Advertised timeout to the backend; minimum 10s.
AutoUnregisterOnShutdown Unregister automatically on host shutdown (default true).
RegistrationRetryInterval Delay between failed registration attempts (default 5s).
HttpTimeout Timeout used for backend and Keycloak HTTP calls (default 15s).

Lifecycle

  • StartupStackshipModuleRegistrationHostedService registers the module against the Stackship API and begins the heartbeat loop.
  • Heartbeats – periodic POSTs keep the module marked as Active. Missing heartbeats eventually mark the module as inactive and remove routing entries.
  • Shutdown – if AutoUnregisterOnShutdown is true, the hosted service sends a DELETE request so the gateway stops routing traffic to the module immediately.

Local development tips

  • Ensure IHttpContextAccessor is registered; the extension throws if it is missing.
  • Use the sample module in Stackship.Module.FunctionsManager as a reference implementation.
  • When running without the full Stackship backend, consider mocking the registration endpoints or disabling the hosted service.

Questions or improvements? Let the Stackship team know and keep modules healthy!

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.12 209 10/10/2025 1.0.12 is deprecated because it is no longer maintained.
1.0.10 295 10/1/2025
1.0.9 195 9/30/2025
1.0.8 196 9/30/2025
1.0.7 206 9/30/2025
1.0.6 194 9/30/2025
1.0.5 190 9/30/2025
1.0.4 220 9/25/2025
1.0.3 200 9/25/2025
1.0.2 195 9/25/2025
1.0.1 199 9/25/2025
1.0.0 197 9/25/2025