@lastshotlabs/slingshot-infra
npm install @lastshotlabs/slingshot-infra
Functions
Section titled “Functions”auditWebsocketScaling
Section titled “auditWebsocketScaling”Inspect a runtime app config and return WebSocket scaling diagnostics.
This is a pure function with no side effects. It is designed to be merged
into the output of slingshot infra check.
Detection rules:
- WS endpoints configured but no transport →
info(instance-local delivery). - Presence enabled without a transport →
info(instance-local presence). - Transport configured but
db.cache === 'memory'→warning. - Transport configured but
db.sessions === 'memory'→warning.
function auditWebsocketScaling(config: AppConfigShape): WsScalingAuditResultSource: packages/slingshot-infra/src/config/websocketScalingAudit.ts
compareInfraResources
Section titled “compareInfraResources”Compare what infra declares in uses against what the platform provides
in resources, and what the app config would auto-derive.
Returns structured diagnostics suitable for the slingshot infra check CLI.
function compareInfraResources(opts: { /** The `uses` array from slingshot.infra.ts (or empty) */ infraUses: string[]; /** The keys of `resources` from slingshot.platform.ts */ platformResources: string[]; /** Auto-derived uses from the app config (via deriveUsesFromAppConfig) */ derivedUses: string[]; }): InfraCheckDiagnosticsSource: packages/slingshot-infra/src/config/deriveUsesFromApp.ts
computeDeployPlan
Section titled “computeDeployPlan”Compute a deploy plan without executing it.
Compares the current registry state against the desired set of
service/stack deployments and produces a DeployPlan with per-service
'add', 'update', or 'unchanged' entries and aggregate summary counts.
Remarks: Algorithm: 1. Calls resolveServiceStacks() to expand infra.services (or produce a single 'default' entry) into { name, stacks } pairs. 2. For each (service, stack) pair, looks up the service in registry.services[name] and then service.stages[stageName]: - Missing service or stage entry → 'add' with change descriptions. - Stage entry with matching imageTag → 'unchanged'. - Stage entry with a different imageTag → 'update' with a 'image tag: old → new' change description. If the stack name also changed a second change description is appended. 3. Aggregates counts into summary.additions, summary.updates, and summary.unchanged.
Remarks: The function is pure — it never writes to the registry or touches the filesystem. Pass the result to formatDeployPlan() for CLI display.
function computeDeployPlan(opts: ComputeDeployPlanOptions): DeployPlanSource: packages/slingshot-infra/src/deploy/plan.ts
createCloudflareClient
Section titled “createCloudflareClient”Create a DnsClient backed by the Cloudflare v4 API.
Zone ID resolution is lazy — if config.zoneId is not provided it is
resolved on the first API call by looking up the base domain in
/zones?name=<baseDomain> and cached for the lifetime of the client.
All API calls use Bearer token auth. An error is thrown if the Cloudflare
API returns success: false.
function createCloudflareClient(config: { apiToken: string; zoneId?: string }): DnsClientSource: packages/slingshot-infra/src/dns/cloudflare.ts
createDnsManager
Section titled “createDnsManager”Dispatch to the correct DNS manager implementation based on
DnsProviderConfig.provider.
function createDnsManager(config: DnsProviderConfig): DnsManagerSource: packages/slingshot-infra/src/dns/manager.ts
createDocumentDbProvisioner
Section titled “createDocumentDbProvisioner”Create a resource provisioner for Amazon DocumentDB (Mongo-compatible).
When config.provision is true, generates an SST config with
aws.docdb.Cluster and aws.docdb.ClusterInstance Pulumi resources and
runs bunx sst deploy. Outputs (host, port, username, password, database)
are parsed from SST stdout. When provision is false, the
config.connection map is returned as-is.
function createDocumentDbProvisioner(): ResourceProvisionerSource: packages/slingshot-infra/src/resource/provisioners/documentdb.ts
createEc2NginxPreset
Section titled “createEc2NginxPreset”Create an EC2/nginx (or Caddy) preset provider.
Generates Dockerfiles, a docker-compose file, a reverse-proxy config
(Caddyfile or nginx.conf), and a GitHub Actions workflow. Deploy copies
files to the remote EC2 host via scp, then runs docker compose pull && up
over SSH. Local commands use spawnSync with array args. SSH commands pass a
single command string to the remote shell; all user-controlled values
(service names, email, domain) are shell-quoted via shellQuote to prevent
injection.
Remarks: Deploy strategy limitation: The EC2 preset only supports the rolling deployment strategy. Blue/green and canary deployments require the ECS preset because they depend on AWS CodeDeploy and weighted target group routing which are not available in a standalone EC2 + docker-compose setup.
Remarks: The deploy host is resolved from (in order): stage registry outputs publicIp, stack _meta stage outputs publicIp, or the env var DEPLOY_HOST_<STAGE>.
function createEc2NginxPreset(config?: Ec2NginxPresetConfig): PresetProviderSource: packages/slingshot-infra/src/preset/ec2-nginx/ec2NginxPreset.ts
createEcsPreset
Section titled “createEcsPreset”Create an ECS Fargate preset provider.
Generates Dockerfiles, an SST config (for ECS cluster, ALB, task definitions,
and auto-scaling), and a GitHub Actions workflow that builds, pushes, and
deploys the service. Runs bunx sst deploy for both the deploy and
provisionStack operations.
function createEcsPreset(config?: EcsPresetConfig): PresetProviderSource: packages/slingshot-infra/src/preset/ecs/ecsPreset.ts
createEmptyRegistryDocument
Section titled “createEmptyRegistryDocument”Create an empty RegistryDocument for first-run initialization.
function createEmptyRegistryDocument(platform: string): RegistryDocumentSource: packages/slingshot-infra/src/types/registry.ts
createKafkaProvisioner
Section titled “createKafkaProvisioner”Create a resource provisioner for Apache Kafka (AWS MSK via Pulumi/SST).
When config.provision is true, generates an SST config with an
aws.msk.Cluster Pulumi resource and runs bunx sst deploy. The bootstrap
brokers string is parsed from SST stdout. When provision is false, the
config.connection.brokers value is returned as-is.
function createKafkaProvisioner(): ResourceProvisionerSource: packages/slingshot-infra/src/resource/provisioners/kafka.ts
createLocalRegistry
Section titled “createLocalRegistry”Create a registry provider that persists the RegistryDocument as a JSON
file on the local filesystem.
Optimistic concurrency is provided via MD5 ETags: write() checks the
current file hash against the supplied etag before overwriting. Parent
directories are created automatically on first write.
Intended for local development and single-machine CI pipelines. For
team environments use createS3Registry() or createPostgresRegistry().
function createLocalRegistry(config: LocalRegistryConfig): RegistryProviderSource: packages/slingshot-infra/src/registry/localRegistry.ts
createMongoProvisioner
Section titled “createMongoProvisioner”Create a resource provisioner for MongoDB Atlas.
When config.provision is true, creates an Atlas cluster via the Atlas
Admin API (Digest auth), polls until the cluster reaches IDLE, creates a
database user, and builds the mongodb+srv:// connection string. Polling
uses a 10-second interval with a 30-minute timeout.
When provision is false, the config.connection map is returned as-is.
function createMongoProvisioner(): ResourceProvisionerSource: packages/slingshot-infra/src/resource/provisioners/mongo.ts
createPostgresProvisioner
Section titled “createPostgresProvisioner”Create a resource provisioner for PostgreSQL (Aurora Serverless v2).
When config.provision is true, generates an SST config with an
sst.aws.Postgres component and runs bunx sst deploy in a temporary
directory. The outputs (host, port, user, password, database) are parsed
from SST stdout and stored in the registry. When provision is false,
the config.connection map is returned as-is.
function createPostgresProvisioner(): ResourceProvisionerSource: packages/slingshot-infra/src/resource/provisioners/postgres.ts
createPresetRegistry
Section titled “createPresetRegistry”Create an in-memory registry of preset providers keyed by name.
Throws immediately when an unknown preset name is requested so errors surface at deploy time rather than silently producing empty output.
function createPresetRegistry(presets: PresetProvider[]): voidSource: packages/slingshot-infra/src/preset/presetRegistry.ts
createProvisionerRegistry
Section titled “createProvisionerRegistry”Create an in-memory registry of resource provisioners keyed by resource type.
Throws immediately when an unknown resource type is requested so errors surface at provision time rather than silently skipping resources.
function createProvisionerRegistry(provisioners: ResourceProvisioner[]): voidSource: packages/slingshot-infra/src/resource/provisionerRegistry.ts
createRedisProvisioner
Section titled “createRedisProvisioner”Create a resource provisioner for Redis (ElastiCache Serverless via SST).
When config.provision is true, generates an SST config with an
sst.aws.Redis component and runs bunx sst deploy. Outputs (host, port)
are parsed from SST stdout and stored in the registry. When provision is
false, the config.connection map is returned as-is.
function createRedisProvisioner(): ResourceProvisionerSource: packages/slingshot-infra/src/resource/provisioners/redis.ts
createRegistryFromConfig
Section titled “createRegistryFromConfig”Dispatch to the correct registry provider factory based on
RegistryConfig.provider.
This is the primary factory used by the CLI and deploy pipeline to instantiate
whichever registry provider is declared in slingshot.platform.ts.
function createRegistryFromConfig(config: RegistryConfig): RegistryProviderSource: packages/slingshot-infra/src/registry/createRegistryFromConfig.ts
createS3Registry
Section titled “createS3Registry”Create a registry provider that persists the RegistryDocument as a single
JSON object in an S3 bucket.
Optimistic concurrency is provided via ETags: write() passes IfMatch to
S3 when an etag is supplied. Uses lazy-loaded @aws-sdk/client-s3; the
package must be installed as an optional peer dependency.
initialize() creates the bucket (if absent) and enables versioning, then
writes an empty registry document if none exists.
function createS3Registry(config: S3RegistryConfig): RegistryProviderSource: packages/slingshot-infra/src/registry/s3Registry.ts
createSecretsManager
Section titled “createSecretsManager”Create a SecretsManager backed by SSM Parameter Store, env vars, or the
local filesystem.
The 'ssm' provider uses AWS SSM SecureString parameters stored at
<pathPrefix><stageName>/<key>. The 'env' provider reads from
process.env (check-only; push/pull are no-ops). The 'file' provider
reads and writes to <directory>/<key> files.
function createSecretsManager(config: PlatformSecretsConfig, stageName: string,): SecretsManagerSource: packages/slingshot-infra/src/secrets/secretsManager.ts
deepMerge
Section titled “deepMerge”Recursively deep-merge source into target, returning a new object.
Arrays in source replace (not concat) the corresponding array in target.
Plain objects are merged recursively. All other values (including null)
in source override the corresponding value in target.
function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>,): Record<string, unknown>Source: packages/slingshot-infra/src/override/resolveOverrides.ts
defineInfra
Section titled “defineInfra”Define and validate the infrastructure configuration for a single Slingshot app.
Validates config against the Zod schema and returns a frozen, immutable
copy. Typically placed in a slingshot.infra.ts file at the app root.
function defineInfra(config: DefineInfraConfig): Readonly<DefineInfraConfig>Source: packages/slingshot-infra/src/config/infraSchema.ts
definePlatform
Section titled “definePlatform”Define and validate the platform configuration for a Slingshot organisation.
Validates config against the full Zod schema (registry provider
requirements, stage declarations, DNS provider checks) and returns a
frozen, immutable copy.
Typically placed in a slingshot.platform.ts file at the repository root,
shared by all apps in the monorepo.
function definePlatform(config: DefinePlatformConfig): Readonly<DefinePlatformConfig>Source: packages/slingshot-infra/src/config/platformSchema.ts
deregisterApp
Section titled “deregisterApp”Remove a registered app from the registry.
Uses an optimistic lock to prevent concurrent writes from clobbering each other. If the app is not found, the function returns silently without error.
async function deregisterApp(registry: RegistryProvider, appName: string): Promise<void>Source: packages/slingshot-infra/src/registry/appRegistry.ts
deriveUsesFromAppConfig
Section titled “deriveUsesFromAppConfig”Inspect a runtime app config object and return the list of shared
infrastructure resource names it requires (e.g. ['postgres', 'redis']).
Detection rules:
db.redisis truthy (notfalse) ->'redis'db.mongois truthy (notfalse) ->'mongo'- Any
db.*store field equals'postgres'->'postgres' jobsis configured (BullMQ needs Redis) ->'redis'ssr.isr.adapteris'redis'or object ->'redis'
The function never throws — unknown shapes are silently ignored.
function deriveUsesFromAppConfig(appConfig: Record<string, unknown>): string[]Source: packages/slingshot-infra/src/config/deriveUsesFromApp.ts
destroyResources
Section titled “destroyResources”Destroy provisioned resources for a given stage.
Guards against destroying a stage that still has deployed services — throws
if any service entry has status: 'deployed' for the target stage. For each
resource (or the one specified by params.resource), calls the matching
provisioner’s destroy() method, removes the stage entry from the registry,
and writes the updated document back using an optimistic lock.
async function destroyResources(params: DestroyResourcesParams,): Promise<DestroyResourceResult[]>Source: packages/slingshot-infra/src/resource/destroyResources.ts
destroyViaSst
Section titled “destroyViaSst”Destroy SST-managed AWS resources for a given resource and stage.
Creates a temporary directory, writes the sst.config.ts, copies relevant
package files, and runs bunx sst destroy --stage <stageName>. The temp
directory is always removed in the finally block.
function destroyViaSst(opts: SSTDestroyOptions): Promise<void>Source: packages/slingshot-infra/src/resource/provisionViaSst.ts
formatDeployPlan
Section titled “formatDeployPlan”Format a DeployPlan as a human-readable text table for CLI output.
Each service entry is prefixed with + (add), ~ (update), or =
(unchanged). Changes are listed on indented sub-lines. The summary line
appears at the bottom.
function formatDeployPlan(plan: DeployPlan): stringSource: packages/slingshot-infra/src/deploy/formatPlan.ts
generateInfraTemplate
Section titled “generateInfraTemplate”Generate a complete slingshot.infra.ts scaffold with sensible defaults.
Produces a ready-to-edit TypeScript source string that can be written to
disk by the slingshot infra init CLI command.
function generateInfraTemplate(opts?: { stacks?: string[]; port?: number }): stringSource: packages/slingshot-infra/src/scaffold/infraTemplate.ts
generatePlatformTemplate
Section titled “generatePlatformTemplate”Generate a complete slingshot.platform.ts scaffold with sensible defaults.
Produces a ready-to-edit TypeScript source string that can be written to
disk by the slingshot platform init CLI command.
function generatePlatformTemplate(opts?: { org?: string; region?: string; preset?: string; stages?: string[]; resources?: string[]; }): stringSource: packages/slingshot-infra/src/scaffold/platformTemplate.ts
generateResourceSstConfig
Section titled “generateResourceSstConfig”Generate an sst.config.ts file with SST/Pulumi resource definitions.
Uses SST built-in components where available (sst.aws.Postgres,
sst.aws.Redis) and falls back to raw Pulumi AWS providers for resources
SST doesn’t wrap (MSK Kafka, DocumentDB). All resource blocks are wrapped
in # --- section:resource-<name> --- markers for user override support.
function generateResourceSstConfig(resources: ResourceProvisionEntry[], opts: GenerateResourceSstOptions,): stringSource: packages/slingshot-infra/src/resource/generateResourceSst.ts
getAppsByResource
Section titled “getAppsByResource”Return all registered apps that consume the given shared resource.
async function getAppsByResource(registry: RegistryProvider, resourceName: string,): Promise<RegistryAppEntry[]>Source: packages/slingshot-infra/src/registry/appRegistry.ts
getAppsByStack
Section titled “getAppsByStack”Return all registered apps that deploy to the given stack.
async function getAppsByStack(registry: RegistryProvider, stackName: string,): Promise<RegistryAppEntry[]>Source: packages/slingshot-infra/src/registry/appRegistry.ts
getServiceEnv
Section titled “getServiceEnv”Get the flat env map for a specific service from a PresetContext.
Handles both single-service (resolvedEnv is a flat map) and multi-service
(resolvedEnv is keyed by service name) cases without requiring type casts
in preset code.
function getServiceEnv(ctx: PresetContext, serviceName: string): Record<string, string>Source: packages/slingshot-infra/src/types/preset.ts
listApps
Section titled “listApps”List all registered apps in the registry.
async function listApps(registry: RegistryProvider): Promise<RegistryAppEntry[]>Source: packages/slingshot-infra/src/registry/appRegistry.ts
loadInfraConfig
Section titled “loadInfraConfig”Load and return the infra config from a slingshot.infra.{ts,js,mts,mjs}
file in the specified directory.
Unlike loadPlatformConfig(), the search does not traverse upward — the
config file must exist in dir.
TypeScript config files require the Bun runtime.
async function loadInfraConfig(dir?: string): Promise<Source: packages/slingshot-infra/src/loader/loadInfraConfig.ts
loadPlatformConfig
Section titled “loadPlatformConfig”Load and return the platform config by searching the filesystem for a
slingshot.platform.{ts,js,mts,mjs} file.
Search strategy:
- If the
SLINGSHOT_PLATFORMenvironment variable is set, it is used as the absolute path to the config file. - Otherwise, traverses upward from
startDir(default:process.cwd()) until a config file is found or the filesystem root is reached.
TypeScript config files (.ts, .mts) require the Bun runtime — an error
is thrown when loading them under Node.js.
async function loadPlatformConfig(startDir?: string): Promise<Source: packages/slingshot-infra/src/loader/loadPlatformConfig.ts
parseRegistryUrl
Section titled “parseRegistryUrl”Parse a SLINGSHOT_REGISTRY URL string into a RegistryConfig.
Supported URL schemes:
s3://<bucket>→{ provider: 's3', bucket }redis://<host>:<port>orrediss://...→{ provider: 'redis', url }postgres://...orpostgresql://...→{ provider: 'postgres', connectionString }- Any other string (filesystem path) →
{ provider: 'local', path }
function parseRegistryUrl(url: string): RegistryConfigSource: packages/slingshot-infra/src/registry/parseRegistryUrl.ts
provisionViaSst
Section titled “provisionViaSst”Provision AWS resources by generating an SST config and running sst deploy.
Creates a temporary directory, writes the sst.config.ts, copies relevant
package files for Bun dependency resolution, runs bunx sst deploy, then
parses key = value output lines and JSON output blocks from stdout.
The temp directory is always removed in the finally block.
function provisionViaSst(opts: SSTProvisionOptions): Promise<SSTProvisionResult>Source: packages/slingshot-infra/src/resource/provisionViaSst.ts
registerApp
Section titled “registerApp”Register (or update) an app entry in the registry for cross-repo coordination.
Uses an optimistic lock to prevent concurrent writes from clobbering each
other. After a successful write the app appears in listApps() and can be
discovered by getAppsByStack() and getAppsByResource().
async function registerApp(registry: RegistryProvider, app: { name: string; repo: string; stacks: string[]; uses: string[] },): Promise<void>Source: packages/slingshot-infra/src/registry/appRegistry.ts
resolveEnvironment
Section titled “resolveEnvironment”Resolve the environment variable map for a service at deploy time.
Merges env sources in priority order (later sources override earlier ones):
- Platform stage env (
platform.stages[stageName].env). - Resource outputs auto-wired for resources listed in
service.usesorinfra.uses. - App-level env from
infra.env. - Service-level env from
service.env(highest priority).
function resolveEnvironment(platform: DefinePlatformConfig, infra: DefineInfraConfig, stageName: string, registry: RegistryDocument, service?: ServiceDeclaration,): Record<string, string>Source: packages/slingshot-infra/src/deploy/resolveEnv.ts
resolveOverride
Section titled “resolveOverride”Apply a user override to a generated deployment file.
Override dispatch rules:
undefined→ returngeneratedunchanged.string→ replace file content entirely with the file at that path.object+.jsonfile → deep-merge into the parsed JSON.object+.yml/.yamlfile → deep-merge into the parsed YAML.object+ any other format → replace named sections using# --- section:name ---/# --- end:name ---markers.
async function resolveOverride(generated: GeneratedFile, override: OverrideSpec | undefined, appRoot: string,): Promise<GeneratedFile>Source: packages/slingshot-infra/src/override/resolveOverrides.ts
resolvePlatformConfig
Section titled “resolvePlatformConfig”Resolve multi-platform targeting by merging a named platform entry into the top-level platform config.
When targetPlatform is supplied, the matching entry under
rawConfig.platforms[targetPlatform] is merged over the top-level fields
(provider, region, registry, secrets, resources, stacks, stages, defaults).
This allows a single slingshot.platform.ts to describe multiple deployment
targets (e.g. different AWS accounts or regions for different clients).
function resolvePlatformConfig(rawConfig: DefinePlatformConfig, targetPlatform?: string,): DefinePlatformConfigSource: packages/slingshot-infra/src/config/resolvePlatformConfig.ts
resolveRequiredKeys
Section titled “resolveRequiredKeys”Resolve the required secret/env var keys for an app based on its resource usage.
Collects all unique resources from infra.uses and each service’s uses
array, looks them up in RESOURCE_ENV_KEYS, and appends the always-required
baseline keys (JWT_SECRET, DATA_ENCRYPTION_KEY).
function resolveRequiredKeys(infra: { uses?: string[]; services?: Record<string, { uses?: string[] }>; }): string[]Source: packages/slingshot-infra/src/secrets/resolveRequiredKeys.ts
runDeployPipeline
Section titled “runDeployPipeline”Run the full deploy pipeline for an app.
Groups services by stack, generates deployment files via the stack’s preset,
applies user overrides, copies files to a temp directory, and calls
preset.deploy(). After a successful deploy, updates DNS records if
platform.dns is configured and writes the updated registry document.
When opts.plan is true, returns a DeployPlan without executing.
When opts.dryRun is true, prints generated files and returns without
writing to the registry.
async function runDeployPipeline(opts: DeployPipelineOptions,): Promise<DeployPipelineResult>Source: packages/slingshot-infra/src/deploy/pipeline.ts
runRollback
Section titled “runRollback”Roll back one or all deployed services on a stage to a previous image tag.
For each service, resolves the target image tag (from opts.targetTag or
the most recent entry in previousTags), regenerates deployment files via
the stack’s preset, applies user overrides, and calls preset.deploy().
Updates the registry with the new deploy state.
async function runRollback(opts: RollbackOptions): Promise<RollbackResult>Source: packages/slingshot-infra/src/deploy/rollback.ts
Constants
Section titled “Constants”RESOURCE_ENV_KEYS
Section titled “RESOURCE_ENV_KEYS”Env var keys produced by each resource type.
Used by resolveRequiredKeys() to determine which secrets must be present
before deployment. Must match frameworkSecretSchema in slingshot-core.
Source: packages/slingshot-infra/src/types/resource.ts
SIZE_PRESETS
Section titled “SIZE_PRESETS”Maps InfraSize names to ECS Fargate-compatible CPU unit and memory (MB) values.
Source: packages/slingshot-infra/src/types/infra.ts
Interfaces
Section titled “Interfaces”DefineInfraConfig
Section titled “DefineInfraConfig”The frozen, validated output of defineInfra().
Describes a single app’s deployment configuration: which stacks it targets, what resources it consumes, how its services are declared, and how generated files should be customized.
Remarks: Always obtained from defineInfra() — never constructed directly. The object is deepFreeze()d at creation time.
Source: packages/slingshot-infra/src/types/infra.ts
DefinePlatformConfig
Section titled “DefinePlatformConfig”The frozen, validated output of definePlatform().
Describes the entire deployment platform: cloud provider, registry backend, shared resources, named stacks, deployment stages, and org-wide defaults. Passed to deploy pipeline functions as the top-level config object.
Remarks: Always obtained from definePlatform() — never constructed directly. The object is deepFreeze()d at creation time.
Source: packages/slingshot-infra/src/types/platform.ts
DeployPipelineOptions
Section titled “DeployPipelineOptions”Options for runDeployPipeline().
Source: packages/slingshot-infra/src/deploy/pipeline.ts
DeployPipelineResult
Section titled “DeployPipelineResult”Result returned by runDeployPipeline().
Source: packages/slingshot-infra/src/deploy/pipeline.ts
DeployPlan
Section titled “DeployPlan”A computed deploy plan describing what runDeployPipeline() would change.
Source: packages/slingshot-infra/src/deploy/plan.ts
DeployPlanEntry
Section titled “DeployPlanEntry”Plan entry for a single service/stack combination.
Source: packages/slingshot-infra/src/deploy/plan.ts
DeployResult
Section titled “DeployResult”Result returned by PresetProvider.deploy().
Source: packages/slingshot-infra/src/types/preset.ts
DestroyResourceResult
Section titled “DestroyResourceResult”Result for a single resource destruction operation.
Source: packages/slingshot-infra/src/resource/destroyResources.ts
DestroyResourcesParams
Section titled “DestroyResourcesParams”Parameters for destroyResources().
Source: packages/slingshot-infra/src/resource/destroyResources.ts
DnsClient
Section titled “DnsClient”Minimal DNS client interface used by createDnsManager().
All implementations must support upsert, delete, list, and zone resolution. The Cloudflare implementation is the only concrete provider — Route53 is a stub that throws on every method.
Source: packages/slingshot-infra/src/dns/cloudflare.ts
DnsManager
Section titled “DnsManager”High-level DNS management interface used by the deploy pipeline.
Implementations are created by createDnsManager() based on the
DnsProviderConfig.provider field: 'cloudflare' is fully implemented,
'manual' logs instructions without making API calls, and 'route53'
throws on every method until implemented.
Source: packages/slingshot-infra/src/dns/manager.ts
DnsProviderConfig
Section titled “DnsProviderConfig”DNS provider configuration for automatic domain record management.
Attached to DefinePlatformConfig.dns. The deploy pipeline calls
createDnsManager(config) after a successful deploy.
Source: packages/slingshot-infra/src/types/platform.ts
DnsRecord
Section titled “DnsRecord”A single DNS record returned by the Cloudflare API.
Source: packages/slingshot-infra/src/dns/cloudflare.ts
DomainConfig
Section titled “DomainConfig”Stage-specific domain mapping for a service.
When a service should resolve to a different domain per stage, use this
instead of the domain shorthand in ServiceDeclaration.
Source: packages/slingshot-infra/src/types/infra.ts
Ec2NginxPresetConfig
Section titled “Ec2NginxPresetConfig”Configuration options for the EC2/nginx (or Caddy) preset.
Source: packages/slingshot-infra/src/preset/ec2-nginx/ec2NginxPreset.ts
EcsPresetConfig
Section titled “EcsPresetConfig”Configuration options for the ECS preset.
Source: packages/slingshot-infra/src/preset/ecs/ecsPreset.ts
GeneratedFile
Section titled “GeneratedFile”A file generated by a PresetProvider for deployment.
Generated files are written to a temp directory during the deploy pipeline. Ephemeral files are never committed to the repository.
Source: packages/slingshot-infra/src/types/preset.ts
GenerateResourceSstOptions
Section titled “GenerateResourceSstOptions”Options for generateResourceSstConfig().
Source: packages/slingshot-infra/src/resource/generateResourceSst.ts
GzipConfig
Section titled “GzipConfig”Nginx gzip compression settings.
Source: packages/slingshot-infra/src/types/infra.ts
HealthCheckConfig
Section titled “HealthCheckConfig”HTTP health check configuration for the load balancer or container runtime.
Source: packages/slingshot-infra/src/types/infra.ts
InfraCheckDiagnostics
Section titled “InfraCheckDiagnostics”Structured diagnostics produced by compareInfraResources().
Suitable for direct rendering in the slingshot infra check CLI output.
Source: packages/slingshot-infra/src/config/deriveUsesFromApp.ts
InfraLoggingConfig
Section titled “InfraLoggingConfig”Per-service logging configuration (overrides platform defaults).
Source: packages/slingshot-infra/src/types/infra.ts
LocalRegistryConfig
Section titled “LocalRegistryConfig”Configuration for the local filesystem registry provider.
Source: packages/slingshot-infra/src/registry/localRegistry.ts
LoggingDefaults
Section titled “LoggingDefaults”Default logging driver and log retention settings.
Source: packages/slingshot-infra/src/types/platform.ts
NetworkConfig
Section titled “NetworkConfig”VPC and network configuration for a stack.
Source: packages/slingshot-infra/src/types/platform.ts
NetworkOverride
Section titled “NetworkOverride”Per-service network configuration override for EC2 deployments.
Source: packages/slingshot-infra/src/types/infra.ts
NginxConfig
Section titled “NginxConfig”Nginx reverse-proxy configuration for the EC2/nginx preset.
All fields are optional and generate sensible defaults in the produced nginx.conf.
Source: packages/slingshot-infra/src/types/infra.ts
NginxRateLimitConfig
Section titled “NginxRateLimitConfig”Nginx rate limiting configuration.
Applied to the specified paths (or all paths) using the limit_req module.
Source: packages/slingshot-infra/src/types/infra.ts
NginxStaticConfig
Section titled “NginxStaticConfig”Nginx static file serving configuration.
Requests matching urlPath are served directly from fsPath on the
container filesystem instead of being proxied to the app.
Source: packages/slingshot-infra/src/types/infra.ts
NginxTimeoutConfig
Section titled “NginxTimeoutConfig”Nginx proxy timeout configuration.
Source: packages/slingshot-infra/src/types/infra.ts
OverrideMap
Section titled “OverrideMap”Map of per-file override specs for DefineInfraConfig.overrides.
Each key corresponds to a specific generated file. Set a key to an
OverrideSpec to customize or replace that file’s content at deploy time.
Source: packages/slingshot-infra/src/types/override.ts
PlatformDefaults
Section titled “PlatformDefaults”Org-wide defaults applied to all stacks and services unless overridden.
Source: packages/slingshot-infra/src/types/platform.ts
PlatformEntry
Section titled “PlatformEntry”A named platform sub-config used for multi-tenant or multi-client isolation.
Consumer apps can target a specific platform entry via defineInfra({ platform: 'name' }),
causing the deploy pipeline to use that entry’s stages/stacks/resources instead of the
top-level config.
Source: packages/slingshot-infra/src/types/platform.ts
PlatformSecretsConfig
Section titled “PlatformSecretsConfig”Secrets provider configuration for SSM Parameter Store, env vars, or file-based secrets.
Source: packages/slingshot-infra/src/types/platform.ts
PresetContext
Section titled “PresetContext”Context object passed to every PresetProvider method.
Assembles all data a preset needs to generate deployment files and execute the deploy: frozen platform/infra configs, resolved env vars, registry state, sibling services, and runtime metadata (image tag, temp dir, etc.).
Source: packages/slingshot-infra/src/types/preset.ts
PresetProvider
Section titled “PresetProvider”A deployment preset that generates files and executes deploys for a specific infrastructure pattern (ECS Fargate, EC2/nginx, etc.).
Remarks: All presets follow the swappable-provider pattern: register via createPresetRegistry() and retrieve by name. New presets implement this interface and add a case to the registry — no changes to existing code.
Source: packages/slingshot-infra/src/types/preset.ts
ProvisionResult
Section titled “ProvisionResult”Result returned by PresetProvider.provisionStack().
Source: packages/slingshot-infra/src/types/preset.ts
RegistryAppEntry
Section titled “RegistryAppEntry”Registry entry for a deployed app (for cross-repo coordination).
Written by registerApp() and read by getAppsByStack() /
getAppsByResource(). Enables platform operators to discover which repos
deploy to which stacks and consume which shared resources.
Source: packages/slingshot-infra/src/types/registry.ts
RegistryConfig
Section titled “RegistryConfig”Registry backend configuration.
Discriminated by provider. Used by createRegistryFromConfig() to
instantiate the correct RegistryProvider.
Source: packages/slingshot-infra/src/types/platform.ts
RegistryDocument
Section titled “RegistryDocument”The top-level document stored by all RegistryProvider implementations.
Contains versioned state for stacks, resources, services, and apps.
Created with createEmptyRegistryDocument() and mutated exclusively through
the registry helper functions (registerApp, runDeployPipeline, etc.).
Source: packages/slingshot-infra/src/types/registry.ts
RegistryLock
Section titled “RegistryLock”A logical registry lock returned by RegistryProvider.lock().
Provides the ETag to pass to RegistryProvider.write() for optimistic
concurrency. Call release() in a finally block.
Source: packages/slingshot-infra/src/types/registry.ts
RegistryProvider
Section titled “RegistryProvider”Registry storage backend interface.
All implementations must provide optimistic-concurrency writes via ETags,
an initialize() method for first-run setup, and a lock() method that
returns an ETag-bearing lock object for atomic read-modify-write sequences.
Remarks: Use createRegistryFromConfig() to obtain a RegistryProvider rather than implementing this interface directly.
Source: packages/slingshot-infra/src/types/registry.ts
RegistryResourceEntry
Section titled “RegistryResourceEntry”Per-resource provisioning state entry in the registry.
Source: packages/slingshot-infra/src/types/registry.ts
RegistryServiceEntry
Section titled “RegistryServiceEntry”Per-service deploy state entry in the registry.
Written by updateRegistryService() after every deploy. Stores the current
image tag, a previousTags history for rollbacks, and service metadata
(port, domain, env) for sibling service compose generation.
Source: packages/slingshot-infra/src/types/registry.ts
RegistryStackEntry
Section titled “RegistryStackEntry”Per-stack infrastructure state entry in the registry.
Source: packages/slingshot-infra/src/types/registry.ts
ResourceOutput
Section titled “ResourceOutput”Output from ResourceProvisioner.provision().
outputs contains raw key-value pairs written to the registry.
connectionEnv contains the env vars injected into services that consume
this resource (e.g. DATABASE_URL, REDIS_HOST).
Source: packages/slingshot-infra/src/types/resource.ts
ResourceProvisionEntry
Section titled “ResourceProvisionEntry”A single resource to include in the generated SST config.
Source: packages/slingshot-infra/src/resource/generateResourceSst.ts
ResourceProvisioner
Section titled “ResourceProvisioner”A pluggable resource provisioner for a specific resource type.
Follows the swappable-provider pattern: register via createProvisionerRegistry()
and retrieve by resourceType. Adding support for a new resource type means
implementing this interface and adding a case — no changes to existing code.
Source: packages/slingshot-infra/src/types/resource.ts
ResourceProvisionerContext
Section titled “ResourceProvisionerContext”Context object passed to ResourceProvisioner.provision() and destroy().
Provides all the data a provisioner needs to create or tear down AWS resources for a specific resource/stage combination.
Source: packages/slingshot-infra/src/types/resource.ts
ResourceStageOverride
Section titled “ResourceStageOverride”Per-stage overrides for a shared resource.
Source: packages/slingshot-infra/src/types/platform.ts
RollbackOptions
Section titled “RollbackOptions”Options for runRollback().
Source: packages/slingshot-infra/src/deploy/rollback.ts
RollbackResult
Section titled “RollbackResult”Result returned by runRollback().
Source: packages/slingshot-infra/src/deploy/rollback.ts
S3RegistryConfig
Section titled “S3RegistryConfig”Configuration for the S3-backed registry provider.
Source: packages/slingshot-infra/src/registry/s3Registry.ts
ScalingConfig
Section titled “ScalingConfig”Container/instance scaling configuration.
Source: packages/slingshot-infra/src/types/platform.ts
SecretsCheckResult
Section titled “SecretsCheckResult”Result of a secrets presence check.
Source: packages/slingshot-infra/src/secrets/secretsManager.ts
SecretsManager
Section titled “SecretsManager”Interface for pushing, pulling, and checking secrets across different provider backends (SSM, env vars, or files).
Source: packages/slingshot-infra/src/secrets/secretsManager.ts
ServiceDeclaration
Section titled “ServiceDeclaration”Declaration for a single service within a multi-service app.
Each key in DefineInfraConfig.services is a logical service name that
maps to one microservice/container with its own Dockerfile, domain, port,
and resource usage.
Source: packages/slingshot-infra/src/types/infra.ts
SharedResourceConfig
Section titled “SharedResourceConfig”Shared infrastructure resource definition.
When provision: true, slingshot provisions the resource via SST/Pulumi.
When provision: false, the connection map is used as-is.
Source: packages/slingshot-infra/src/types/platform.ts
SSTDestroyOptions
Section titled “SSTDestroyOptions”Options for destroyViaSst(). A subset of SSTProvisionOptions.
Source: packages/slingshot-infra/src/resource/provisionViaSst.ts
SSTProvisionOptions
Section titled “SSTProvisionOptions”Options for provisionViaSst().
Source: packages/slingshot-infra/src/resource/provisionViaSst.ts
SSTProvisionResult
Section titled “SSTProvisionResult”Result returned by provisionViaSst().
Source: packages/slingshot-infra/src/resource/provisionViaSst.ts
StackConfig
Section titled “StackConfig”Named stack configuration — a group of services sharing infrastructure.
Each stack entry maps to a preset (e.g. 'ecs' or 'ec2-nginx') that
handles file generation and deployment.
Source: packages/slingshot-infra/src/types/platform.ts
StackStageOverride
Section titled “StackStageOverride”Per-stage overrides for a specific stack (scaling, network).
Source: packages/slingshot-infra/src/types/platform.ts
StageConfig
Section titled “StageConfig”Deployment stage configuration (e.g. 'development', 'staging', 'production').
Source: packages/slingshot-infra/src/types/platform.ts
WsDiagnostic
Section titled “WsDiagnostic”A single WebSocket scaling diagnostic entry.
Each diagnostic is frozen on creation (see rule 12 — freeze at the boundary).
Source: packages/slingshot-infra/src/config/websocketScalingAudit.ts
WsScalingAuditResult
Section titled “WsScalingAuditResult”The result of a WebSocket scaling audit, as returned by
auditWebsocketScaling().
The entire result object is deep-frozen before being returned.
Source: packages/slingshot-infra/src/config/websocketScalingAudit.ts
InfraSize
Section titled “InfraSize”Named size preset for container CPU and memory allocation.
Resolved by SIZE_PRESETS to ECS-compatible vCPU units and memory in MB.
Source: packages/slingshot-infra/src/types/infra.ts
OverrideSpec
Section titled “OverrideSpec”Override spec for a single generated deployment file.
-
string: path to a file that replaces the generated one entirely. Absolute paths are used as-is; relative paths are resolved from app root. -
object: deep-merged into the generated configuration. For structured formats (JSON, YAML), the object is parsed, merged, and re-serialized. For text formats (Dockerfile, NGINX/Caddy config), object keys map to named# --- section:name ---blocks in the generated template.
Source: packages/slingshot-infra/src/types/override.ts
ProcessRunner
Section titled “ProcessRunner”Signature for the process runner used by provisionViaSst() and
destroyViaSst(). Matches the spawnSync signature to allow test
overrides without spawning real child processes.
Source: packages/slingshot-infra/src/resource/provisionViaSst.ts
WsDiagnosticSeverity
Section titled “WsDiagnosticSeverity”Severity level of a WebSocket scaling diagnostic.
'info': the configuration will work but will not scale beyond a single instance without changes.'warning': the configuration is likely incorrect at any scale (e.g. memory cache with a cross-instance transport).
Source: packages/slingshot-infra/src/config/websocketScalingAudit.ts