Documentation
¶
Overview ¶
Package platform provides the API for FTL platform deployments. This is used by deployment platforms to process FTL applications consistently.
Package platform provides the official API for FTL platform integrations.
This package is designed for cloud platforms that deploy FTL applications to WebAssembly runtimes like Fermyon Cloud. It provides a clean, explicit API for processing deployments with proper security controls.
Basic Usage ¶
Create a client with your platform configuration:
config := platform.DefaultConfig()
config.RequireRegistryComponents = true
config.AllowedRegistries = []string{"ghcr.io", "your-ecr.amazonaws.com"}
client := platform.NewClient(config)
Process deployment requests:
result, err := client.ProcessDeployment(request)
if err != nil {
return handleError(err)
}
deployToFermyon(result.SpinTOML)
Platform Components ¶
The platform automatically injects security components:
- mcp-gateway: Always injected for routing and request handling
- mcp-authorizer: Injected for non-public applications
These components are configurable through the Config struct.
Security ¶
The platform enforces several security policies:
- Component source validation (local vs registry)
- Registry whitelist enforcement
- Component count limits
- Automatic auth component injection
Index ¶
Constants ¶
const (
// DefaultECRRegistry is the FTL platform's ECR registry
DefaultECRRegistry = "795394005211.dkr.ecr.us-west-2.amazonaws.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Gateway component settings
GatewayRegistry string // Default: ghcr.io
GatewayPackage string // Default: fastertools:mcp-gateway
GatewayVersion string // Default: latest stable version
// Authorizer component settings
AuthorizerRegistry string // Default: ghcr.io
AuthorizerPackage string // Default: fastertools:mcp-authorizer
AuthorizerVersion string // Default: latest stable version
// Security settings
RequireRegistryComponents bool // If true, reject local file sources
AllowedRegistries []string // Whitelist of allowed registries (empty = allow all)
}
Config defines platform-specific settings.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns production-ready default configuration.
type DeploymentContext ¶
type DeploymentContext struct {
// Actor type performing the deployment
ActorType string // "user" or "machine"
// Organization ID for org-scoped deployments
OrgID string
// Claims to forward as headers (claim_name -> header_name)
// Example: {"sub": "X-User-ID", "org_id": "X-Org-ID"}
ForwardClaims map[string]string
}
DeploymentContext provides actor and organization context for deployments
type ProcessMetadata ¶
type ProcessMetadata struct {
AppName string
AppVersion string
ComponentCount int
AccessMode string
InjectedGateway bool
InjectedAuthorizer bool
SubjectsInjected int // Number of allowed subjects that were injected
}
ProcessMetadata provides information about the processing.
type ProcessRequest ¶
type ProcessRequest struct {
// The FTL application configuration (YAML or JSON)
ConfigData []byte
// Format of the config data
Format string // "yaml" or "json"
// Computed allowed user subjects from WorkOS (only used for private/org access modes)
// For private mode: platform provides the single authenticated user
// For org mode: platform provides all org members (filtered by allowed_roles if specified)
// For public/custom modes: this field is ignored
AllowedSubjects []string
// Deployment context for M2M authentication and claim forwarding
DeploymentContext *DeploymentContext
}
ProcessRequest represents a deployment request from the platform.
type ProcessResult ¶
type ProcessResult struct {
// The complete Spin TOML manifest ready for deployment
SpinTOML string
// Metadata about what was processed (for platform logging/tracking)
Metadata ProcessMetadata
}
ProcessResult contains the deployment-ready Spin TOML.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor handles FTL application processing for platform deployments.
func NewProcessor ¶
NewProcessor creates a new platform processor.
func (*Processor) Process ¶
func (p *Processor) Process(req ProcessRequest) (*ProcessResult, error)
Process handles an FTL deployment request.
The platform only needs to provide:
- The raw FTL configuration (YAML/JSON)
- Computed allowed subjects for private/org modes (from WorkOS)
The processor handles all FTL-specific logic internally:
- Validation against CUE schema
- Component registry validation
- Synthesis to Spin TOML
- Gateway/authorizer injection
For access modes:
- public: No allowed subjects needed
- private: Platform provides single authenticated user
- org: Platform provides org members (filtered by allowed_roles if specified in config)
- custom: No allowed subjects needed (app handles its own auth)