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 helpCommands
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-appcargo run, with -d lifted to --verbose.
gen
fr genPrints 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 name | Crate | Module / entries |
|---|---|---|
auth-jwt | ferrite-auth-jwt | AuthModule (requires JWT_SECRET) |
auth-oauth | ferrite-auth-oauth | OAuthModule (env per provider) |
cache-redis | ferrite-cache-redis | CacheModule |
cqrs | ferrite-cqrs | CqrsModule |
ferrite-log | ferrite-log | logging entry |
graphql | ferrite-graphql | GraphQLModule |
grpc | ferrite-grpc | GrpcModuleImpl |
health | ferrite-health | HealthModule |
i18n | ferrite-i18n | I18nModuleImpl, lints for LOCALE_DIR |
kafka | ferrite-kafka | KafkaModuleImpl |
nats | ferrite-nats | NatsModuleImpl |
orm | ferrite-orm | ORM entry (in-memory store) |
orm-sqlx | ferrite-orm-sqlx | provider registration only (stub) |
orm-diesel | ferrite-orm-diesel | provider registration only (stub) |
rate-limit | ferrite-throttler | ThrottlerModule |
queue | ferrite-queue | QueueModuleImpl |
scheduler | ferrite-scheduler | CronModuleImpl |
swagger | ferrite-swagger | SwaggerModule, lints for SWAGGER_* envs |
ws | ferrite-ws | WebSocket 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.mddoctor
fr doctor [--verbose]Validate environment conventions and surface "expected set but missing" env vars across imported modules:
| Check | Behavior |
|---|---|
JWT_SECRET missing & auth modules present | warning + hint |
DATABASE_URL missing & ORM sea present | warning + hint |
Unknown/misspelled fr add crate | error listing the catalog |
SWAGGER_*, LOCALE_DIR, NATS_URL, KAFKA_BROKERS cross-checked | hint |
openapi
fr openapi export -o <output.json>Note: currently writes a static placeholder file. For a real spec useGET /openapi.jsonfromferrite-swaggerat runtime, or callbuild_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 reportUses 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.