Overview
Define a database table in TOML and get a full CRUD API instantly — no code, no SQL.
Content Types is RaisFast's schema-driven data modeling system. You write a TOML definition, and the system does the rest:
- Auto-creates the database table with all columns and indexes
- Auto-generates a complete REST API (list / get / create / update / delete)
- Auto-wires validation, access control, caching, and relation resolution
The Flow
TOML Definition → Auto Migration → Auto API → Ready to Use
↓ ↓ ↓
Schema file CREATE TABLE / GET/POST/
in extensions/ ALTER TABLE PUT/DELETEMinimal Example
Create extensions/content_types/portfolio.toml:
[content_type]
name = "Portfolio"
singular = "portfolio"
plural = "portfolios"
table = "portfolios"
[[fields]]
name = "title"
field_type = "text"
required = true
[[fields]]
name = "url"
field_type = "text"
[[fields]]
name = "cover"
field_type = "media"
media_config = { accept = ["image/*"], max_count = 1 }
[[fields]]
name = "description"
field_type = "text"
[[fields]]
name = "tech_stack"
field_type = "json"
[content_type.implements]
protocols = ["timestampable", "sortable"]Start the server and you instantly get:
# List
curl http://localhost:9898/api/v1/cms/portfolios
# Create
curl -X POST http://localhost:9898/api/v1/cms/portfolios \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"title":"My SaaS App","url":"https://mysaas.com","tech_stack":["Rust","React"]}'Schema Header
The [content_type] section defines the content type identity:
| Field | Required | Default | Description |
|---|---|---|---|
name | yes | — | Display name |
singular | yes | — | Identifier, used as registry key and in API paths |
plural | yes | — | Plural form, used in API paths |
table | yes | — | Database table name |
description | no | "" | Description |
slug_field | no | — | Field name to auto-generate slug from |
kind | no | "collection" | "collection" (many records) or "single" (one record) |
builtin | no | false | If true, default fields are not injected |
Two Kinds
Collection
The default kind. Multiple records, full CRUD API:
[content_type]
kind = "collection"Generates 5 endpoints: GET (list), GET /{id}, POST, PUT /{id}, DELETE /{id}.
Single
For one-record models (site settings, homepage config):
[content_type]
kind = "single"Generates only 2 endpoints: GET (auto-creates on first request) and PUT (update the single record).
Where TOML Files Live
Content type definitions are loaded from:
extensions/content_types/*.tomlBuilt-in templates (blog, ecommerce) are also loaded automatically on first run.
What's Next
Field Types
17 field types, validation rules, and configuration options.
Relations
6 relation types with automatic join table creation and query population.
Protocols
11 composable behaviors that add columns and logic without code.
API Reference
Auto-generated routes, access control, rule engine, and query parameters.
Schema Management
CLI commands, Admin API, hot-reload, and migration strategy.
Real Example
A complete multi-table example: online course platform.
