Services-as-Software
Package and deploy business capabilities as autonomous services
Transform business capabilities into deployable, monetizable services that operate autonomously.
What is Services-as-Software?
Services-as-Software enables you to package business logic, AI capabilities, and workflows as reusable services. Each service is a self-contained unit that can be deployed, scaled, and monetized independently.
Core Concepts
Service Types
AI, automation, data, and business services
Service Composition
Combine services into workflows
Deployment
Deploy to production environments
Monetization
Pricing and billing models
Quick Start
import { $ } from 'sdk.do'
// Define a service
const service = await $.Service.create({
name: 'invoice-generator',
type: 'business-automation',
description: 'Generate professional invoices from orders',
inputs: {
orderId: 'string',
includeLineItems: 'boolean'
},
outputs: {
invoice: 'Invoice',
pdf: 'Buffer'
}
})
// Implement service logic
await $.Service.implement({
serviceId: service.id,
handler: async ({ orderId, includeLineItems }) => {
const order = await $.Order.get(orderId)
const invoice = await $.Invoice.generate({
order,
includeLineItems
})
const pdf = await $.PDF.render(invoice)
return { invoice, pdf }
}
})
// Deploy service
await $.Service.deploy({
serviceId: service.id,
environment: 'production',
pricing: {
model: 'per-use',
price: 0.10
}
})
// Use the service
const result = await $.Service.execute({
serviceId: service.id,
input: {
orderId: 'order-123',
includeLineItems: true
}
})Service Types
AI Services
Intelligent services powered by LLMs:
// Content generation service
const contentService = await $.Service.create({
name: 'blog-writer',
type: 'ai-content',
handler: async ({ topic, length }) => {
return await $.AI.generate({
prompt: `Write a ${length} blog post about ${topic}`,
model: 'gpt-5'
})
}
})
// Analysis service
const analysisService = await $.Service.create({
name: 'sentiment-analyzer',
type: 'ai-analysis',
handler: async ({ text }) => {
return await $.AI.analyze.Sentiment({ text })
}
})Automation Services
Workflow and process automation:
// Business process service
const onboardingService = await $.Service.create({
name: 'customer-onboarding',
type: 'automation-workflow',
steps: [
$.Email.send.Welcome,
$.Account.provision,
$.Team.assign.Support,
$.Training.schedule
]
})
// Data pipeline service
const pipelineService = await $.Service.create({
name: 'data-sync',
type: 'automation-pipeline',
schedule: 'every 1 hour',
handler: async () => {
await $.Data.extract.From('source')
await $.Data.transform()
await $.Data.load.To('destination')
}
})Business Services
Domain-specific business logic:
// Financial service
const billingService = await $.Service.create({
name: 'subscription-billing',
type: 'business-financial',
handler: async ({ customerId }) => {
const subscription = await $.Subscription.get(customerId)
const usage = await $.Usage.calculate(customerId)
const invoice = await $.Invoice.generate({
subscription,
usage
})
return invoice
}
})Service Composition
Combine services into powerful workflows:
// Compose multiple services
const orderProcessingWorkflow = await $.Workflow.create({
name: 'process-order',
services: [
$.Service.execute('validate-order'),
$.Service.execute('check-inventory'),
$.Service.execute('generate-invoice'),
$.Service.execute('process-payment'),
$.Service.execute('fulfill-order'),
$.Service.execute('send-confirmation')
]
})
// Execute composed workflow
await orderProcessingWorkflow.execute({
orderId: 'order-123'
})Monetization
Define pricing models for your services:
// Per-use pricing
await $.Service.setPricing({
serviceId: service.id,
model: 'per-use',
price: 0.10,
currency: 'USD'
})
// Subscription pricing
await $.Service.setPricing({
serviceId: service.id,
model: 'subscription',
tiers: [
{ name: 'Starter', price: 29, limit: 1000 },
{ name: 'Pro', price: 99, limit: 10000 },
{ name: 'Enterprise', price: 499, limit: 'unlimited' }
]
})
// Hybrid pricing
await $.Service.setPricing({
serviceId: service.id,
model: 'hybrid',
basePrice: 49,
perUse: 0.05,
included: 1000
})Use Cases
- AI Services - Content generation, analysis, recommendations
- Automation - Workflows, data pipelines, integrations
- Business Logic - Billing, invoicing, reporting
- Data Services - Enrichment, validation, transformation
- Integration - API connectors, webhooks, sync