CLI reference

The fr CLI is a thin, friendly wrapper over cargo plus Ferrite conveniences. Its exit code mirrors cargo's — 0 success, 1 failure, 101 panic — so piping into CI is predictable.

Global flags

-d, --debug      verbose output
    --quiet      only errors
-V, --version    print version
-h, --help       print help

Commands

build

fr build [-d] [--release]

Thin wrapper over cargo build (keeps your toolchain). --release maps to cargo build --release.

run

fr run
fr run -- --args-for-the-app

cargo run, with -d lifted to --verbose.

gen

fr gen

Prints what the build would generate — a preview of the entity (Repository<E>), route, and OpenAPI artifacts from the compile-time inventory.

new

fr new <app_name> [--path=<path>]

Scaffold a new Ferrite application in ./<app_name>.

add

fr add <ecosystem-crate>

Import a first-party ecosystem crate into Cargo.toml and the corresponding main.rs snippet (module import + required env vars). Current catalog:

Short nameCrateModule / entries
auth-jwtferrite-auth-jwtAuthModule (requires JWT_SECRET)
auth-oauthferrite-auth-oauthOAuthModule (env per provider)
cache-redisferrite-cache-redisCacheModule
cqrsferrite-cqrsCqrsModule
ferrite-logferrite-loglogging entry
graphqlferrite-graphqlGraphQLModule
grpcferrite-grpcGrpcModuleImpl
healthferrite-healthHealthModule
i18nferrite-i18nI18nModuleImpl, lints for LOCALE_DIR
kafkaferrite-kafkaKafkaModuleImpl
natsferrite-natsNatsModuleImpl
ormferrite-ormORM entry (in-memory store)
orm-sqlxferrite-orm-sqlxprovider registration only (stub)
orm-dieselferrite-orm-dieselprovider registration only (stub)
rate-limitferrite-throttlerThrottlerModule
queueferrite-queueQueueModuleImpl
schedulerferrite-schedulerCronModuleImpl
swaggerferrite-swaggerSwaggerModule, lints for SWAGGER_* envs
wsferrite-wsWebSocket entries

test

fr test [--coverage] [--release] [-d]

Wrapper over cargo test. --coverage passes extra lint/test gates (and can report test counts).

bib

Generate a bib (third-party attribution / license notice) file from the workspace:

fr bib > THIRD_PARTY.md

doctor

fr doctor [--verbose]

Validate environment conventions and surface "expected set but missing" env vars across imported modules:

CheckBehavior
JWT_SECRET missing & auth modules presentwarning + hint
DATABASE_URL missing & ORM sea presentwarning + hint
Unknown/misspelled fr add crateerror listing the catalog
SWAGGER_*, LOCALE_DIR, NATS_URL, KAFKA_BROKERS cross-checkedhint

openapi

fr openapi export -o <output.json>
Note: currently writes a static placeholder file. For a real spec use GET /openapi.json from ferrite-swagger at runtime, or call build_openapi() in a test.

db

Run the SeaORM migration harness:

fr db migrate-create <name>      # new migration up/down pair
fr db migrate                    # apply pending
fr db revert                     # roll back last applied
fr db seed                       # run seeds/*.sql
fr db status                     # applied vs pending report

Uses your app binary via FERRITE_DB_ACTION; requires ferrite-orm-sea wired into the app.

doctor output shape

Exit 0 with warnings/errors printed. Exit 1 if the environment is unusable.

compgen / completions

Built-in clap shell completions are available via the -h help paths (bash/zsh/fish/powershell) for power users.

Next steps