CLI Commands Overview
FastCLI is a powerful code generator built into Fastpy. It automates the creation of models, controllers, routes, services, and more.
30+Commands
20+Field Types
AIPowered
Getting Started
bash
# Using fastpy globally
fastpy list
fastpy make:model --helpbash
# Using local cli.py
python cli.py list
python cli.py make:model --helpGlobal CLI
Install with pip install fastpy-cli to use fastpy from anywhere.
Command Categories
Global Commands
These commands work anywhere (not just inside a Fastpy project):
| Command | Description |
|---|---|
new | Create project with full setup (venv, deps, config) |
new --no-install | Create project only (skip automatic setup) |
install | Install deps and run setup wizard |
shell:install | Add shell integration for auto-cd/activate |
ai | AI-powered code generation from natural language |
config | Manage CLI configuration |
init | Initialize Fastpy configuration |
doctor | Diagnose environment issues |
version | Show CLI version |
upgrade | Upgrade CLI to latest version |
docs | Open documentation in browser |
libs | List available facades |
Setup Commands
| Command | Description |
|---|---|
install | Create venv, install deps, run setup wizard |
setup | Full interactive project setup |
setup:env | Initialize .env from .env.example |
setup:db | Configure database connection |
setup:secret | Generate secure JWT secret key |
setup:hooks | Install pre-commit hooks |
make:admin | Create super admin user |
Server Commands
| Command | Description |
|---|---|
serve | Start development server with auto-reload |
route:list | List all registered routes |
Database Commands
| Command | Description |
|---|---|
db:migrate | Run pending migrations |
db:migrate -m "..." | Generate + run migrations |
db:make | Generate migration only |
db:rollback | Rollback migrations |
db:fresh | Drop all tables and re-migrate |
db:seed | Run database seeders |
Make Commands
| Command | Description |
|---|---|
make:model | Generate a model |
make:controller | Generate a controller |
make:route | Generate route definitions |
make:resource | Generate model + controller + route |
make:service | Generate a service class |
make:repository | Generate a repository class |
make:middleware | Generate middleware |
make:seeder | Generate a database seeder |
make:factory | Generate a test factory |
make:test | Generate a test file |
make:enum | Generate an enum |
make:exception | Generate a custom exception |
AI Commands
| Command | Description |
|---|---|
ai | Generate resources using natural language |
ai:config | Configure AI provider (anthropic, openai, ollama) |
init:ai | Generate AI assistant config (Claude, Copilot, Cursor) |
Update Commands
| Command | Description |
|---|---|
update | Update Fastpy framework files |
Quick Examples
Generate a Complete Resource
bash
fastpy make:resource Post \
-f title:string:required,max:200 \
-f body:text:required \
-m -pOptions:
-f- Define fields (name:type:rules)-m- Generate migration-p- Make routes protected (require auth)-i- Interactive mode
Generate Individual Components
bash
# Just the model
fastpy make:model Post -f title:string:required
# Just the controller
fastpy make:controller Post
# Just the routes
fastpy make:route Post --protectedDatabase Operations
bash
# Create migration
fastpy db:migrate -m "Add posts table"
# Rollback last migration
fastpy db:rollback
# Rollback multiple
fastpy db:rollback --steps 3
# Fresh start
fastpy db:freshField Definition Syntax
Fields are defined as name:type:rules:
bash
-f title:string:required,max:200
-f email:email:required,unique
-f age:integer:min:0,max:150
-f user_id:integer:foreign:users.idSee Field Types for complete documentation.