[{"data":1,"prerenderedAt":794},["ShallowReactive",2],{"$fvWx1NVken76u8jwRMhGEti9a8OVIZeARem48MwyX-TA":3},{"slug":4,"title":5,"description":6,"source":7,"document":8,"toc":777,"editUrl":788,"prev":789,"next":792},"overview\u002Ffirst-steps","First steps","Install the fr CLI, scaffold your first project, and run it with hot reload.","---\ntitle: First steps\ndescription: Install the fr CLI, scaffold your first project, and run it with hot reload.\n---\n\n# First steps\n\nThis guide walks you through installing the Ferrite CLI, scaffolding a project, and running your first endpoint.\n\n## What you'll need\n\n- **Rust** toolchain (stable), with `cargo`\n- **Node.js** is *not* required — Ferrite is 100% Rust\n- For live reload: [`cargo-watch`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fcargo-watch) (optional, used by `fr up`)\n- For documentation perusals: `mdbook` (optional, used by `fr docs`)\n\nYou can verify the toolchain at any time with:\n\n```bash\nfr doctor\n```\n\n## 1. Install the CLI\n\nThe `fr` binary is published as `fr-cli`:\n\n```bash\ncargo install fr-cli\nfr --version\n```\n\n`fr` also exposes a `frt` alias if you prefer a shorter name on disk.\n\n## 2. Scaffold a project\n\n```bash\nfr new my-api\ncd my-api\n```\n\n`fr new` supports a few templates and options:\n\n```bash\nfr new my-api --template api        # default: single-crate REST service\nfr new my-svc --template microservice # gRPC + NATS playground\nfr new monorepo --template workspace  # apps\u002F + libs\u002F monorepo\nfr new my-api --pm sqlx              # add a database adapter + migrations\u002F\nfr new my-api --no-git               # skip `git init`\n```\n\nList all templates with:\n\n```bash\nfr templates\n```\n\n## 3. Project layout\n\nA default `api` project looks like this:\n\n```text\nmy-api\u002F\n├── Cargo.toml\n├── ferrite.toml\n├── .env.example\n├── src\u002F\n│   ├── main.rs                 # #[bootstrap] + Ferrite::create::\u003CAppModule>()\n│   ├── app_module.rs           # #[module] root\n│   ├── app_service.rs\n│   ├── modules\u002F\n│   │   └── health.rs           # GET \u002Fhealth\n│   └── users\u002F\n│       ├── mod.rs\n│       ├── models.rs\n│       ├── dto.rs\n│       ├── users_controller.rs\n│       └── users_service.rs\n└── tests\u002F\n    └── health_e2e.rs\n```\n\n## 4. Run it\n\nStart the dev server with hot reload:\n\n```bash\nfr up\n```\n\nThen hit the health endpoint:\n\n```bash\ncurl http:\u002F\u002Flocalhost:3000\u002Fhealth\n# {\"status\":\"ok\",\"env\":\"development\"}\n```\n\nUseful run variants:\n\n```bash\nfr up --port 8080          # change the port\nfr up --env production     # load .env.production\nfr up --no-reload          # plain `cargo run`, no file watching\nfr run                     # foreground run, no watching\n```\n\n## 5. Generate artifacts\n\nThe CLI can scaffold common building blocks without copying code from memory:\n\n```bash\nfr forge module users\nfr forge controller users --module users\nfr forge service users --module users\nfr forge resource users      # module + controller + service + dto + entity\n```\n\nSupported kinds: `module`, `controller`, `service`, `resource`, `dto`, `entity`, `guard`, `middleware`, `interceptor`, `pipe`, `filter`, `provider`.\n\n## 6. Manage the ecosystem\n\nAttach ecosystem crates in one command (versions are pinned to the matching framework release):\n\n```bash\nfr add auth-jwt\nfr add orm-sea\nfr add swagger validation\nfr remove throttler\n```\n\n## 7. Run tests and checks\n\n```bash\nfr test                 # cargo test (unit suite)\nfr test --suite e2e     # cargo test --test e2e\nfr test --watch         # cargo-watch based\nfr test --coverage      # cargo-llvm-cov based\nfr lint                 # clippy with -D warnings\nfr fmt                  # cargo fmt\n```\n\n## Next steps\n\nYour project is running. Now learn how the pieces fit together:\n\n- [Controllers](\u002Fdocs\u002Foverview\u002Fcontrollers) — define HTTP handlers.\n- [Providers](\u002Fdocs\u002Foverview\u002Fproviders) — services and `#[inject]`.\n- [Modules](\u002Fdocs\u002Foverview\u002Fmodules) — the root `AppModule`.\n- [CLI usage](\u002Fdocs\u002Foverview\u002Fcli-usage) — the full command surface.",{"frontmatter":9,"meta":10,"nodes":43},{"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],{"id":17,"depth":13,"text":18},"what-youll-need","What you'll need",{"id":20,"depth":13,"text":21},"_1-install-the-cli","1. Install the CLI",{"id":23,"depth":13,"text":24},"_2-scaffold-a-project","2. Scaffold a project",{"id":26,"depth":13,"text":27},"_3-project-layout","3. Project layout",{"id":29,"depth":13,"text":30},"_4-run-it","4. Run it",{"id":32,"depth":13,"text":33},"_5-generate-artifacts","5. Generate artifacts",{"id":35,"depth":13,"text":36},"_6-manage-the-ecosystem","6. Manage the ecosystem",{"id":38,"depth":13,"text":39},"_7-run-tests-and-checks","7. Run tests and checks",{"id":41,"depth":13,"text":42},"next-steps","Next steps",[44,48,52,55,105,108,129,131,141,164,173,175,196,202,289,292,303,305,312,408,410,413,424,427,444,447,503,505,508,570,611,613,616,661,663,736,738,741],[45,46,5],"h1",{"id":47},"first-steps",[49,50,51],"p",{},"This guide walks you through installing the Ferrite CLI, scaffolding a project, and running your first endpoint.",[53,54,18],"h2",{"id":17},[56,57,58,70,81,96],"ul",{},[59,60,61,65,66],"li",{},[62,63,64],"strong",{},"Rust"," toolchain (stable), with ",[67,68,69],"code",{},"cargo",[59,71,72,75,76,80],{},[62,73,74],{},"Node.js"," is ",[77,78,79],"em",{},"not"," required — Ferrite is 100% Rust",[59,82,83,84,91,92,95],{},"For live reload: ",[85,86,88],"a",{"href":87},"https:\u002F\u002Fcrates.io\u002Fcrates\u002Fcargo-watch",[67,89,90],{},"cargo-watch"," (optional, used by ",[67,93,94],{},"fr up",")",[59,97,98,99,91,102,95],{},"For documentation perusals: ",[67,100,101],{},"mdbook",[67,103,104],{},"fr docs",[49,106,107],{},"You can verify the toolchain at any time with:",[109,110,113],"pre",{"language":111,"class":112},"bash","shiki shiki-themes github-light github-dark dark:github-dark",[67,114,116],{"class":115},"language-bash",[117,118,121,125],"span",{"class":119,"style":120},"line","display: inline",[117,122,124],{"style":123},"color:#6F42C1;--shiki-dark:#B392F0","fr",[117,126,128],{"style":127},"color:#032F62;--shiki-dark:#9ECBFF"," doctor",[53,130,21],{"id":20},[49,132,133,134,136,137,140],{},"The ",[67,135,124],{}," binary is published as ",[67,138,139],{},"fr-cli",":",[109,142,143],{"language":111,"class":112},[67,144,145,155,156],{"class":115},[117,146,147,149,152],{"class":119,"style":120},[117,148,69],{"style":123},[117,150,151],{"style":127}," install",[117,153,154],{"style":127}," fr-cli","\n",[117,157,158,160],{"class":119,"style":120},[117,159,124],{"style":123},[117,161,163],{"style":162},"color:#005CC5;--shiki-dark:#79B8FF"," --version",[49,165,166,168,169,172],{},[67,167,124],{}," also exposes a ",[67,170,171],{},"frt"," alias if you prefer a shorter name on disk.",[53,174,24],{"id":23},[109,176,177],{"language":111,"class":112},[67,178,179,155,189],{"class":115},[117,180,181,183,186],{"class":119,"style":120},[117,182,124],{"style":123},[117,184,185],{"style":127}," new",[117,187,188],{"style":127}," my-api",[117,190,191,194],{"class":119,"style":120},[117,192,193],{"style":162},"cd",[117,195,188],{"style":127},[49,197,198,201],{},[67,199,200],{},"fr new"," supports a few templates and options:",[109,203,204],{"language":111,"class":112},[67,205,206,155,224,155,241,155,258,155,275],{"class":115},[117,207,208,210,212,214,217,220],{"class":119,"style":120},[117,209,124],{"style":123},[117,211,185],{"style":127},[117,213,188],{"style":127},[117,215,216],{"style":162}," --template",[117,218,219],{"style":127}," api",[117,221,223],{"style":222},"color:#6A737D;--shiki-dark:#6A737D","        # default: single-crate REST service",[117,225,226,228,230,233,235,238],{"class":119,"style":120},[117,227,124],{"style":123},[117,229,185],{"style":127},[117,231,232],{"style":127}," my-svc",[117,234,216],{"style":162},[117,236,237],{"style":127}," microservice",[117,239,240],{"style":222}," # gRPC + NATS playground",[117,242,243,245,247,250,252,255],{"class":119,"style":120},[117,244,124],{"style":123},[117,246,185],{"style":127},[117,248,249],{"style":127}," monorepo",[117,251,216],{"style":162},[117,253,254],{"style":127}," workspace",[117,256,257],{"style":222},"  # apps\u002F + libs\u002F monorepo",[117,259,260,262,264,266,269,272],{"class":119,"style":120},[117,261,124],{"style":123},[117,263,185],{"style":127},[117,265,188],{"style":127},[117,267,268],{"style":162}," --pm",[117,270,271],{"style":127}," sqlx",[117,273,274],{"style":222},"              # add a database adapter + migrations\u002F",[117,276,277,279,281,283,286],{"class":119,"style":120},[117,278,124],{"style":123},[117,280,185],{"style":127},[117,282,188],{"style":127},[117,284,285],{"style":162}," --no-git",[117,287,288],{"style":222},"               # skip `git init`",[49,290,291],{},"List all templates with:",[109,293,294],{"language":111,"class":112},[67,295,296],{"class":115},[117,297,298,300],{"class":119,"style":120},[117,299,124],{"style":123},[117,301,302],{"style":127}," templates",[53,304,27],{"id":26},[49,306,307,308,311],{},"A default ",[67,309,310],{},"api"," project looks like this:",[109,313,315],{"language":314,"class":112},"text",[67,316,318,155,323,155,328,155,333,155,338,155,343,155,348,155,353,155,358,155,363,155,368,155,373,155,378,155,383,155,388,155,393,155,398,155,403],{"class":317},"language-text",[117,319,320],{"class":119,"style":120},[117,321,322],{},"my-api\u002F",[117,324,325],{"class":119,"style":120},[117,326,327],{},"├── Cargo.toml",[117,329,330],{"class":119,"style":120},[117,331,332],{},"├── ferrite.toml",[117,334,335],{"class":119,"style":120},[117,336,337],{},"├── .env.example",[117,339,340],{"class":119,"style":120},[117,341,342],{},"├── src\u002F",[117,344,345],{"class":119,"style":120},[117,346,347],{},"│   ├── main.rs                 # #[bootstrap] + Ferrite::create::\u003CAppModule>()",[117,349,350],{"class":119,"style":120},[117,351,352],{},"│   ├── app_module.rs           # #[module] root",[117,354,355],{"class":119,"style":120},[117,356,357],{},"│   ├── app_service.rs",[117,359,360],{"class":119,"style":120},[117,361,362],{},"│   ├── modules\u002F",[117,364,365],{"class":119,"style":120},[117,366,367],{},"│   │   └── health.rs           # GET \u002Fhealth",[117,369,370],{"class":119,"style":120},[117,371,372],{},"│   └── users\u002F",[117,374,375],{"class":119,"style":120},[117,376,377],{},"│       ├── mod.rs",[117,379,380],{"class":119,"style":120},[117,381,382],{},"│       ├── models.rs",[117,384,385],{"class":119,"style":120},[117,386,387],{},"│       ├── dto.rs",[117,389,390],{"class":119,"style":120},[117,391,392],{},"│       ├── users_controller.rs",[117,394,395],{"class":119,"style":120},[117,396,397],{},"│       └── users_service.rs",[117,399,400],{"class":119,"style":120},[117,401,402],{},"└── tests\u002F",[117,404,405],{"class":119,"style":120},[117,406,407],{},"    └── health_e2e.rs",[53,409,30],{"id":29},[49,411,412],{},"Start the dev server with hot reload:",[109,414,415],{"language":111,"class":112},[67,416,417],{"class":115},[117,418,419,421],{"class":119,"style":120},[117,420,124],{"style":123},[117,422,423],{"style":127}," up",[49,425,426],{},"Then hit the health endpoint:",[109,428,429],{"language":111,"class":112},[67,430,431,155,439],{"class":115},[117,432,433,436],{"class":119,"style":120},[117,434,435],{"style":123},"curl",[117,437,438],{"style":127}," http:\u002F\u002Flocalhost:3000\u002Fhealth",[117,440,441],{"class":119,"style":120},[117,442,443],{"style":222},"# {\"status\":\"ok\",\"env\":\"development\"}",[49,445,446],{},"Useful run variants:",[109,448,449],{"language":111,"class":112},[67,450,451,155,466,155,481,155,493],{"class":115},[117,452,453,455,457,460,463],{"class":119,"style":120},[117,454,124],{"style":123},[117,456,423],{"style":127},[117,458,459],{"style":162}," --port",[117,461,462],{"style":162}," 8080",[117,464,465],{"style":222},"          # change the port",[117,467,468,470,472,475,478],{"class":119,"style":120},[117,469,124],{"style":123},[117,471,423],{"style":127},[117,473,474],{"style":162}," --env",[117,476,477],{"style":127}," production",[117,479,480],{"style":222},"     # load .env.production",[117,482,483,485,487,490],{"class":119,"style":120},[117,484,124],{"style":123},[117,486,423],{"style":127},[117,488,489],{"style":162}," --no-reload",[117,491,492],{"style":222},"          # plain `cargo run`, no file watching",[117,494,495,497,500],{"class":119,"style":120},[117,496,124],{"style":123},[117,498,499],{"style":127}," run",[117,501,502],{"style":222},"                     # foreground run, no watching",[53,504,33],{"id":32},[49,506,507],{},"The CLI can scaffold common building blocks without copying code from memory:",[109,509,510],{"language":111,"class":112},[67,511,512,155,525,155,541,155,556],{"class":115},[117,513,514,516,519,522],{"class":119,"style":120},[117,515,124],{"style":123},[117,517,518],{"style":127}," forge",[117,520,521],{"style":127}," module",[117,523,524],{"style":127}," users",[117,526,527,529,531,534,536,539],{"class":119,"style":120},[117,528,124],{"style":123},[117,530,518],{"style":127},[117,532,533],{"style":127}," controller",[117,535,524],{"style":127},[117,537,538],{"style":162}," --module",[117,540,524],{"style":127},[117,542,543,545,547,550,552,554],{"class":119,"style":120},[117,544,124],{"style":123},[117,546,518],{"style":127},[117,548,549],{"style":127}," service",[117,551,524],{"style":127},[117,553,538],{"style":162},[117,555,524],{"style":127},[117,557,558,560,562,565,567],{"class":119,"style":120},[117,559,124],{"style":123},[117,561,518],{"style":127},[117,563,564],{"style":127}," resource",[117,566,524],{"style":127},[117,568,569],{"style":222},"      # module + controller + service + dto + entity",[49,571,572,573,576,577,576,580,576,583,576,586,576,589,576,592,576,595,576,598,576,601,576,604,576,607,610],{},"Supported kinds: ",[67,574,575],{},"module",", ",[67,578,579],{},"controller",[67,581,582],{},"service",[67,584,585],{},"resource",[67,587,588],{},"dto",[67,590,591],{},"entity",[67,593,594],{},"guard",[67,596,597],{},"middleware",[67,599,600],{},"interceptor",[67,602,603],{},"pipe",[67,605,606],{},"filter",[67,608,609],{},"provider",".",[53,612,36],{"id":35},[49,614,615],{},"Attach ecosystem crates in one command (versions are pinned to the matching framework release):",[109,617,618],{"language":111,"class":112},[67,619,620,155,630,155,639,155,651],{"class":115},[117,621,622,624,627],{"class":119,"style":120},[117,623,124],{"style":123},[117,625,626],{"style":127}," add",[117,628,629],{"style":127}," auth-jwt",[117,631,632,634,636],{"class":119,"style":120},[117,633,124],{"style":123},[117,635,626],{"style":127},[117,637,638],{"style":127}," orm-sea",[117,640,641,643,645,648],{"class":119,"style":120},[117,642,124],{"style":123},[117,644,626],{"style":127},[117,646,647],{"style":127}," swagger",[117,649,650],{"style":127}," validation",[117,652,653,655,658],{"class":119,"style":120},[117,654,124],{"style":123},[117,656,657],{"style":127}," remove",[117,659,660],{"style":127}," throttler",[53,662,39],{"id":38},[109,664,665],{"language":111,"class":112},[67,666,667,155,677,155,692,155,704,155,716,155,726],{"class":115},[117,668,669,671,674],{"class":119,"style":120},[117,670,124],{"style":123},[117,672,673],{"style":127}," test",[117,675,676],{"style":222},"                 # cargo test (unit suite)",[117,678,679,681,683,686,689],{"class":119,"style":120},[117,680,124],{"style":123},[117,682,673],{"style":127},[117,684,685],{"style":162}," --suite",[117,687,688],{"style":127}," e2e",[117,690,691],{"style":222},"     # cargo test --test e2e",[117,693,694,696,698,701],{"class":119,"style":120},[117,695,124],{"style":123},[117,697,673],{"style":127},[117,699,700],{"style":162}," --watch",[117,702,703],{"style":222},"         # cargo-watch based",[117,705,706,708,710,713],{"class":119,"style":120},[117,707,124],{"style":123},[117,709,673],{"style":127},[117,711,712],{"style":162}," --coverage",[117,714,715],{"style":222},"      # cargo-llvm-cov based",[117,717,718,720,723],{"class":119,"style":120},[117,719,124],{"style":123},[117,721,722],{"style":127}," lint",[117,724,725],{"style":222},"                 # clippy with -D warnings",[117,727,728,730,733],{"class":119,"style":120},[117,729,124],{"style":123},[117,731,732],{"style":127}," fmt",[117,734,735],{"style":222},"                  # cargo fmt",[53,737,42],{"id":41},[49,739,740],{},"Your project is running. Now learn how the pieces fit together:",[56,742,743,750,760,770],{},[59,744,745,749],{},[85,746,748],{"href":747},"\u002Fdocs\u002Foverview\u002Fcontrollers","Controllers"," — define HTTP handlers.",[59,751,752,756,757,610],{},[85,753,755],{"href":754},"\u002Fdocs\u002Foverview\u002Fproviders","Providers"," — services and ",[67,758,759],{},"#[inject]",[59,761,762,766,767,610],{},[85,763,765],{"href":764},"\u002Fdocs\u002Foverview\u002Fmodules","Modules"," — the root ",[67,768,769],{},"AppModule",[59,771,772,776],{},[85,773,775],{"href":774},"\u002Fdocs\u002Foverview\u002Fcli-usage","CLI usage"," — the full command surface.",{"title":12,"searchDepth":13,"depth":14,"links":778},[779,780,781,782,783,784,785,786,787],{"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},"https:\u002F\u002Fgithub.com\u002Fj4flmao\u002Fferrite_rs\u002Fedit\u002Fmain\u002Fdocs\u002Fcontent\u002Foverview\u002Ffirst-steps.md",{"title":790,"slug":791},"Introduction","overview\u002Fintroduction",{"title":748,"slug":793},"overview\u002Fcontrollers",1789565439198]