Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Blueprint FaaS
Function-as-a-Service (FaaS) execution support for Blueprint SDK.
Overview
This crate provides trait-based integration with serverless platforms, allowing blueprints to delegate specific jobs to FaaS providers while running others locally.
Supported Providers
- AWS Lambda (
awsfeature) - Full implementation with deployment - GCP Cloud Functions (
gcpfeature) - Full implementation with Cloud Functions v2 API - Azure Functions (
azurefeature) - Full implementation with ARM API and ZipDeploy - DigitalOcean Functions (
digitaloceanfeature) - Full implementation with namespace management - Custom HTTP (
customfeature) - HTTP-based integration for any platform (see Custom FaaS Spec)
Architecture
Core Design
The FaaS integration uses a trait-based design that keeps BlueprintRunner agnostic of specific providers:
Delegation Model
Jobs are delegated at runtime based on registration:
- Developer registers which jobs use FaaS via
.with_faas_executor(job_id, executor) - BlueprintRunner checks
FaasRegistrywhen jobs arrive - Matching jobs are delegated to FaaS, others run locally
Usage
Basic Example
use LambdaExecutor;
use BlueprintRunner;
async
GCP Cloud Functions
use CloudFunctionExecutor;
let gcp_executor = new.await?;
builder
.with_faas_executor
.run.await?;
Azure Functions
use AzureFunctionExecutor;
let azure_executor = new.await?;
builder
.with_faas_executor
.run.await?;
DigitalOcean Functions
use DigitalOceanExecutor;
let do_executor = new.await?;
builder
.with_faas_executor
.run.await?;
Custom HTTP FaaS
For custom serverless platforms, implement the Custom FaaS Platform Spec and use:
use HttpFaasExecutor;
let executor = new
.with_job_endpoint
.with_job_endpoint;
builder
.with_faas_executor
.with_faas_executor
.run.await?;
Implementation Status
✅ Completed
- Core FaaS trait abstraction (
FaasExecutor) - FaaS registry for job-to-executor mapping
- Runtime delegation in BlueprintRunner event loop
- AWS Lambda full implementation
- Function deployment with binary packaging
- Job invocation with error handling
- Health checks and pre-warming
- Metrics collection
- GCP Cloud Functions full implementation
- Cloud Functions v2 API integration
- Cloud Storage for deployment packages
- Token caching and refresh
- Full deployment lifecycle
- Azure Functions full implementation
- ARM API integration
- Resource group and function app management
- ZipDeploy for function code
- DefaultAzureCredential authentication
- Custom HTTP FaaS executor
- Configurable endpoints per job
- JSON serialization of JobCall/JobResult
- Custom FaaS Platform Specification
- DigitalOcean Functions full implementation
- Namespace management and function deployment
- Binary packaging with base64 encoding
- Function lifecycle management
- Health checks and warming
- Builder API (
.with_faas_executor()) - Comprehensive documentation
📋 Testing Status
Test Coverage:
- ✅ 14 unit and integration tests passing
- ✅ HTTP FaaS executor tests with endpoint configuration
- ✅ Function naming and resource management tests
- ✅ Reference server for local development
- 🔒 11 tests require cloud credentials (ignored in CI)
Run Tests:
# Run all tests (credential tests ignored)
# Run custom HTTP tests
# Run reference server for manual testing
🚧 Future Enhancements
- E2E tests for GCP, Azure, and DigitalOcean providers with real cloud deployments
- Additional providers: Vercel Functions, Netlify Functions, Cloudflare Workers (with WASM support)
- Performance benchmarks and optimization
Features
[]
= { = "0.1", = ["aws"] }
Available features:
aws- AWS Lambda integrationgcp- Google Cloud Functions integrationazure- Azure Functions integrationdigitalocean- DigitalOcean Functions integrationcustom- Custom HTTP FaaSall- All providers
Provider Configuration
AWS Lambda
Authentication: Uses AWS SDK credentials (IAM roles, environment variables, or ~/.aws/credentials)
Requirements:
- AWS account with Lambda access
- IAM role with Lambda execution permissions
- Binary deployment region configuration
Setup:
GCP Cloud Functions
Authentication: Uses Application Default Credentials
Requirements:
- GCP project with Cloud Functions API enabled
- Cloud Storage API enabled (for function deployment)
- Service account with appropriate permissions
Setup:
Or use service account:
Azure Functions
Authentication: Uses DefaultAzureCredential (supports multiple auth methods)
Requirements:
- Azure subscription
- Resource group for function deployment
- Azure Functions runtime access
Setup:
Or use service principal:
DigitalOcean Functions
Authentication: Uses DigitalOcean API token
Requirements:
- DigitalOcean account with Functions access
- API token with read/write permissions
- Namespace is automatically created if not exists
Setup:
Supported Regions: nyc1, nyc3, sfo3, ams3, sgp1, fra1, tor1, blr1, syd1
Custom HTTP FaaS
Authentication: Configurable (API Key, OAuth 2.0, mTLS)
Requirements:
- HTTP endpoint implementing the Custom FaaS Platform Spec
Setup: Provider-specific (see your platform documentation)
When to Use FaaS
Good Use Cases ✅
- Infrequent, expensive jobs - Save costs by not running 24/7
- Bursty workloads - Auto-scaling handles traffic spikes
- Isolated computation - CPU/memory-intensive tasks
- Cost optimization - Pay-per-use vs always-on
Keep Local ❌
- Frequent, cheap jobs - FaaS invocation overhead not worth it
- Stateful operations - FaaS functions are stateless
- Low latency requirements - Cold starts add latency
- Large binary deployments - Lambda has size limits
Building Custom FaaS Platforms
Want to integrate your own serverless platform? Blueprint SDK provides a complete specification for custom FaaS platforms.
See the Custom FaaS Platform Specification for:
- HTTP API Requirements: Full lifecycle endpoints (deploy, invoke, health, undeploy)
- Request/Response Formats: Complete JSON schemas with examples
- Authentication Options: API Key, OAuth 2.0, mTLS
- Performance Requirements: Latency targets, throughput, reliability
- Resource Limits: Binary size, memory, timeout, concurrency
- Reference Implementation: Complete Python (FastAPI) example
- Testing Procedures: Step-by-step integration testing
The specification enables ANY serverless platform to become a first-class FaaS provider in Blueprint SDK, with the same capabilities as AWS Lambda, GCP Cloud Functions, and Azure Functions.
Example usage:
use HttpFaasExecutor;
// Point to your custom platform implementing the spec
let executor = new
.with_auth_header;
builder
.with_faas_executor
.run.await?;
Architecture Decisions
Why Trait-Based?
Provider-agnostic design allows:
- Easy switching between FaaS providers
- Testing with mock executors
- Custom platform integration
Why Registry Pattern?
Centralized job-to-executor mapping enables:
- Clear visibility of FaaS vs local execution
- Runtime reconfiguration
- Per-job provider selection
Why Programmatic Delegation?
Explicit .with_faas_executor() registration provides:
- Fine-grained control
- No magic/detection logic
- Clear developer intent
Development
Adding a New Provider
- Create module in
src/(e.g.,cloudflare.rs) - Implement
FaasExecutortrait - Add feature flag to
Cargo.toml - Re-export in
lib.rs
Testing
Due to the sp-io issue, use:
# Verify structure compiles
# Run basic tests (when sp-io is fixed)
Examples
See examples/ directory:
reference_faas_server.rs- Reference HTTP FaaS server implementing the Custom FaaS Platform Spec
Run the reference server for local testing:
The server runs on http://localhost:8080 and implements all endpoints from the Custom FaaS Platform Specification.
Contributing
All major cloud providers (AWS, GCP, Azure, DigitalOcean) are now fully implemented! Contributions welcome for:
- E2E Tests: Integration tests for GCP, Azure, and DigitalOcean providers
- Additional Providers: Vercel Functions, Netlify Functions, Cloudflare Workers (with WASM), Deno Deploy, etc.
- Performance Optimizations: Token caching, connection pooling
- Documentation: More examples and tutorials
- Custom FaaS Platforms: Build your own using the specification
License
Same as parent project.