Business
business-as-code
Framework for modeling and automating business operations as code
business-as-code
Business-as-Code framework for defining business processes, rules, and operations as executable, versionable, testable code with semantic patterns.
Overview
Business-as-Code enables you to model your entire business—from organizational structure to workflows to business rules—using code, making it versionable, testable, and fully automatable.
Parent Primitive: services - Service deployment and management
SDK Object Mapping
This primitive uses semantic patterns with $.Subject.predicate.Object and workflow orchestration:
import { $, workflow, on, send } from 'sdk.do'
// Define business entities with semantic patterns
await $.Business.create({
name: 'Acme Inc',
industry: '$.Industry.Technology',
departments: ['Engineering', 'Sales', 'Marketing'],
})
// Business processes as workflows (workflow uses every and on core objects)
workflow('order-to-cash', async ({ order }) => {
// Validate order
await $.Order.validate(order)
// Process payment
const payment = await $.Payment.process({
orderId: order.id,
amount: order.total,
})
// Create shipment
const shipment = await $.Shipment.create({
orderId: order.id,
address: order.shippingAddress,
})
// Send confirmation
await send($.Email.send, {
to: order.customer.email,
template: 'order-confirmation',
})
return { order, payment, shipment }
})
// Business rules with semantic patterns
on($.Order.created, async ({ order }) => {
// Apply business rules
if (order.total > 10000) {
await $.Order.assign.ApprovalWorkflow({ orderId: order.id })
}
})Quick Example
import { business } from 'sdk.do'
// Define business
const acme = business.define({
name: 'Acme Inc',
industry: 'Technology',
departments: ['Engineering', 'Sales', 'Marketing'],
})
// Define business process
acme.process('order-fulfillment', async ({ order }) => {
await validateOrder(order)
await processPayment(order)
await createShipment(order)
})Core Capabilities
- Business Modeling - Define organization structure, roles, and relationships
- Process Definition - Model business processes as executable workflows
- Business Rules - Codify business logic and decision rules
- Semantic Patterns - Use
$.Subject.predicate.Objectfor business entities - Version Control - Track business logic changes like code
Access Methods
SDK
TypeScript/JavaScript library for business modeling
await business.define({ name: 'Acme Inc', industry: 'Technology' })CLI
Command-line tool for business operations
do business define "Acme Inc" --industry TechnologyAPI
REST/RPC endpoints for business modeling
curl -X POST https://api.do/v1/business -d '{"name":"Acme Inc","industry":"Technology"}'MCP
Model Context Protocol for AI-driven business modeling
Define a business named "Acme Inc" in the Technology industryRelated Primitives
Parent Primitive
- services - Service deployment and management
Sibling Primitives
- services-as-software - AI-powered service delivery