Quick Start

Get FlameCMS running in under 5 minutes. By the end of this guide you will have a live API serving your first custom content type.

Prerequisites

Before you begin, make sure the following are installed on your machine:

RequirementMinimum VersionRecommended
Node.js18.x20.x LTS
npm / pnpmnpm 9+ / pnpm 8+pnpm 9
PostgreSQL14.x16.x

Tip: Use nvm to manage Node.js versions. Run nvm use 20 for the best experience.

You also need a PostgreSQL database ready to accept connections. For local development, the quickest option is Docker:

docker run -d \
  --name flamecms-pg \
  -e POSTGRES_USER=flame \
  -e POSTGRES_PASSWORD=secret \
  -e POSTGRES_DB=flamecms \
  -p 5432:5432 \
  postgres:16-alpine

Create a New Project

Use the official CLI to scaffold a new project:

npx create-flamecms@latest my-cms

The CLI will ask a few questions:

? Project name › my-cms
? Database URL › postgresql://flame:secret@localhost:5432/flamecms
? Default locale › en
? Enable GraphQL? › No / Yes
? Install dependencies now? › Yes (recommended)

Once complete, navigate into your project:

cd my-cms

Project Structure

my-cms/
├── content-types/        # Your content schemas (TypeScript)
│   └── example.ts
├── plugins/              # Local plugins (auto-loaded)
├── migrations/           # SQL migration files (auto-generated)
├── public/               # Static files served at /public
├── flamecms.config.ts    # Main configuration file
├── .env                  # Environment variables (never commit this)
├── .env.example          # Template for team members
├── package.json
└── tsconfig.json

Key files:

  • flamecms.config.ts — the single source of truth for your entire CMS configuration
  • content-types/ — define your data models here as TypeScript objects
  • migrations/ — every schema change generates a migration file; commit these to version control

Start the Development Server

npm run dev
# or
pnpm dev

FlameCMS starts on http://localhost:3001 by default. You should see:

🔥 FlameCMS v1.0.0
   API:    http://localhost:3001/api
   Admin:  http://localhost:3001/admin
   Docs:   http://localhost:3001/api/docs

Open http://localhost:3001/api/docs to browse the auto-generated Swagger UI for all your endpoints.

Your First Content Type

Open content-types/ and create a new file blog-post.ts:

// content-types/blog-post.ts
import { defineContentType } from 'flamecms'

export default defineContentType({
  name: 'BlogPost',
  tableName: 'blog_posts',  // optional — defaults to snake_case of name

  fields: {
    title: {
      type: 'string',
      required: true,
      maxLength: 255,
    },
    slug: {
      type: 'slug',
      from: 'title',   // auto-generated from title field
      unique: true,
    },
    body: {
      type: 'richtext',
    },
    excerpt: {
      type: 'text',
      maxLength: 500,
    },
    author: {
      type: 'relation',
      to: 'User',
      many: false,
    },
    tags: {
      type: 'relation',
      to: 'Tag',
      many: true,
    },
    publishedAt: {
      type: 'datetime',
      nullable: true,
    },
    published: {
      type: 'boolean',
      default: false,
    },
  },
})

Apply the schema change by running the migration:

npx flamecms migrate

Output:

✔  Running migration 0001_create_blog_posts.sql
✔  Schema is up to date

Query Your Content

FlameCMS auto-generates a full REST API for every content type. Try it now:

# Create a post
curl -X POST http://localhost:3001/api/blog-posts \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token>" \
  -d '{"title":"Hello FlameCMS","body":"<p>My first post</p>","published":true}'

# List all published posts
curl "http://localhost:3001/api/blog-posts?where[published][$eq]=true&sort=publishedAt:desc"

# Get a single post by slug
curl "http://localhost:3001/api/blog-posts?where[slug][$eq]=hello-flamecms&populate=author,tags"

What's Next?

Previous