Structured Data
Database
Schema-first database modeling with automatic bi-directional relationships
The database system provides schema-first data modeling with automatic bi-directional relationships. Define your schema once and get type-safe, provider-agnostic database access.
Database Schema
Field Definitions
Fields can be primitives, relations, or arrays:
Example Schema
Bi-directional Relations
When you define author: 'Author.posts', the system automatically:
- Creates
Post.author→ singleAuthor - Creates
Author.posts→ array ofPost[] - Maintains referential integrity
- Provides typed access in both directions
Parsed Schema
The schema is parsed into a normalized structure:
Database Operations
Basic CRUD
Queries
Vector Search
Provider Configuration
The database provider is resolved from DATABASE_URL:
MDX Definition
Database schemas can be defined in MDX:
Type Safety
Full TypeScript support: