Skip to main content

Project Commands

Commands for creating, initializing, serving, and building FastAPI projects.

create​

Creates a brand-new FastAPI project with a complete directory structure, configuration files, database setup, migration tooling, and dependency management — all ready to run.

fastman create <project-name> [options]

Options​

OptionDescriptionDefault
--patternArchitecture pattern: feature, api, or layerfeature
--databaseDatabase engine: sqlite, postgresql, mysql, oracle, firebasesqlite
--packagePackage manager: uv, poetry, pipenv, pipauto-detected
--minimalSkip optional dev dependencies (faker, pytest, httpx)—
--graphqlInclude GraphQL support with Strawberry (app/core/graphql.py)—

Examples​

# Simple project with defaults (feature pattern, SQLite, auto package manager)
fastman create my-api

# Production-ready with PostgreSQL and feature architecture
fastman create my-api --pattern=feature --database=postgresql

# Quick prototype with API versioning pattern
fastman create prototype --pattern=api --database=sqlite

# Firebase project (no SQL, no Alembic migrations)
fastman create mobile-backend --database=firebase

# Minimal project — smaller dependency footprint
fastman create tiny-api --minimal

# Include GraphQL support alongside REST
fastman create gql-api --graphql

What Gets Created​

my-api/
├── app/
│ ├── core/
│ │ ├── config.py # Pydantic settings
│ │ ├── database.py # SQLAlchemy setup
│ │ └── dependencies.py # Common dependencies
│ ├── features/ # Your feature modules
│ └── main.py # App entry point
├── database/
│ ├── migrations/ # Alembic migrations
│ └── seeders/ # Database seeders
├── tests/ # Test directory
├── .env # Default / local override (gitignored)
├── .env.develop # Development settings
├── .env.staging # Staging settings
├── .fastmanrc # Project shape + env lock (gitignored)
├── .gitignore
├── alembic.ini # Migration config
├── pyproject.toml # Dependencies
└── README.md
note

No .env.production is generated. Production secrets should come from a secrets manager (AWS SSM, Vault, k8s, etc.) rather than a committed placeholder file. See the deployment guide.


serve​

Starts the FastAPI development server using Uvicorn with hot-reload enabled by default. The server watches for file changes and automatically restarts.

fastman serve [options]

Serve Options​

OptionDescriptionDefault
--hostNetwork interface to bind to127.0.0.1
--portPort number to listen on8000
--envEnvironment file to use (loads .env.<name>)auto-detect
--reloadExplicitly enable hot reload (this is the default behavior)true
--no-reloadDisable hot reload (for production-like testing)—

When --env is not specified, Fastman auto-detects: .env.develop if it exists, otherwise .env.

Serve Examples​

# Default — localhost:8000 with hot reload, auto-detects .env.develop or .env
fastman serve

# Use develop environment
fastman serve --env=develop

# Use staging environment
fastman serve --env=staging

# Custom port
fastman serve --port=3000

# Bind to all interfaces (accessible from other machines on the network)
fastman serve --host=0.0.0.0

# Production-like mode without reload
fastman serve --host=0.0.0.0 --no-reload
tip

Under the hood, Fastman runs python -m uvicorn app.main:app with the appropriate flags. This ensures it always works inside virtual environments, even when uvicorn isn't on your system PATH.


init​

Initializes Fastman configuration in an existing FastAPI project. Use this when you have a project that wasn't created with fastman create but you want to use Fastman's commands.

fastman init

Creates the necessary directory structure (app/core/, app/features/, app/console/commands/) if they don't already exist.


build​

Prepares your project for production deployment. Can run tests, type checking, and optionally build a Docker image.

fastman build [--docker]

Build Options​

OptionDescription
--dockerBuild a Docker image using the project's Dockerfile

Build Examples​

# Standard build — runs pytest and mypy
fastman build

# Build and create a Docker image
fastman build --docker