[{"data":1,"prerenderedAt":790},["ShallowReactive",2],{"$fHeG3582HnpUAaKgDnzgPM4xNJNTXiHnBZolsy1RQjeg":3},{"slug":4,"title":5,"description":6,"source":7,"document":8,"toc":771,"editUrl":783,"prev":784,"next":787},"overview\u002Fcli-usage","CLI usage","A complete tour of the fr CLI and the frt alias.","---\ntitle: CLI usage\ndescription: A complete tour of the fr CLI and the frt alias.\n---\n\n# CLI usage\n\nThe `fr` CLI is the primary way to create projects, generate artifacts, and operate an app. It is installed from crates.io as `fr-cli`, and also ships an `frt` alias.\n\n## Command overview\n\n| Command | Description |\n| --- | --- |\n| `fr new \u003Cname>` | Scaffold a new project |\n| `fr templates` | List templates |\n| `fr up` | Run the dev server with hot reload |\n| `fr build` | Build the project |\n| `fr run` | Run the project in the foreground |\n| `fr test [suite]` | Run tests |\n| `fr lint` | Clippy presets |\n| `fr fmt` | `cargo fmt` |\n| `fr forge \u003Cschematic> \u003Cname>` | Generate artifacts |\n| `fr add \u003Cpackage>` \u002F `fr remove \u003Cpackage>` | Manage ecosystem crates |\n| `fr db \u003Caction>` | Database lifecycle |\n| `fr openapi export` | Export an OpenAPI spec |\n| `fr doctor` | Environment & toolchain checks |\n| `fr info` | Project report |\n| `fr generate \u003Cwhat>` | Scaffold config\u002Fenv |\n| `fr docs` | Build or serve documentation |\n\n## Project lifecycle\n\n```bash\nfr new my-api                  # scaffold (api template by default)\ncd my-api\n\nfr up                          # dev server with cargo-watch\nfr build --release             # optimized build -> target\u002Frelease\u002F\nfr run                         # run in the foreground\nfr test                        # unit tests\nfr test --suite e2e --watch    # e2e suite, watching\nfr test --coverage             # cargo-llvm-cov\n```\n\n## Artifacts\n\n```bash\nfr forge module users\nfr forge controller users --module users\nfr forge service users --module users\nfr forge resource users           # full CRUD scaffold\nfr forge guard admin              # guard, middleware, interceptor, pipe, filter, provider...\n```\n\nOptions: `--module \u003Cname>` (default `app`), `--flat`, `--no-spec`, `--dry-run`.\n\n## Ecosystem management\n\n```bash\nfr add auth-jwt          # ferrite-auth-jwt pinned =0.1.0\nfr add orm-sqlx swagger\nfr remove throttler\n```\n\nThe 19 supported short names are listed in [Ecosystem crates](\u002Fdocs\u002Fecosystem\u002Fcrates).\n\n## Database\n\n```bash\nfr db migrate            # apply migrations (runs the app with FERRITE_DB_ACTION=migrate)\nfr db migrate-create add_users_table   # write up.sql \u002F down.sql stubs\nfr db revert\nfr db seed\nfr db status\n```\n\n> `fr db studio` currently prints an informational stub (no bundled DB GUI).\n\n## OpenAPI\n\n```bash\nfr openapi export\n```\n\n> The current CLI ships an informational stub that writes a static, empty `openapi.json`. The runtime `ferrite-swagger` in-app endpoint (`GET \u002Fopenapi.json`) generates the full spec — see [OpenAPI & Swagger](\u002Fdocs\u002Ffundamentals\u002Fopenapi-swagger).\n\n## Operational\n\n```bash\nfr doctor            # rustc\u002Fcargo\u002Fcargo-watch\u002Fmdbook + env checks\nfr info              # project name, version, edition, ferrite deps\nfr lint              # clippy --all-features -- -D warnings\nfr fmt               # cargo fmt\n```\n\n`fr doctor` also runs \"Ferrite ecosystem semver lockstep checks\" against your `Cargo.toml`, failing the exit code unless every ferrite dependency resolves to the same pinned release (set `FERRITE_DOCTOR_LENIENT=1` to soften).\n\n## Generate\n\n```bash\nfr generate config    # ferrite.toml with [app] and [server] sections\nfr generate env       # .env.example with APP_ENV, PORT, DATABASE_URL, JWT_SECRET\n```\n\nBoth are no-ops if the file already exists.\n\n## Documentation\n\n```bash\nfr docs build         # requires mdbook; builds docs\u002Fbook.toml\nfr docs serve --port 3001\n```\n\n## Next steps\n\n- [Ecosystem crates](\u002Fdocs\u002Fecosystem\u002Fcrates).\n- [CLI reference](\u002Fdocs\u002Fecosystem\u002Fcli-reference) — every flag in one place.",{"frontmatter":9,"meta":10,"nodes":46},{"title":5,"description":6},{"toc":11},{"title":12,"searchDepth":13,"depth":14,"links":15},"On This Page",2,3,[16,19,22,25,28,31,34,37,40,43],{"id":17,"depth":13,"text":18},"command-overview","Command overview",{"id":20,"depth":13,"text":21},"project-lifecycle","Project lifecycle",{"id":23,"depth":13,"text":24},"artifacts","Artifacts",{"id":26,"depth":13,"text":27},"ecosystem-management","Ecosystem management",{"id":29,"depth":13,"text":30},"database","Database",{"id":32,"depth":13,"text":33},"openapi","OpenAPI",{"id":35,"depth":13,"text":36},"operational","Operational",{"id":38,"depth":13,"text":39},"generate","Generate",{"id":41,"depth":13,"text":42},"documentation","Documentation",{"id":44,"depth":13,"text":45},"next-steps","Next steps",[47,51,74,77,263,265,376,378,455,477,479,518,525,527,586,593,595,609,628,630,674,687,689,718,721,723,754,756],[48,49,5],"h1",{"id":50},"cli-usage",[52,53,54,55,59,60,65,66,69,70,73],"p",{},"The ",[56,57,58],"code",{},"fr"," CLI is the primary way to create projects, generate artifacts, and operate an app. It is installed from ",[61,62,64],"a",{"href":63},"http:\u002F\u002Fcrates.io","crates.io"," as ",[56,67,68],{},"fr-cli",", and also ships an ",[56,71,72],{},"frt"," alias.",[75,76,18],"h2",{"id":17},[78,79,80,93],"table",{},[81,82,83],"thead",{},[84,85,86,90],"tr",{},[87,88,89],"th",{},"Command",[87,91,92],{},"Description",[94,95,96,107,117,127,137,147,157,167,179,189,203,213,223,233,243,253],"tbody",{},[84,97,98,104],{},[99,100,101],"td",{},[56,102,103],{},"fr new \u003Cname>",[99,105,106],{},"Scaffold a new project",[84,108,109,114],{},[99,110,111],{},[56,112,113],{},"fr templates",[99,115,116],{},"List templates",[84,118,119,124],{},[99,120,121],{},[56,122,123],{},"fr up",[99,125,126],{},"Run the dev server with hot reload",[84,128,129,134],{},[99,130,131],{},[56,132,133],{},"fr build",[99,135,136],{},"Build the project",[84,138,139,144],{},[99,140,141],{},[56,142,143],{},"fr run",[99,145,146],{},"Run the project in the foreground",[84,148,149,154],{},[99,150,151],{},[56,152,153],{},"fr test [suite]",[99,155,156],{},"Run tests",[84,158,159,164],{},[99,160,161],{},[56,162,163],{},"fr lint",[99,165,166],{},"Clippy presets",[84,168,169,174],{},[99,170,171],{},[56,172,173],{},"fr fmt",[99,175,176],{},[56,177,178],{},"cargo fmt",[84,180,181,186],{},[99,182,183],{},[56,184,185],{},"fr forge \u003Cschematic> \u003Cname>",[99,187,188],{},"Generate artifacts",[84,190,191,200],{},[99,192,193,196,197],{},[56,194,195],{},"fr add \u003Cpackage>"," \u002F ",[56,198,199],{},"fr remove \u003Cpackage>",[99,201,202],{},"Manage ecosystem crates",[84,204,205,210],{},[99,206,207],{},[56,208,209],{},"fr db \u003Caction>",[99,211,212],{},"Database lifecycle",[84,214,215,220],{},[99,216,217],{},[56,218,219],{},"fr openapi export",[99,221,222],{},"Export an OpenAPI spec",[84,224,225,230],{},[99,226,227],{},[56,228,229],{},"fr doctor",[99,231,232],{},"Environment & toolchain checks",[84,234,235,240],{},[99,236,237],{},[56,238,239],{},"fr info",[99,241,242],{},"Project report",[84,244,245,250],{},[99,246,247],{},[56,248,249],{},"fr generate \u003Cwhat>",[99,251,252],{},"Scaffold config\u002Fenv",[84,254,255,260],{},[99,256,257],{},[56,258,259],{},"fr docs",[99,261,262],{},"Build or serve documentation",[75,264,21],{"id":20},[266,267,270],"pre",{"language":268,"class":269},"bash","shiki shiki-themes github-light github-dark dark:github-dark",[56,271,273,292,293,292,301,292,303,292,313,292,326,292,336,292,346,292,364],{"class":272},"language-bash",[274,275,278,281,285,288],"span",{"class":276,"style":277},"line","display: inline",[274,279,58],{"style":280},"color:#6F42C1;--shiki-dark:#B392F0",[274,282,284],{"style":283},"color:#032F62;--shiki-dark:#9ECBFF"," new",[274,286,287],{"style":283}," my-api",[274,289,291],{"style":290},"color:#6A737D;--shiki-dark:#6A737D","                  # scaffold (api template by default)","\n",[274,294,295,299],{"class":276,"style":277},[274,296,298],{"style":297},"color:#005CC5;--shiki-dark:#79B8FF","cd",[274,300,287],{"style":283},[274,302],{"class":276,"style":277},[274,304,305,307,310],{"class":276,"style":277},[274,306,58],{"style":280},[274,308,309],{"style":283}," up",[274,311,312],{"style":290},"                          # dev server with cargo-watch",[274,314,315,317,320,323],{"class":276,"style":277},[274,316,58],{"style":280},[274,318,319],{"style":283}," build",[274,321,322],{"style":297}," --release",[274,324,325],{"style":290},"             # optimized build -> target\u002Frelease\u002F",[274,327,328,330,333],{"class":276,"style":277},[274,329,58],{"style":280},[274,331,332],{"style":283}," run",[274,334,335],{"style":290},"                         # run in the foreground",[274,337,338,340,343],{"class":276,"style":277},[274,339,58],{"style":280},[274,341,342],{"style":283}," test",[274,344,345],{"style":290},"                        # unit tests",[274,347,348,350,352,355,358,361],{"class":276,"style":277},[274,349,58],{"style":280},[274,351,342],{"style":283},[274,353,354],{"style":297}," --suite",[274,356,357],{"style":283}," e2e",[274,359,360],{"style":297}," --watch",[274,362,363],{"style":290},"    # e2e suite, watching",[274,365,366,368,370,373],{"class":276,"style":277},[274,367,58],{"style":280},[274,369,342],{"style":283},[274,371,372],{"style":297}," --coverage",[274,374,375],{"style":290},"             # cargo-llvm-cov",[75,377,24],{"id":23},[266,379,380],{"language":268,"class":269},[56,381,382,292,395,292,411,292,426,292,440],{"class":272},[274,383,384,386,389,392],{"class":276,"style":277},[274,385,58],{"style":280},[274,387,388],{"style":283}," forge",[274,390,391],{"style":283}," module",[274,393,394],{"style":283}," users",[274,396,397,399,401,404,406,409],{"class":276,"style":277},[274,398,58],{"style":280},[274,400,388],{"style":283},[274,402,403],{"style":283}," controller",[274,405,394],{"style":283},[274,407,408],{"style":297}," --module",[274,410,394],{"style":283},[274,412,413,415,417,420,422,424],{"class":276,"style":277},[274,414,58],{"style":280},[274,416,388],{"style":283},[274,418,419],{"style":283}," service",[274,421,394],{"style":283},[274,423,408],{"style":297},[274,425,394],{"style":283},[274,427,428,430,432,435,437],{"class":276,"style":277},[274,429,58],{"style":280},[274,431,388],{"style":283},[274,433,434],{"style":283}," resource",[274,436,394],{"style":283},[274,438,439],{"style":290},"           # full CRUD scaffold",[274,441,442,444,446,449,452],{"class":276,"style":277},[274,443,58],{"style":280},[274,445,388],{"style":283},[274,447,448],{"style":283}," guard",[274,450,451],{"style":283}," admin",[274,453,454],{"style":290},"              # guard, middleware, interceptor, pipe, filter, provider...",[52,456,457,458,461,462,465,466,469,470,469,473,476],{},"Options: ",[56,459,460],{},"--module \u003Cname>"," (default ",[56,463,464],{},"app","), ",[56,467,468],{},"--flat",", ",[56,471,472],{},"--no-spec",[56,474,475],{},"--dry-run",".",[75,478,27],{"id":26},[266,480,481],{"language":268,"class":269},[56,482,483,292,496,292,508],{"class":272},[274,484,485,487,490,493],{"class":276,"style":277},[274,486,58],{"style":280},[274,488,489],{"style":283}," add",[274,491,492],{"style":283}," auth-jwt",[274,494,495],{"style":290},"          # ferrite-auth-jwt pinned =0.1.0",[274,497,498,500,502,505],{"class":276,"style":277},[274,499,58],{"style":280},[274,501,489],{"style":283},[274,503,504],{"style":283}," orm-sqlx",[274,506,507],{"style":283}," swagger",[274,509,510,512,515],{"class":276,"style":277},[274,511,58],{"style":280},[274,513,514],{"style":283}," remove",[274,516,517],{"style":283}," throttler",[52,519,520,521,476],{},"The 19 supported short names are listed in ",[61,522,524],{"href":523},"\u002Fdocs\u002Fecosystem\u002Fcrates","Ecosystem crates",[75,526,30],{"id":29},[266,528,529],{"language":268,"class":269},[56,530,531,292,544,292,559,292,568,292,577],{"class":272},[274,532,533,535,538,541],{"class":276,"style":277},[274,534,58],{"style":280},[274,536,537],{"style":283}," db",[274,539,540],{"style":283}," migrate",[274,542,543],{"style":290},"            # apply migrations (runs the app with FERRITE_DB_ACTION=migrate)",[274,545,546,548,550,553,556],{"class":276,"style":277},[274,547,58],{"style":280},[274,549,537],{"style":283},[274,551,552],{"style":283}," migrate-create",[274,554,555],{"style":283}," add_users_table",[274,557,558],{"style":290},"   # write up.sql \u002F down.sql stubs",[274,560,561,563,565],{"class":276,"style":277},[274,562,58],{"style":280},[274,564,537],{"style":283},[274,566,567],{"style":283}," revert",[274,569,570,572,574],{"class":276,"style":277},[274,571,58],{"style":280},[274,573,537],{"style":283},[274,575,576],{"style":283}," seed",[274,578,579,581,583],{"class":276,"style":277},[274,580,58],{"style":280},[274,582,537],{"style":283},[274,584,585],{"style":283}," status",[587,588,589,592],"blockquote",{},[56,590,591],{},"fr db studio"," currently prints an informational stub (no bundled DB GUI).",[75,594,33],{"id":32},[266,596,597],{"language":268,"class":269},[56,598,599],{"class":272},[274,600,601,603,606],{"class":276,"style":277},[274,602,58],{"style":280},[274,604,605],{"style":283}," openapi",[274,607,608],{"style":283}," export",[587,610,611,612,615,616,619,620,623,624,476],{},"The current CLI ships an informational stub that writes a static, empty ",[56,613,614],{},"openapi.json",". The runtime ",[56,617,618],{},"ferrite-swagger"," in-app endpoint (",[56,621,622],{},"GET \u002Fopenapi.json",") generates the full spec — see ",[61,625,627],{"href":626},"\u002Fdocs\u002Ffundamentals\u002Fopenapi-swagger","OpenAPI & Swagger",[75,629,36],{"id":35},[266,631,632],{"language":268,"class":269},[56,633,634,292,644,292,654,292,664],{"class":272},[274,635,636,638,641],{"class":276,"style":277},[274,637,58],{"style":280},[274,639,640],{"style":283}," doctor",[274,642,643],{"style":290},"            # rustc\u002Fcargo\u002Fcargo-watch\u002Fmdbook + env checks",[274,645,646,648,651],{"class":276,"style":277},[274,647,58],{"style":280},[274,649,650],{"style":283}," info",[274,652,653],{"style":290},"              # project name, version, edition, ferrite deps",[274,655,656,658,661],{"class":276,"style":277},[274,657,58],{"style":280},[274,659,660],{"style":283}," lint",[274,662,663],{"style":290},"              # clippy --all-features -- -D warnings",[274,665,666,668,671],{"class":276,"style":277},[274,667,58],{"style":280},[274,669,670],{"style":283}," fmt",[274,672,673],{"style":290},"               # cargo fmt",[52,675,676,678,679,682,683,686],{},[56,677,229],{}," also runs \"Ferrite ecosystem semver lockstep checks\" against your ",[56,680,681],{},"Cargo.toml",", failing the exit code unless every ferrite dependency resolves to the same pinned release (set ",[56,684,685],{},"FERRITE_DOCTOR_LENIENT=1"," to soften).",[75,688,39],{"id":38},[266,690,691],{"language":268,"class":269},[56,692,693,292,706],{"class":272},[274,694,695,697,700,703],{"class":276,"style":277},[274,696,58],{"style":280},[274,698,699],{"style":283}," generate",[274,701,702],{"style":283}," config",[274,704,705],{"style":290},"    # ferrite.toml with [app] and [server] sections",[274,707,708,710,712,715],{"class":276,"style":277},[274,709,58],{"style":280},[274,711,699],{"style":283},[274,713,714],{"style":283}," env",[274,716,717],{"style":290},"       # .env.example with APP_ENV, PORT, DATABASE_URL, JWT_SECRET",[52,719,720],{},"Both are no-ops if the file already exists.",[75,722,42],{"id":41},[266,724,725],{"language":268,"class":269},[56,726,727,292,739],{"class":272},[274,728,729,731,734,736],{"class":276,"style":277},[274,730,58],{"style":280},[274,732,733],{"style":283}," docs",[274,735,319],{"style":283},[274,737,738],{"style":290},"         # requires mdbook; builds docs\u002Fbook.toml",[274,740,741,743,745,748,751],{"class":276,"style":277},[274,742,58],{"style":280},[274,744,733],{"style":283},[274,746,747],{"style":283}," serve",[274,749,750],{"style":297}," --port",[274,752,753],{"style":297}," 3001",[75,755,45],{"id":44},[757,758,759,764],"ul",{},[760,761,762,476],"li",{},[61,763,524],{"href":523},[760,765,766,770],{},[61,767,769],{"href":768},"\u002Fdocs\u002Fecosystem\u002Fcli-reference","CLI reference"," — every flag in one place.",{"title":12,"searchDepth":13,"depth":14,"links":772},[773,774,775,776,777,778,779,780,781,782],{"id":17,"depth":13,"text":18},{"id":20,"depth":13,"text":21},{"id":23,"depth":13,"text":24},{"id":26,"depth":13,"text":27},{"id":29,"depth":13,"text":30},{"id":32,"depth":13,"text":33},{"id":35,"depth":13,"text":36},{"id":38,"depth":13,"text":39},{"id":41,"depth":13,"text":42},{"id":44,"depth":13,"text":45},"https:\u002F\u002Fgithub.com\u002Fj4flmao\u002Fferrite_rs\u002Fedit\u002Fmain\u002Fdocs\u002Fcontent\u002Foverview\u002Fcli-usage.md",{"title":785,"slug":786},"Validation","overview\u002Fvalidation",{"title":788,"slug":789},"Dependency injection","fundamentals\u002Fdependency-injection",1789565440603]