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,tagsAdd Behaviors with Protocols
Protocols are composable behaviors — add columns and logic without code:
[content_type.implements]
protocols = ["timestampable", "ownable", "soft_deletable", "sortable"]| Protocol | Adds | What it does |
|---|---|---|
timestampable | created_at, updated_at | Auto-managed timestamps |
ownable | created_by, updated_by | Auto-set from auth user |
soft_deletable | deleted_at | Logical delete, filters IS NULL |
sortable | sort_key | Default ordering |
statusable | status | State machine with allowed values |
nestable | parent_id, depth | Parent-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"| Level | Meaning |
|---|---|
public | No auth required |
member | Authenticated user |
admin | Admin 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