RaisFastRaisFast
Getting Started

Content Types

Define a database table in TOML and get a full CRUD API instantly — no code required.

Content Types let you define data models in a TOML file. The system auto-creates the database table and generates a complete REST API. Zero code, zero SQL.

Define a Portfolio

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"]

Get the API for Free

Start the server — the table is created, and you instantly get:

# List portfolios
curl http://localhost:9898/api/v1/cms/portfolios

# Get single portfolio
curl http://localhost:9898/api/v1/cms/portfolios/{id}

# Create portfolio
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"]}'

# Update portfolio
curl -X PUT http://localhost:9898/api/v1/cms/portfolios/{id} \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://mysaas.app"}'

# Delete portfolio
curl -X DELETE http://localhost:9898/api/v1/cms/portfolios/{id} \
  -H "Authorization: Bearer TOKEN"

Add Relations

Link content types together with zero join-table boilerplate:

# portfolio.toml — portfolio belongs to a category
[[fields]]
name = "category"
field_type = "relation"
relation = { relation_type = "many_to_one", target = "categories" }

# portfolio.toml — portfolio has many tags
[[fields]]
name = "tags"
field_type = "relation"
relation = { relation_type = "many_to_many", target = "tags", through = "portfolios_tags" }

Then query with include to populate relations:

curl http://localhost:9898/api/v1/cms/portfolios?include=category,tags

Add Behaviors with Protocols

Protocols are composable behaviors — add columns and logic without code:

[content_type.implements]
protocols = ["timestampable", "ownable", "soft_deletable", "sortable"]
ProtocolAddsWhat it does
timestampablecreated_at, updated_atAuto-managed timestamps
ownablecreated_by, updated_byAuto-set from auth user
soft_deletabledeleted_atLogical delete, filters IS NULL
sortablesort_keyDefault ordering
statusablestatusState machine with allowed values
nestableparent_id, depthParent-child tree
metaable__meta (JSON)Arbitrary metadata

Control Access

[content_type.api.list]
access = "public"
filter = 'status = "published"'

[content_type.api.create]
access = "admin"

[content_type.api.delete]
access = "admin"
LevelMeaning
publicNo auth required
memberAuthenticated user
adminAdmin role only

Use the CLI

raisfast ct new portfolio        # Create a content type scaffold
raisfast ct check               # Validate all TOML files
raisfast ct types portfolio -o types/portfolio.ts  # Generate TypeScript types

Next Step

On this page