Command Line Interface
Manage FastCMS from the terminal — create users, collections, run migrations, and start the dev server.
Command Line Interface
FastCMS includes a CLI for managing your CMS directly from the terminal. Install it from PyPI and the fastcms command is available globally.
Running the CLI
# Install FastCMS (if not already installed)
uv tool install pyfastcms
# Show all available commands
fastcms --helpAvailable Commands:
Commands:
create-admin Create a new admin user.
create-collection Create a new collection.
create-user Create a new user.
delete-collection Delete a collection by name.
dev Start the FastCMS development server.
info Display FastCMS system information.
init Initialize a new FastCMS project.
list-collections List all collections.
list-users List all users.
migrate Database migration commands.Quick Start
1. Create Your First Admin User
fastcms create-adminYou'll be prompted for email, password, and name:
$ fastcms create-admin
Email: admin@fastcms.dev
Password:
Repeat for confirmation:
Name: FastCMS Admin
✅ Admin user created successfully!
Email: admin@fastcms.dev
Name: FastCMS Admin
Role: admin
ID: 9ded1234-bed5-48a4-b0ce-310578dfab8f2. Create Your First Collection
fastcms create-collection \
--name products \
--type base \
--field title:text \
--field price:number \
--field active:bool3. Check System Information
fastcms info⚡ FastCMS System Information
✓ Database: Connected
• Users: 1
• Collections: 1
• Data directory: /path/to/fastCMS/data
• Database size: 0.15 MB
• Backups: 0User Management
Create Admin User
fastcms create-admin \
--email admin@example.com \
--name "John Administrator"
# Password will still be prompted for securityCreate Regular User
fastcms create-user \
--email user@example.com \
--name "Regular User" \
--role userList All Users
fastcms list-usersCollection Management
Create Collection
Field Format: --field field_name:field_type
Available field types: text, number, bool, email, url, date, select, relation, file, json, editor
Example: Blog Posts Collection
fastcms create-collection \
--name blog_posts \
--type base \
--field title:text \
--field content:editor \
--field published:bool \
--field publish_date:date \
--field author_email:emailExample: Auth Collection
Auth collections automatically include email, password, verified, role, and token_key fields.
fastcms create-collection \
--name customers \
--type auth \
--field company:text \
--field phone:textList All Collections
fastcms list-collectionsDelete Collection
fastcms delete-collection old_productsWarning: This is irreversible. Deletes the collection metadata, all records, and the database table.
Development Server
fastcms devStarts uvicorn with auto-reload enabled. On first run, it checks for admin users and prompts you to create one.
# Custom port and host
fastcms dev --port 8001 --host 127.0.0.1
# Disable auto-reload
fastcms dev --no-reload
# Skip the first-run admin check
fastcms dev --skip-checkProject Initialization
fastcms init my-project --database sqliteCreates a new project directory with .env, .gitignore, and README.md pre-configured.
| Option | Default | Description |
|---|---|---|
--database | sqlite | Database type (sqlite or postgres) |
--template | — | Project template (blog, ecommerce, saas) |
Database Migrations
The migrate command wraps Alembic for database schema management.
# Run all pending migrations
fastcms migrate up
# Rollback the last migration
fastcms migrate down
# Show current migration status
fastcms migrate status
# Create a new migration (after model changes)
fastcms migrate create "add_new_field"CI/CD Integration
.github/workflows/setup.yml:
name: Setup FastCMS
on:
push:
branches: [main]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install FastCMS
run: uv tool install pyfastcms
- name: Run migrations
run: fastcms migrate up
- name: Create admin user
run: |
fastcms create-admin \
--email ${{ secrets.ADMIN_EMAIL }} \
--name "CI Admin"Docker Entrypoint
#!/bin/bash
set -e
# Run migrations
fastcms migrate up
# Create admin if environment variables are set
if [ -n "$ADMIN_EMAIL" ] && [ -n "$ADMIN_PASSWORD" ]; then
fastcms create-admin \
--email "$ADMIN_EMAIL" \
--name "${ADMIN_NAME:-Admin}"
fi
# Start application
exec fastcms dev --no-reload --host 0.0.0.0 --port 8000Troubleshooting
| Problem | Solution |
|---|---|
command not found | Ensure pyfastcms is installed: uv tool install pyfastcms (or pip install pyfastcms inside a venv) |
| Database connection error | Run fastcms migrate up and check DATABASE_URL in .env |
| User already exists | Use fastcms list-users and pick a different email |
| Invalid field type | Use text not string, number not int, bool not boolean |
| SQLite lock error | Another process (e.g., Docker) is using the database file |