# Database Operations That Read Like Business Logic

> Semantic CRUD primitives using natural language patterns. Type-safe create, read, update, delete, query, and aggregate operations with automatic validation, caching, and edge distribution across 300+ locations.

Canonical: https://verbs.do/

## In code

```ts
import { Verbs } from 'verbs.do'

// Semantic CRUD operations with type safety
const db = Verbs({ schema: $.Organization, validation: 'strict' })

on.Customer.registered($ => {
  // Create customer and subscription semantically
  const customer = db.create.Customer({ email: $.email, name: $.name })
  db.create.Subscription.for.Customer({ customerId: customer.id, plan: 'pro' })
})

on.Dashboard.loaded($ => {
  // Query and aggregate with natural patterns
  db.query.Customers.where({ status: 'active' })
  db.sum.Subscriptions.amount.where({ status: 'active' })
})
```

## Frequently asked questions

### How does verbs.do differ from traditional ORMs like Prisma or TypeORM?

Verbs.do uses semantic patterns that read like natural language: db.create.Customer, db.query.Orders.where(), db.update.Invoice.byId(). No schema files, migrations, or code generation—types are inferred from semantic schemas automatically. Operations run at the edge with <10ms latency globally, not in a traditional database server. Automatic caching, validation, and replication across 300+ locations with zero configuration.

### What about complex queries, joins, and transactions?

Full support for relational queries using semantic patterns: db.query.Orders.with.Items.and.Customer(). Automatic join optimization based on query patterns. ACID transactions with optimistic concurrency control and automatic retry. Aggregate functions (sum, avg, count, min, max), grouping, sorting, and pagination built-in. Use raw SQL for complex queries when needed.

### Can AI agents read and modify data safely?

Yes. Semantic verb patterns are self-documenting—agents understand db.create.Invoice means creating an invoice. Set permission boundaries per verb: agents can read but require approval for delete. Full audit logs track all agent operations with rollback capabilities. Agents can construct queries dynamically while respecting access control rules.

### How do I validate data and enforce business rules?

Automatic validation from semantic schemas with TypeScript inference. Define custom validators, constraints, and business rules using functions. Pre/post hooks for complex logic: beforeCreate, afterUpdate, onDelete. Built-in validators for email, URL, phone, credit cards, etc. Validation errors include detailed messages with field-level granularity.

### What databases are supported and how does migration work?

Verbs.do abstracts over multiple database backends: PostgreSQL, MySQL, SQLite, MongoDB, and Cloudflare D1. Write once, run anywhere—same semantic patterns across all databases. Zero-downtime migrations with automatic schema versioning. Import existing databases with automatic type generation. Enterprise support for Oracle, SQL Server, and custom data sources.

## Part of Platform.do

verbs.do is one of the primitives of Platform.do, in the Data layer (records, vocabulary and search). Every .do shares one grammar, Business-as-Code, and one SDK.

- What is Business-as-Code? https://platform.do/business-as-code
- Platform.do: https://platform.do/
- Docs: https://docs.platform.do
