.do
Core Concepts

resources

Structured data records (instances of nouns)

resources

Structured data records representing instances of entity types (nouns) with semantic relationships, validation, and lifecycle management.

Overview

The resources primitive provides a semantic layer over raw data, treating database records as first-class entities with types, relationships, and business logic using the $.Subject.predicate.Object pattern.

Quick Example

import { $ } from 'sdk.do'

// Create resource (instance of a noun)
const business = await $.Business.create({
  name: 'Acme Inc',
  industry: 'Technology',
  status: 'active',
})

// Resources have relationships
await $.Business.owns.Brand(business, brand)
await $.Business.employs.User(business, user)

// Query resources
const businesses = await $.Business.list({
  where: { industry: 'Technology' },
  limit: 10,
})

// Resources have lifecycle
await $.Business.update(business.id, { status: 'inactive' })
await $.Business.delete(business.id)

Core Capabilities

  • Semantic Types - Resources are instances of nouns (entity types)
  • Typed Relationships - Relate resources with predicates (verbs)
  • Validation - Schema validation and business rules
  • Lifecycle Hooks - onCreate, onUpdate, onDelete events
  • Access Control - Role-based permissions per resource type

Access Methods

SDK

TypeScript/JavaScript library for resource management

await $.Business.create({ name: 'Acme Inc', industry: 'Technology' })

SDK Documentation

CLI

Command-line tool for resource operations

do resource create Business --data '{"name":"Acme Inc","industry":"Technology"}'

CLI Documentation

API

REST/RPC endpoints for resources

curl -X POST https://api.do/v1/resources/Business -d '{"name":"Acme Inc"}'

API Documentation

MCP

Model Context Protocol for AI-driven resource management

Create a Business resource named "Acme Inc" in the Technology industry

MCP Documentation

  • nouns - Entity type definitions
  • verbs - Relationship definitions
  • database - Underlying data storage