🚧 FastCMS is under active development — not ready for production use. APIs and features may change without notice.
FastCMS
Core Concepts

Collections

Collections are the building blocks of FastCMS. Learn about Base, Auth, and View collection types.

Collections

FastCMS supports three types of collections, each designed for different use cases.

Collection Types

1. Base Collections

Standard collections for storing any type of data.

Use cases: Products, blog posts, comments, orders, any custom data

Features:

  • Define custom schema with any field types
  • Full CRUD operations via API
  • Access control rules
  • Automatic timestamps (created, updated)

2. Auth Collections

Special collections designed for user authentication. Auth collections automatically include authentication fields and endpoints.

Automatically added fields:

  • email (unique, indexed)
  • password (hashed with bcrypt)
  • verified (boolean, email verification status)
  • role (string, user role)
  • token_key (string, for session invalidation)

Automatically created endpoints:

  • POST /api/v1/collections/{name}/auth/register
  • POST /api/v1/collections/{name}/auth/login
  • POST /api/v1/collections/{name}/auth/refresh
  • POST /api/v1/collections/{name}/auth/otp/request — request OTP code
  • POST /api/v1/collections/{name}/auth/otp/verify — verify OTP and get tokens
  • POST /api/v1/collections/{name}/auth/me/change-password
  • POST /api/v1/collections/{name}/auth/me/request-email-change
  • POST /api/v1/collections/{name}/auth/me/confirm-email-change
  • GET /api/v1/collections/{name}/auth/sessions — list active sessions
  • DELETE /api/v1/collections/{name}/auth/sessions/{session_id} — revoke a session

Custom identity field: By default, auth collections use email as the login identifier. You can change this via the identity_field collection option:

{
  "name": "staff",
  "type": "auth",
  "options": {
    "identity_field": "username"
  }
}

Users then log in with their username value instead of email.

Access control: Auth collections support all five standard rules (list_rule, view_rule, create_rule, update_rule, delete_rule) plus a sixth — manage_rule — which gates privileged user management operations like account unlocking and forced verification. See Access Control for details.

Use cases: Customer accounts, vendor portals, team member access, any user type requiring authentication

3. View Collections

Virtual collections that compute data from other collections. Views do not store data but execute SQL queries to aggregate or join data from existing collections.

Features:

  • Define SQL SELECT queries
  • Support for JOINs, GROUP BY, ORDER BY
  • Configurable caching (TTL in seconds)
  • Read-only (no create, update, delete)

Use cases: Sales reports, user statistics, aggregated data, joined data from multiple collections

Admin Dashboard

The collections list shows all collections with their type, field count, and access rules at a glance:

localhost:8000/admin/collections

Collections

Manage database collections and schemas

posts

base

Fields

8

List:@request.auth.id != ""

users

auth
system

Fields

5

List:Public

products

base

Fields

12

List:Public

orders

base

Fields

9

List:@request.auth.id = @record.user_id

site_stats

view

Fields

4

List:@request.auth.role = "admin"

categories

base

Fields

3

List:Public

Creating Collections

Via Admin Dashboard

  1. Navigate to http://localhost:8000/admin/collections
  2. Click "Create Collection"
  3. Fill in the form: name, type, schema fields
  4. Click "Create Collection"

Via API

curl -X POST http://localhost:8000/api/v1/collections \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "products",
    "type": "base",
    "schema": [
      {
        "name": "title",
        "type": "text",
        "validation": {"required": true}
      },
      {
        "name": "price",
        "type": "number",
        "validation": {"required": true}
      }
    ]
  }'

Collections vs Records

ConceptDescriptionAPI Endpoint
CollectionThe schema/structure (like a table definition)/api/v1/collections
RecordThe data entries within a collection (rows)/api/v1/collections/{name}/records

Next Steps

On this page