business-as-code 0.0.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,431 +1,261 @@
1
+ # business-as-code
2
+
1
3
  [![npm version](https://img.shields.io/npm/v/business-as-code.svg)](https://www.npmjs.com/package/business-as-code)
2
- [![npm downloads](https://img.shields.io/npm/dm/business-as-code.svg)](https://www.npmjs.com/package/business-as-code)
3
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
5
- [![Discord](https://img.shields.io/badge/Discord-Join%20Chat-7289da?logo=discord&logoColor=white)](https://discord.gg/tafnNeUQdm)
6
- [![GitHub Issues](https://img.shields.io/github/issues/drivly/ai.svg)](https://github.com/drivly/ai/issues)
7
- [![GitHub Stars](https://img.shields.io/github/stars/drivly/ai.svg)](https://github.com/drivly/ai)
8
-
9
- # business-as-code
10
5
 
11
- > Build, define, launch, experiment, iterate, and grow your business entirely in code.
6
+ > Define, launch, experiment, iterate, and grow your business entirely in code
12
7
 
13
8
  ## Overview
14
9
 
15
- Business-as-Code represents a revolutionary approach to defining, operating, and scaling businesses. It moves beyond traditional methods by enabling the entire business lifecycle—from initial concept and strategy to execution and iteration—to be managed through clean, structured, and executable code.
16
-
17
- This paradigm builds upon core primitives like Functions, Workflows, and Agents, allowing complex business logic, processes, and even autonomous operations to be codified. By treating the business itself as a software system, we unlock unprecedented levels of agility, transparency, experimentation, and optimization.
18
-
19
- Drawing inspiration from the principles outlined in the [Manifesto](/docs/manifesto) and leveraging the foundational [Primitives](/docs/primitives) of the [.do](https://dotdo.ai) ecosystem, `business-as-code` provides the framework to transform strategic objectives into measurable outcomes through code.
20
-
21
- ## Declarative vs. Imperative Approaches
22
-
23
- The `business-as-code` package supports two complementary approaches to defining and executing business logic:
24
-
25
- ### Declarative Approach
26
-
27
- Define your business at a high level using objectives and key results (OKRs). The system, powered by AI, determines the optimal implementation strategy. This approach is ideal for setting strategic direction and allowing flexibility in execution.
28
-
29
- ```typescript
30
- import { Business } from 'business-as-code'
31
-
32
- const myBusiness = Business({
33
- name: 'TechInnovators',
34
- vision: 'Democratize AI for small businesses',
35
- objectives: {
36
- customerSuccess: {
37
- description: 'Create delighted customers who achieve their goals',
38
- keyResults: [
39
- 'Achieve 95% customer satisfaction score by Q4',
40
- 'Reduce average support ticket resolution time by 30% within 6 months',
41
- 'Increase customer retention rate to 85% year-over-year',
42
- ]
43
- },
44
- productInnovation: {
45
- description: 'Continuously deliver cutting-edge AI solutions',
46
- keyResults: [
47
- 'Launch 3 new major features based on customer feedback this year',
48
- 'Secure 2 patents for novel AI algorithms',
49
- 'Increase R&D investment by 15% annually',
50
- ]
51
- },
52
- // More objectives...
53
- }
54
- })
10
+ `business-as-code` provides a schema-first approach to defining business entities. Write your business model in MDX, YAML, or JSON, and use it across different platforms.
55
11
 
56
- // Let the AI determine and execute the best approach to achieve the objectives
57
- await myBusiness.execute()
12
+ ```
13
+ business-as-code (portable schema layer)
14
+
15
+ ┌───┴───┐
16
+ ↓ ↓
17
+ Startups.Studio Platform.do
18
+ (AI startups) (Enterprise)
58
19
  ```
59
20
 
60
- ### Imperative Approach
21
+ This is the **schema definition layer** - it defines what your business entities look like. It works alongside runtime packages like [agents.do](https://agents.do), [workflows.do](https://workflows.do), and [humans.do](https://humans.do) which handle the actual business operations.
61
22
 
62
- Define specific processes step-by-step using workflows. This approach provides fine-grained control over execution and is suitable for well-defined, repeatable tasks. It leverages the patterns established in [Workflows.do](https://workflows.do).
23
+ ## Installation
63
24
 
64
- ```typescript
65
- import { Workflow } from 'workflows.do' // Assuming Workflow comes from workflows.do
66
-
67
- const customerOnboarding = Workflow({
68
- name: 'CustomerOnboarding',
69
-
70
- onCustomerSignup: async ({ ai, api, db, event }) => {
71
- const { name, email, company } = event
72
-
73
- // Step 1: Enrich contact details using Integrations.do
74
- const enrichedContact = await api.apollo.search({ name, email, company })
75
-
76
- // Step 2: Analyze company background using Functions.do
77
- const companyProfile = await ai.researchCompany({ company: enrichedContact.companyName || company })
78
-
79
- // Step 3: Personalize welcome email using Functions.do
80
- const welcomeEmail = await ai.personalizeWelcomeEmail({
81
- name,
82
- companyProfile
83
- })
84
-
85
- // Step 4: Send email using Integrations.do
86
- await api.sendgrid.sendEmail({
87
- to: email,
88
- subject: 'Welcome to TechInnovators!', // Hardcoded name for example clarity
89
- body: welcomeEmail.content
90
- })
91
-
92
- // Step 5: Create user record in Database.do
93
- await db.users.create({
94
- name,
95
- email,
96
- company: enrichedContact.companyName || company,
97
- enrichedData: enrichedContact
98
- })
99
-
100
- // Step 6: Notify team via Slack using Integrations.do
101
- await api.slack.postMessage({
102
- channel: '#signups',
103
- content: `New signup: ${name} from ${company}`,
104
- })
105
- }
106
- })
25
+ ```bash
26
+ npm install business-as-code
27
+ # or
28
+ pnpm add business-as-code
107
29
  ```
108
30
 
109
- ### Integration Between Approaches
110
-
111
- The true power emerges when combining both approaches. Define high-level business goals declaratively, and implement specific, critical processes imperatively within the same framework.
112
-
113
- ```typescript
114
- const combinedBusiness = Business({
115
- name: 'HybridSolutions',
116
- vision: '...',
117
- objectives: { /* ... */ },
118
-
119
- // Define specific workflows imperatively
120
- workflows: {
121
- customerOnboarding, // Reuse the imperative workflow defined above
122
- // Add other critical workflows...
123
- },
124
-
125
- // Define autonomous agents
126
- agents: {
127
- // Agents can leverage both declarative goals and imperative workflows
128
- }
129
- })
31
+ ## Quick Start
130
32
 
131
- // Execute the business, allowing AI to manage undeclared processes
132
- // while respecting the defined imperative workflows.
133
- await combinedBusiness.launch()
134
- ```
33
+ ### Use the Default Business Schema
135
34
 
136
- ## Core Primitives
35
+ The package includes a comprehensive default schema with 40+ business entities across 9 domains:
137
36
 
138
- Business-as-Code builds upon a foundation of powerful, composable primitives inherited from the [.do](https://dotdo.ai) ecosystem:
37
+ ```typescript
38
+ import { defaultBusinessSchema, getAllNouns } from 'business-as-code'
139
39
 
140
- - **[Functions](/docs/functions)**: The atomic units of work. They can be deterministic code, AI-driven generation, autonomous agent tasks, or even human actions, all with strongly-typed inputs and outputs.
141
- - **[Workflows](/docs/workflows)**: Orchestrate Functions into reliable, repeatable business processes. They combine different function types (Code, Generative, Agent, Human) to achieve specific outcomes aligned with business goals.
142
- - **[Agents](/docs/agents)**: Autonomous digital workers driven by goals and measured by key results. They execute tasks, interact within workflows, and leverage Functions and external integrations.
40
+ // Get all nouns from the default business schema
41
+ const nouns = getAllNouns(defaultBusinessSchema)
42
+ console.log(`${nouns.length} nouns loaded`)
143
43
 
144
- These primitives provide the building blocks for codifying every aspect of a business.
44
+ // Access specific noun schemas directly
45
+ import { Customers, Products, Invoices, Projects, Teams } from 'business-as-code'
46
+ ```
145
47
 
146
- ## Business Model Components
48
+ ### Define Custom Business in MDX
147
49
 
148
- Define key aspects of your business model directly in code. This allows for a structured, version-controlled representation of your strategy, integrating frameworks like Lean Canvas or StoryBrand.
50
+ MDX provides the most expressive way to define business entities with JSX-like syntax:
149
51
 
150
52
  ```typescript
151
- import { Business } from 'business-as-code'
152
- import { LeanCanvas, StoryBrand } from 'business-model-components' // Hypothetical import
153
-
154
- const myStartup = Business({
155
- name: 'AgileAI',
156
- vision: 'Empower teams with AI-driven project management',
157
- objectives: { /* ... */ },
158
-
159
- // Define business model using structured components
160
- businessModel: {
161
- leanCanvas: LeanCanvas({
162
- problem: ['Inefficient project tracking', 'Poor resource allocation'],
163
- solution: 'AI-powered platform for automated task management and prediction',
164
- keyMetrics: ['Daily active users', 'Project completion rate'],
165
- uniqueValueProposition: 'Effortless project management with predictive insights',
166
- unfairAdvantage: 'Proprietary predictive algorithms',
167
- channels: ['Direct sales', 'Content marketing'],
168
- customerSegments: ['Software development teams', 'Marketing agencies'],
169
- costStructure: ['Cloud hosting', 'R&D salaries', 'Sales commissions'],
170
- revenueStreams: ['SaaS subscription tiers', 'Premium support'],
171
- }),
172
- storyBrand: StoryBrand({
173
- character: 'Project Managers',
174
- problem: 'Overwhelmed by complexity and delays',
175
- plan: 'Implement AgileAI for streamlined workflows',
176
- success: 'Effortless project delivery and happy teams',
177
- failure: 'Continued chaos and missed deadlines',
178
- }),
179
- // Add other relevant model components...
180
- },
181
-
182
- workflows: { /* ... */ },
183
- agents: { /* ... */ },
184
- })
185
-
186
- await myStartup.launch()
53
+ import { loadFromMDX, mergeSchemas, defaultBusinessSchema } from 'business-as-code'
54
+
55
+ const mdx = `
56
+ <Business name="My SaaS">
57
+ <Noun name="Tenant" group="Admin">
58
+ <Name text required />
59
+ <Subdomain text unique />
60
+ <Plan status="free|pro|enterprise" />
61
+ <Owner user />
62
+ </Noun>
63
+
64
+ <Noun name="Feature" group="Product">
65
+ <Name text required />
66
+ <Description rich />
67
+ <Tier status="free|pro|enterprise" />
68
+ <Enabled boolean />
69
+ </Noun>
70
+ </Business>
71
+ `
72
+
73
+ const customSchema = await loadFromMDX(mdx)
74
+ const fullSchema = mergeSchemas(defaultBusinessSchema, customSchema)
187
75
  ```
188
76
 
189
- ## Experimentation and Iteration
77
+ ### Define Custom Business in YAML
190
78
 
191
- Business-as-Code enables rapid experimentation directly within your operational framework. Test hypotheses, measure results, and iterate on your strategies and processes using code.
79
+ YAML is ideal for configuration files and version control:
192
80
 
193
81
  ```typescript
194
- import { Business, Experiment, Workflow } from 'business-as-code' // Assuming Workflow is exported here or import from 'workflows.do'
195
-
196
- const experimentalBusiness = Business({
197
- name: 'GrowthHackers Inc.',
198
- vision: '...',
199
- objectives: {
200
- userAcquisition: {
201
- description: 'Maximize new user signups',
202
- keyResults: ['Increase weekly signups by 20% in Q3']
203
- }
204
- },
205
- // ... other definitions
206
- })
207
-
208
- // Define an experiment to test different onboarding flows
209
- const onboardingExperiment = Experiment({
210
- name: 'Onboarding Flow Test',
211
- hypothesis: 'A simplified onboarding flow will increase signup conversion rate.',
212
- variants: {
213
- control: { // Current implementation (defined elsewhere or implicitly handled)
214
- workflow: 'standardOnboardingWorkflow'
215
- },
216
- simplified: { // New variant defined imperatively
217
- workflow: Workflow({
218
- name: 'SimplifiedOnboarding',
219
- onUserVisit: async ({ ai, api, event }) => {
220
- // Minimal steps for quick signup
221
- const { email } = event
222
- await api.auth.createAccount({ email })
223
- await api.sendgrid.sendEmail({ to: email, template: 'quick_welcome' })
224
- // ... fewer steps than control
225
- }
226
- })
227
- }
228
- },
229
- metrics: ['signupConversionRate', 'timeToSignup'],
230
- trafficSplit: { control: 0.5, simplified: 0.5 },
231
- targetObjective: experimentalBusiness.objectives.userAcquisition,
232
- })
233
-
234
- // Add the experiment to the business definition
235
- experimentalBusiness.addExperiment(onboardingExperiment)
236
-
237
- // Launch the business with the experiment running
238
- await experimentalBusiness.launch()
239
-
240
- // Later, analyze results (assuming analysis functions exist)
241
- // const results = await experimentalBusiness.analyzeExperiment('Onboarding Flow Test')
242
- // console.log(results)
82
+ import { loadFromYAML } from 'business-as-code'
83
+
84
+ const yaml = `
85
+ name: My SaaS
86
+ version: 1.0.0
87
+
88
+ domains:
89
+ admin:
90
+ - name: Tenant
91
+ titleField: name
92
+ fields:
93
+ name: text required
94
+ subdomain: text unique
95
+ plan: status:free|pro|enterprise
96
+ owner: ref:users
97
+
98
+ product:
99
+ - name: Feature
100
+ titleField: name
101
+ fields:
102
+ name: text required
103
+ description: rich
104
+ tier: status:free|pro|enterprise
105
+ enabled: boolean
106
+ `
107
+
108
+ const schema = loadFromYAML(yaml)
243
109
  ```
244
110
 
245
- ## Real-World Examples
111
+ ### Define Custom Business in JSON
246
112
 
247
- Here's a comprehensive example demonstrating how to define a SaaS business using the `business-as-code` framework:
113
+ JSON works well for programmatic generation and API responses:
248
114
 
249
115
  ```typescript
250
- import { Business, Workflow, Agent, Function } from 'business-as-code' // Assuming all primitives are exported
251
- import { Database } from 'database.do' // Assuming Database comes from database.do
252
- import { API } from 'apis.do' // Assuming API comes from apis.do
253
-
254
- // Define core business logic components first (Workflows, Agents, Functions)
255
-
256
- // Example: Lead Generation Workflow
257
- const leadGeneration = Workflow({
258
- name: 'LeadGeneration',
259
- onWebsiteVisit: async ({ ai, api, db, event }) => {
260
- const { visitorId, pageUrl } = event
261
- // Track visit
262
- await db.events.log({ type: 'website_visit', visitorId, pageUrl })
263
-
264
- // If visitor shows interest (e.g., downloads whitepaper)
265
- if (event.action === 'download_whitepaper') {
266
- const leadData = await api.hubspot.findContact({ email: event.email }) // Use Integrations.do
267
- if (!leadData) {
268
- await api.hubspot.createContact({ email: event.email, name: event.name })
269
- await api.slack.postMessage({ channel: '#leads', content: `New lead: ${event.name} (${event.email})`})
270
- }
271
- }
272
- }
273
- })
274
-
275
- // Example: Customer Support Agent
276
- const supportAgent = Agent({
277
- name: 'SupportAgent',
278
- goal: 'Resolve customer support tickets efficiently and effectively',
279
- keyResults: [
280
- 'Maintain average first response time under 1 hour',
281
- 'Achieve customer satisfaction score (CSAT) of 90%+'
282
- ],
283
- onTicketReceived: async ({ ai, api, db, ticket }) => {
284
- // Analyze ticket content
285
- const analysis = await ai.analyzeSupportTicket({ content: ticket.description })
286
-
287
- // Find relevant documentation using Functions.do
288
- const relevantDocs = await ai.findRelevantDocs({ query: analysis.topic })
289
-
290
- // Draft response
291
- const draftResponse = await ai.draftSupportResponse({
292
- query: ticket.description,
293
- context: relevantDocs
294
- })
295
-
296
- // Post response (or assign to human if needed)
297
- await api.zendesk.updateTicket({ id: ticket.id, comment: draftResponse.content })
298
- }
299
- })
300
-
301
- // Define the complete SaaS business
302
- const saasCompany = Business({
303
- name: 'DataInsights',
304
- vision: 'Make data analytics accessible to non-technical teams',
305
-
306
- objectives: {
307
- growth: {
308
- description: 'Achieve market leadership in SMB analytics',
309
- keyResults: [
310
- 'Acquire 1000 paying customers by end of year',
311
- 'Reach $1M ARR within 18 months',
312
- ]
313
- },
314
- product: {
315
- description: 'Deliver an intuitive and powerful analytics platform',
316
- keyResults: [
317
- 'Achieve a Net Promoter Score (NPS) of 50+',
318
- 'Reduce onboarding time to under 30 minutes',
319
- ]
320
- }
321
- },
322
-
323
- // Integrate defined workflows
324
- workflows: {
325
- leadGeneration,
326
- customerOnboarding, // Reuse from earlier example
327
- // Add billing, feature-request workflows etc.
328
- },
329
-
330
- // Integrate defined agents
331
- agents: {
332
- supportAgent,
333
- // Add sales outreach agent, data analysis agent etc.
334
- },
335
-
336
- // Define the core data model using Database.do concepts
337
- dataModel: {
338
- users: Database.collection({ /* ... schema ... */ }),
339
- organizations: Database.collection({ /* ... schema ... */ }),
340
- datasets: Database.collection({ /* ... schema ... */ }),
341
- reports: Database.collection({ /* ... schema ... */ }),
342
- // Define relationships, indexes etc.
343
- },
344
-
345
- // Define core functions the business relies on
346
- functions: {
347
- // Example: A function to generate insights from data
348
- generateReportInsights: Function({
349
- name: 'GenerateReportInsights',
350
- input: { reportId: 'string' },
351
- output: { insights: 'string[]' },
352
- run: async ({ input, ai, db }) => {
353
- const reportData = await db.reports.find({ id: input.reportId })
354
- // Complex AI logic to derive insights...
355
- const insights = await ai.analyzeDataAndGenerateInsights({ data: reportData })
356
- return { insights }
116
+ import { loadFromJSON } from 'business-as-code'
117
+
118
+ const json = {
119
+ name: "My SaaS",
120
+ version: "1.0.0",
121
+ domains: {
122
+ admin: [{
123
+ name: "Tenant",
124
+ titleField: "name",
125
+ fields: {
126
+ name: "text required",
127
+ subdomain: "text unique",
128
+ plan: "status:free|pro|enterprise"
357
129
  }
358
- })
359
- // Add other core business functions
130
+ }]
360
131
  }
361
- })
362
-
363
- // Launch the business operations
364
- await saasCompany.launch()
132
+ }
365
133
 
366
- console.log(`Business '${saasCompany.name}' launched successfully.`) // Note: Backticks are fine for template literals
134
+ const schema = loadFromJSON(JSON.stringify(json))
367
135
  ```
368
136
 
369
- ## Getting Started
137
+ ## Domains
138
+
139
+ The default business schema includes these domains:
140
+
141
+ | Domain | Nouns | Description |
142
+ |--------|-------|-------------|
143
+ | **Admin** | Users, Orgs, ServiceAccounts | System administration |
144
+ | **Business** | Businesses, Goals, Metrics, Teams, Processes | Core business entities |
145
+ | **Product** | Products, Services, Offers, Prices, Features | Product catalog |
146
+ | **Success** | Customers, Contacts, Subscriptions | Customer success |
147
+ | **Sales** | Deals, Quotes, Proposals | Sales pipeline |
148
+ | **Marketing** | Leads, Brands, Domains, Competitors | Marketing & branding |
149
+ | **Work** | Projects, Tasks, Issues, Workflows, Roles, Agents | Work management |
150
+ | **Financial** | Invoices, Payments, Refunds, ChartOfAccounts, JournalEntries | Accounting |
151
+ | **Communications** | Channels, Messages, Sequences, Templates, Posts | Messaging |
152
+
153
+ ## Field Types
154
+
155
+ ### Primitive Types
156
+ | Type | Description | Example |
157
+ |------|-------------|---------|
158
+ | `text` | Single-line text | `name: text` |
159
+ | `rich` | Rich text / markdown | `description: rich` |
160
+ | `number` | Numeric value | `count: number` |
161
+ | `boolean` | True/false checkbox | `isActive: boolean` |
162
+ | `date` | Date picker | `createdAt: date` |
163
+
164
+ ### Semantic Types (with validation)
165
+ | Type | Description | Example |
166
+ |------|-------------|---------|
167
+ | `email` | Email address | `email: email` |
168
+ | `url` | Valid URL | `website: url` |
169
+ | `phone` | Phone number | `phone: phone` |
170
+ | `slug` | URL-safe slug | `slug: slug` |
171
+
172
+ ### Business Types
173
+ | Type | Description | Example |
174
+ |------|-------------|---------|
175
+ | `money` | Currency amount | `price: money` |
176
+ | `score` | 0-100 value | `health: score` |
177
+ | `status:a\|b\|c` | Select options | `status: status:active\|inactive` |
178
+
179
+ ### Relationship Types
180
+ | Type | Description | Example |
181
+ |------|-------------|---------|
182
+ | `ref:collection` | Reference to another noun | `customer: ref:customers` |
183
+ | `user` | Reference to users | `owner: user` |
184
+
185
+ ### Modifiers
186
+ | Modifier | Description | Example |
187
+ |----------|-------------|---------|
188
+ | `required` | Field must have value | `name: text required` |
189
+ | `unique` | Value must be unique | `slug: text unique` |
190
+
191
+ ## API Reference
192
+
193
+ ### Schema Functions
370
194
 
371
- ### Installation
195
+ ```typescript
196
+ import {
197
+ defaultBusinessSchema, // The complete default schema
198
+ getAllNouns, // Get all nouns as flat array
199
+ getDomainNouns, // Get nouns for a specific domain
200
+ getDomains, // Get list of all domain names
201
+ findNounBySlug, // Find a noun by its slug
202
+ mergeSchemas, // Merge two schemas together
203
+ validateSchema, // Validate a schema structure
204
+ createMinimalSchema, // Create empty schema scaffold
205
+ } from 'business-as-code'
206
+ ```
372
207
 
373
- To install the `business-as-code` package, use your preferred package manager:
208
+ ### Loaders
374
209
 
375
- ```bash
376
- pnpm add business-as-code # Using pnpm (recommended for this monorepo)
377
- # or
378
- npm install business-as-code
379
- # or
380
- yarn add business-as-code
210
+ ```typescript
211
+ import {
212
+ load, // Auto-detect format and load
213
+ loadFromMDX, // Load from MDX source
214
+ loadFromYAML, // Load from YAML source
215
+ loadFromJSON, // Load from JSON source
216
+ loadNoun, // Load a single noun definition
217
+ loadNouns, // Load multiple noun definitions
218
+ } from 'business-as-code'
381
219
  ```
382
220
 
383
- ### Basic Usage
384
-
385
- 1. **Import necessary components**: Start by importing `Business` and other primitives like `Workflow`, `Agent`, or `Function` as needed.
386
- 2. **Define your Business**: Use the `Business()` constructor, providing a name, vision, and objectives.
387
- 3. **Codify Components**: Define your core workflows, agents, data models, and functions using the respective primitives.
388
- 4. **Integrate Components**: Add your defined workflows, agents, etc., into the `Business` definition.
389
- 5. **Launch**: Call the `.launch()` method on your business instance to start its operations.
221
+ ### Serializers
390
222
 
391
223
  ```typescript
392
- import { Business } from 'business-as-code'
393
-
394
- // 1. Define the business high-level goals
395
- const mySimpleBusiness = Business({
396
- name: 'My First Coded Business',
397
- vision: 'To automate simple tasks',
398
- objectives: {
399
- taskAutomation: {
400
- description: 'Automate one repetitive task this quarter',
401
- keyResults: ['Successfully automate task X by end of Q3']
402
- }
403
- }
404
- // Add simple workflows or functions if needed
405
- })
224
+ import {
225
+ serialize, // Serialize schema to YAML or JSON
226
+ toYAML, // Serialize to YAML string
227
+ toJSON, // Serialize to JSON string
228
+ serializeNoun, // Serialize single noun
229
+ nounToYAML, // Noun to YAML
230
+ nounToJSON, // Noun to JSON
231
+ } from 'business-as-code'
232
+ ```
406
233
 
407
- // 2. Launch the business
408
- async function start() {
409
- await mySimpleBusiness.launch()
410
- console.log('Business launched!')
411
- }
234
+ ### Types
412
235
 
413
- start()
236
+ ```typescript
237
+ import type {
238
+ BusinessSchema, // Complete business schema
239
+ BusinessDomain, // Domain name type
240
+ NounSchema, // Individual noun definition
241
+ FieldSchema, // Field definition
242
+ FieldType, // Field type union
243
+ LoaderOptions, // Options for loaders
244
+ LoadResult, // Result from load operations
245
+ } from 'business-as-code'
414
246
  ```
415
247
 
416
- This basic structure provides the starting point for building more complex, fully codified businesses. Explore the examples above and the documentation for individual primitives ([Functions](/docs/functions), [Workflows](/docs/workflows), [Agents](/docs/agents)) to learn more.
417
-
418
- ## License
248
+ ## Integration
419
249
 
420
- MIT
250
+ `business-as-code` provides the schema layer that integrates with the broader .do ecosystem:
421
251
 
422
- ## Foundational Primitives
252
+ - **[db.sb](https://db.sb)** - Database runtime that executes these schemas
253
+ - **[Startups.Studio](https://startups.studio)** - AI-operated autonomous startups
254
+ - **[Platform.do](https://platform.do)** - Enterprise business platform
255
+ - **[agents.do](https://agents.do)** - AI agents for business operations
256
+ - **[workflows.do](https://workflows.do)** - Business process automation
257
+ - **[humans.do](https://humans.do)** - Human role definitions
423
258
 
424
- Business-as-Code builds upon and orchestrates the core primitives of the [.do](https://dotdo.ai) ecosystem:
259
+ ## License
425
260
 
426
- - [apis.do](https://www.npmjs.com/package/apis.do) - The foundational SDK for all integrations.
427
- - [functions.do](https://www.npmjs.com/package/functions.do) - AI-powered Functions-as-a-Service.
428
- - [workflows.do](https://www.npmjs.com/package/workflows.do) - Elegant business process orchestration.
429
- - [agents.do](https://www.npmjs.com/package/agents.do) - Autonomous AI workers.
430
- - [database.do](https://www.npmjs.com/package/database.do) - AI Native Data Access.
431
- - Other `.do` services as needed (Events, Analytics, etc.)
261
+ MIT