Skip to main content

Utility Commands

Commands for development workflow, configuration management, package management, and general CLI helpers.

Development Tools​

tinker​

Starts an interactive Python shell (REPL) with your application context pre-loaded. This is invaluable for debugging, quick data exploration, and testing queries without writing a script.

fastman tinker

When you enter tinker, the following are automatically available:

  • db — an active SQLAlchemy database session
  • settings — your app/core/config.py settings object
  • Base — the SQLAlchemy declarative base

If IPython is installed, tinker uses it automatically for syntax highlighting, tab completion, and magic commands. Otherwise, it falls back to Python's built-in REPL.

# Install IPython for the best tinker experience
pip install ipython

See the full Tinker guide for tips and tricks.

route:list​

Displays a formatted table of all registered API routes in your application. Useful for verifying endpoint registration and debugging routing issues.

fastman route:list [--path=/api] [--method=GET]
OptionDescription
--pathFilter routes that contain this path segment (e.g., /api/v1)
--methodFilter by HTTP method: GET, POST, PUT, PATCH, DELETE
# Show all routes
fastman route:list

# Only GET endpoints
fastman route:list --method=GET

# Only routes under /users
fastman route:list --path=/users

inspect​

Inspects a component of your application and displays its structure.

fastman inspect {type} {name}
ArgumentDescription
typeWhat to inspect: model, feature, or api
nameThe name of the component to inspect
# Inspect a model's columns and types
fastman inspect model user

# Inspect a feature module's files
fastman inspect feature product

optimize​

Formats your codebase using black, sorts imports with isort, and removes unused imports with autoflake. If any of these tools are missing, Fastman will offer to install them.

fastman optimize [--check]
OptionDescription
--checkOnly check for issues without modifying files (useful in CI pipelines)

Authentication​

install:auth​

Scaffolds a complete authentication system into your project. Creates models, schemas, security utilities, service layer, dependencies, and router endpoints.

fastman install:auth [--type=jwt|oauth|keycloak] [--provider=<provider>]
OptionDescriptionDefault
--typeAuthentication strategy: jwt, oauth, or keycloakjwt
--providerOAuth provider identifier (only used with --type=oauth)—
# JWT authentication (default) — creates /register, /login, /me endpoints
fastman install:auth

# Explicit JWT
fastman install:auth --type=jwt

# Keycloak enterprise SSO
fastman install:auth --type=keycloak

# OAuth with Google
fastman install:auth --type=oauth --provider=google
OAuth note

The OAuth scaffolding installs authlib and httpx as dependencies but requires manual configuration for your specific OAuth provider (client ID, client secret, callback URL). See the Authentication concepts page for details.


Configuration​

generate:key​

Generates a cryptographically secure SECRET_KEY using secrets.token_urlsafe() and writes it to all environment files (.env, .env.development, .env.staging, .env.production).

fastman generate:key [--show]
OptionDescription
--showPrint the generated key to the terminal without writing to files

config:cache​

Caches your environment configuration to config_cache.json for faster startup in production. Reads from the environment-specific file based on the ENVIRONMENT variable (defaults to .env.development, falls back to .env).

fastman config:cache

# Cache staging config
ENVIRONMENT=staging fastman config:cache

config:clear​

Removes the cached configuration file so the application reads from .env again.

fastman config:clear

cache:clear​

Recursively removes all __pycache__ directories and .pyc files from your project. Handles permission errors gracefully.

fastman cache:clear

Package Management​

Fastman automatically detects your package manager (uv, poetry, pipenv, or pip) and uses it for all package operations.

package:import​

Installs a Python package using your detected package manager.

fastman package:import {package_name}
fastman package:import requests
fastman package:import "sqlalchemy>=2.0"

package:list​

Lists all installed packages in the current environment.

fastman package:list

package:remove​

Uninstalls a Python package.

fastman package:remove {package_name}

CLI Helpers​

list​

Shows all available Fastman commands grouped by category.

fastman list

version​

Displays the installed Fastman version, Python version, and detected package manager.

fastman version

docs​

Prints quick-reference documentation links, or opens the documentation site in your default browser.

fastman docs [--open]
OptionDescription
--openOpen the documentation website in your browser

completion​

Generates shell completion scripts for tab-completing Fastman commands and options.

fastman completion <shell> [--install]
Argument/OptionDescription
shellTarget shell: bash, zsh, fish, or powershell
--installInstall the completion script to the appropriate shell config file
# Print the bash completion script
fastman completion bash

# Install fish completions directly
fastman completion fish --install

activate​

Prints the activation command for the virtual environment in the current directory. Useful if you forget the platform-specific syntax.

fastman activate [--create-script]
OptionDescription
--create-scriptCreate a helper script (activate.sh or activate.bat) in the project directory
$ fastman activate
# Linux/macOS: source .venv/bin/activate
# Windows: .\.venv\Scripts\activate

### `inspect`

Inspects a component of your application.

```bash
fastman inspect {type} {name}
  • Types: model, feature, api.

optimize​

Optimizes the codebase by formatting and sorting imports. Will prompt to install missing tools.

fastman optimize [--check]
  • Uses black, isort, and autoflake. Options:

  • --check: Only check for issues without modifying files.

Configuration​

generate:key​

Generates a new SECRET_KEY and updates .env.

fastman generate:key [--show]

config:cache​

Caches environment variables to config_cache.json for faster loading in production.

fastman config:cache

config:clear​

Clears the configuration cache.

fastman config:clear

cache:clear​

Clears Python __pycache__ directories and .pyc files. Handles permission errors gracefully.

fastman cache:clear

Package Management​

package:import​

Installs a Python package using the detected package manager (uv, poetry, pipenv, or pip).

fastman package:import {package_name}

package:list​

Lists installed packages.

fastman package:list

package:remove​

Removes a Python package.

fastman package:remove {package_name}

CLI Helpers​

list​

Lists all available Fastman commands.

fastman list

version​

Shows the installed Fastman version and environment info.

fastman version

docs​

Prints quick documentation links, or opens the docs site.

fastman docs [--open]

completion​

Generates shell completion scripts.

fastman completion <shell> [--install]
  • Shells: bash, zsh, fish, powershell

activate​

Shows the activation command for an existing virtual environment in the current directory.

fastman activate [--create-script]