[{"data":1,"prerenderedAt":928},["ShallowReactive",2],{"$fyAlYUZL2E52ZiTH5_WIVC0C5sA_mA1PINkLMsf9x6Q8":3},{"slug":4,"title":5,"description":6,"source":7,"document":8,"toc":917,"editUrl":924,"prev":925,"next":926},"overview\u002Fintroduction","Introduction","Learn what Ferrite is, the problems it solves, and the core ideas behind the framework.","---\ntitle: Introduction\ndescription: Learn what Ferrite is, the problems it solves, and the core ideas behind the framework.\n---\n\n# Introduction\n\nFerrite is a batteries-included backend framework for Rust. It borrows the most productive ideas from Node's NestJS ecosystem and brings them to Rust with a twist: because Rust has no runtime reflection, Ferrite resolves your whole dependency graph at **compile time**. If a provider is missing or a cycle exists, you get a compiler error — not a runtime panic.\n\nAt its core Ferrite offers **modules**, **providers**, **controllers**, and **cross-cutting concerns** (guards, interceptors, middleware, and pipes), all expressed with a small set of attribute macros on top of **Axum**, **Tokio**, and **Tower**.\n\n## How Ferrite is different\n\n```text\nNestJS (TypeScript):         Ferrite (Rust):\n- runtime DI container       - compile-time dependency graph\n- decorators + reflection    - attribute macros + inventory registry\n- request\u002Fresponse pipeline  - explicit Middleware\u002FGuard\u002FInterceptor\u002FPipe pipeline\n- one process, one server    - single static binary, tiny footprint\n```\n\nThe *shape* of an application is nearly identical, which makes Ferrite instantly familiar to anyone coming from NestJS — but the guarantees are stronger and the runtime cost is lower.\n\n## A minimal application\n\n```rust\nuse ferrite_framework::{bootstrap, controller, impl_controller, injectable, module, Ferrite};\n\n#[injectable]\npub struct AppService;\n\nimpl AppService {\n    #[inject]\n    pub fn new() -> Self {\n        Self\n    }\n\n    pub fn hello(&self) -> String {\n        \"Ferrite is running\".to_string()\n    }\n}\n\n#[controller(\"\u002Fhealth\")]\npub struct HealthController {\n    service: AppService,\n}\n\n#[impl_controller]\nimpl HealthController {\n    #[inject]\n    pub fn new(service: AppService) -> Self {\n        Self { service }\n    }\n\n    #[get(\"\u002F\")]\n    pub async fn health(&self) -> String {\n        self.service.hello()\n    }\n}\n\n#[module(controllers = [HealthController], providers = [AppService])]\npub struct AppModule;\n\n#[bootstrap]\nasync fn main() {\n    let app = Ferrite::create::\u003CAppModule>().await;\n    app.listen(\"0.0.0.0:3000\").await.expect(\"failed to bind 0.0.0.0:3000\");\n}\n```\n\n## Design principles\n\n**1. Everything is a provider.** Services, controllers, repositories, and infrastructure singletons are all registered with the DI container and resolved by type. There is no shared `app` object to reach into.\n\n**2. The graph is known at compile time.** The `#[module]`, `#[injectable]`, and `#[inject]` macros emit registration metadata at compile time via the [`inventory`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Finventory) and `linkme` registries, which the bootstrap step assembles into the running `Container`.\n\n**3. The pipeline is explicit and ordered.** Requests flow through `Middleware → Guards → Interceptors(before) → Pipes → Handler → Interceptors(after)`, with exception filters catching errors along the way. You control exactly which stages a route participates in.\n\n**4. Single static binary.** No runtime, no VM, no dynamic loading. `fr build --release` produces a self-contained executable you can drop on any server.\n\n**5. One CLI for everything.** The `fr` binary scaffolds projects, generates artifacts, manages ecosystem crates, runs a hot-reloading dev server, drives database migrations, and exports OpenAPI specs.\n\n## What ships with the framework\n\n| Area | Crate | Status |\n| --- | --- | --- |\n| Kernel & DI | `fr-core` \u002F `ferrite-framework` | Stable |\n| HTTP transport | `ferrite-http` | Stable |\n| Configuration | `fr-config` | Stable |\n| Validation | `ferrite-validation` | Stable |\n| ORM abstraction | `ferrite-orm` + adapters | Stable (in-memory + Sea adapters) |\n| Health checks | `ferrite-health` | Stable |\n| JWT auth | `ferrite-auth-jwt` | Stable |\n| OAuth2 \u002F OIDC | `ferrite-auth-oauth` | Stable |\n| OpenAPI \u002F Swagger | `ferrite-swagger` | Stable |\n| WebSockets | `ferrite-ws` | Stable |\n| Caching | `ferrite-cache-redis` | Stable |\n| Rate limiting | `ferrite-throttler` | Stable |\n| Testing | `ferrite-testing` | Stable |\n| gRPC | `ferrite-grpc` | Stable |\n| Messaging | `ferrite-nats` \u002F `ferrite-kafka` | Stable |\n| Jobs & schedule | `ferrite-queue` \u002F `ferrite-cron` | Stable |\n| CQRS \u002F i18n | `ferrite-cqrs` \u002F `ferrite-i18n` | Stable |\n\n## Where to go next\n\n- [First steps](\u002Fdocs\u002Foverview\u002Ffirst-steps) — scaffold your first service with `fr new`.\n- [Controllers](\u002Fdocs\u002Foverview\u002Fcontrollers) — handle HTTP requests.\n- [Providers](\u002Fdocs\u002Foverview\u002Fproviders) — services and dependency injection.\n- [Modules](\u002Fdocs\u002Foverview\u002Fmodules) — structure your application.",{"frontmatter":9,"meta":10,"nodes":31},{"title":5,"description":6},{"toc":11},{"title":12,"searchDepth":13,"depth":14,"links":15},"On This Page",2,3,[16,19,22,25,28],{"id":17,"depth":13,"text":18},"how-ferrite-is-different","How Ferrite is different",{"id":20,"depth":13,"text":21},"a-minimal-application","A minimal application",{"id":23,"depth":13,"text":24},"design-principles","Design principles",{"id":26,"depth":13,"text":27},"what-ships-with-the-framework","What ships with the framework",{"id":29,"depth":13,"text":30},"where-to-go-next","Where to go next",[32,36,45,73,76,114,122,124,564,566,576,606,616,626,635,637,880,882],[33,34,5],"h1",{"id":35},"introduction",[37,38,39,40,44],"p",{},"Ferrite is a batteries-included backend framework for Rust. It borrows the most productive ideas from Node's NestJS ecosystem and brings them to Rust with a twist: because Rust has no runtime reflection, Ferrite resolves your whole dependency graph at ",[41,42,43],"strong",{},"compile time",". If a provider is missing or a cycle exists, you get a compiler error — not a runtime panic.",[37,46,47,48,51,52,51,55,58,59,62,63,51,66,58,69,72],{},"At its core Ferrite offers ",[41,49,50],{},"modules",", ",[41,53,54],{},"providers",[41,56,57],{},"controllers",", and ",[41,60,61],{},"cross-cutting concerns"," (guards, interceptors, middleware, and pipes), all expressed with a small set of attribute macros on top of ",[41,64,65],{},"Axum",[41,67,68],{},"Tokio",[41,70,71],{},"Tower",".",[74,75,18],"h2",{"id":17},[77,78,81],"pre",{"language":79,"class":80},"text","shiki shiki-themes github-light github-dark dark:github-dark",[82,83,85,93,94,93,99,93,104,93,109],"code",{"class":84},"language-text",[86,87,90],"span",{"class":88,"style":89},"line","display: inline",[86,91,92],{},"NestJS (TypeScript):         Ferrite (Rust):","\n",[86,95,96],{"class":88,"style":89},[86,97,98],{},"- runtime DI container       - compile-time dependency graph",[86,100,101],{"class":88,"style":89},[86,102,103],{},"- decorators + reflection    - attribute macros + inventory registry",[86,105,106],{"class":88,"style":89},[86,107,108],{},"- request\u002Fresponse pipeline  - explicit Middleware\u002FGuard\u002FInterceptor\u002FPipe pipeline",[86,110,111],{"class":88,"style":89},[86,112,113],{},"- one process, one server    - single static binary, tiny footprint",[37,115,116,117,121],{},"The ",[118,119,120],"em",{},"shape"," of an application is nearly identical, which makes Ferrite instantly familiar to anyone coming from NestJS — but the guarantees are stronger and the runtime cost is lower.",[74,123,21],{"id":20},[77,125,127],{"language":126,"class":80},"rust",[82,128,130,93,153,93,155,93,160,93,174,93,176,93,186,93,191,93,214,93,219,93,224,93,226,93,254,93,268,93,272,93,277,93,279,93,290,93,301,93,314,93,318,93,320,93,325,93,333,93,337,93,360,93,367,93,371,93,373,93,383,93,409,93,426,93,430,93,434,93,436,93,463,93,474,93,476,93,481,93,494,93,528,93,560],{"class":129},"language-rust",[86,131,132,136,140,143,147,150],{"class":88,"style":89},[86,133,135],{"style":134},"color:#D73A49;--shiki-dark:#F97583","use",[86,137,139],{"style":138},"color:#6F42C1;--shiki-dark:#B392F0"," ferrite_framework",[86,141,142],{"style":134},"::",[86,144,146],{"style":145},"color:#24292E;--shiki-dark:#E1E4E8","{bootstrap, controller, impl_controller, injectable, module, ",[86,148,149],{"style":138},"Ferrite",[86,151,152],{"style":145},"};",[86,154],{"class":88,"style":89},[86,156,157],{"class":88,"style":89},[86,158,159],{"style":145},"#[injectable]",[86,161,162,165,168,171],{"class":88,"style":89},[86,163,164],{"style":134},"pub",[86,166,167],{"style":134}," struct",[86,169,170],{"style":138}," AppService",[86,172,173],{"style":145},";",[86,175],{"class":88,"style":89},[86,177,178,181,183],{"class":88,"style":89},[86,179,180],{"style":134},"impl",[86,182,170],{"style":138},[86,184,185],{"style":145}," {",[86,187,188],{"class":88,"style":89},[86,189,190],{"style":145},"    #[inject]",[86,192,193,196,199,202,205,208,212],{"class":88,"style":89},[86,194,195],{"style":134},"    pub",[86,197,198],{"style":134}," fn",[86,200,201],{"style":138}," new",[86,203,204],{"style":145},"() ",[86,206,207],{"style":134},"->",[86,209,211],{"style":210},"color:#005CC5;--shiki-dark:#79B8FF"," Self",[86,213,185],{"style":145},[86,215,216],{"class":88,"style":89},[86,217,218],{"style":210},"        Self",[86,220,221],{"class":88,"style":89},[86,222,223],{"style":145},"    }",[86,225],{"class":88,"style":89},[86,227,228,230,232,235,238,241,244,247,249,252],{"class":88,"style":89},[86,229,195],{"style":134},[86,231,198],{"style":134},[86,233,234],{"style":138}," hello",[86,236,237],{"style":145},"(",[86,239,240],{"style":134},"&",[86,242,243],{"style":210},"self",[86,245,246],{"style":145},") ",[86,248,207],{"style":134},[86,250,251],{"style":138}," String",[86,253,185],{"style":145},[86,255,256,260,262,265],{"class":88,"style":89},[86,257,259],{"style":258},"color:#032F62;--shiki-dark:#9ECBFF","        \"Ferrite is running\"",[86,261,72],{"style":134},[86,263,264],{"style":138},"to_string",[86,266,267],{"style":145},"()",[86,269,270],{"class":88,"style":89},[86,271,223],{"style":145},[86,273,274],{"class":88,"style":89},[86,275,276],{"style":145},"}",[86,278],{"class":88,"style":89},[86,280,281,284,287],{"class":88,"style":89},[86,282,283],{"style":145},"#[controller(",[86,285,286],{"style":258},"\"\u002Fhealth\"",[86,288,289],{"style":145},")]",[86,291,292,294,296,299],{"class":88,"style":89},[86,293,164],{"style":134},[86,295,167],{"style":134},[86,297,298],{"style":138}," HealthController",[86,300,185],{"style":145},[86,302,303,306,309,311],{"class":88,"style":89},[86,304,305],{"style":145},"    service",[86,307,308],{"style":134},":",[86,310,170],{"style":138},[86,312,313],{"style":145},",",[86,315,316],{"class":88,"style":89},[86,317,276],{"style":145},[86,319],{"class":88,"style":89},[86,321,322],{"class":88,"style":89},[86,323,324],{"style":145},"#[impl_controller]",[86,326,327,329,331],{"class":88,"style":89},[86,328,180],{"style":134},[86,330,298],{"style":138},[86,332,185],{"style":145},[86,334,335],{"class":88,"style":89},[86,336,190],{"style":145},[86,338,339,341,343,345,348,350,352,354,356,358],{"class":88,"style":89},[86,340,195],{"style":134},[86,342,198],{"style":134},[86,344,201],{"style":138},[86,346,347],{"style":145},"(service",[86,349,308],{"style":134},[86,351,170],{"style":138},[86,353,246],{"style":145},[86,355,207],{"style":134},[86,357,211],{"style":210},[86,359,185],{"style":145},[86,361,362,364],{"class":88,"style":89},[86,363,218],{"style":210},[86,365,366],{"style":145}," { service }",[86,368,369],{"class":88,"style":89},[86,370,223],{"style":145},[86,372],{"class":88,"style":89},[86,374,375,378,381],{"class":88,"style":89},[86,376,377],{"style":145},"    #[get(",[86,379,380],{"style":258},"\"\u002F\"",[86,382,289],{"style":145},[86,384,385,387,390,392,395,397,399,401,403,405,407],{"class":88,"style":89},[86,386,195],{"style":134},[86,388,389],{"style":134}," async",[86,391,198],{"style":134},[86,393,394],{"style":138}," health",[86,396,237],{"style":145},[86,398,240],{"style":134},[86,400,243],{"style":210},[86,402,246],{"style":145},[86,404,207],{"style":134},[86,406,251],{"style":138},[86,408,185],{"style":145},[86,410,411,414,416,419,421,424],{"class":88,"style":89},[86,412,413],{"style":210},"        self",[86,415,72],{"style":134},[86,417,418],{"style":145},"service",[86,420,72],{"style":134},[86,422,423],{"style":138},"hello",[86,425,267],{"style":145},[86,427,428],{"class":88,"style":89},[86,429,223],{"style":145},[86,431,432],{"class":88,"style":89},[86,433,276],{"style":145},[86,435],{"class":88,"style":89},[86,437,438,441,444,447,450,453,455,457,460],{"class":88,"style":89},[86,439,440],{"style":145},"#[module(controllers ",[86,442,443],{"style":134},"=",[86,445,446],{"style":145}," [",[86,448,449],{"style":138},"HealthController",[86,451,452],{"style":145},"], providers ",[86,454,443],{"style":134},[86,456,446],{"style":145},[86,458,459],{"style":138},"AppService",[86,461,462],{"style":145},"])]",[86,464,465,467,469,472],{"class":88,"style":89},[86,466,164],{"style":134},[86,468,167],{"style":134},[86,470,471],{"style":138}," AppModule",[86,473,173],{"style":145},[86,475],{"class":88,"style":89},[86,477,478],{"class":88,"style":89},[86,479,480],{"style":145},"#[bootstrap]",[86,482,483,486,488,491],{"class":88,"style":89},[86,484,485],{"style":134},"async",[86,487,198],{"style":134},[86,489,490],{"style":138}," main",[86,492,493],{"style":145},"() {",[86,495,496,499,502,504,507,509,512,514,517,520,523,526],{"class":88,"style":89},[86,497,498],{"style":134},"    let",[86,500,501],{"style":145}," app ",[86,503,443],{"style":134},[86,505,506],{"style":138}," Ferrite",[86,508,142],{"style":134},[86,510,511],{"style":138},"create",[86,513,142],{"style":134},[86,515,516],{"style":145},"\u003C",[86,518,519],{"style":138},"AppModule",[86,521,522],{"style":145},">()",[86,524,525],{"style":134},".await",[86,527,173],{"style":145},[86,529,530,533,535,538,540,543,546,549,552,554,557],{"class":88,"style":89},[86,531,532],{"style":145},"    app",[86,534,72],{"style":134},[86,536,537],{"style":138},"listen",[86,539,237],{"style":145},[86,541,542],{"style":258},"\"0.0.0.0:3000\"",[86,544,545],{"style":145},")",[86,547,548],{"style":134},".await.",[86,550,551],{"style":138},"expect",[86,553,237],{"style":145},[86,555,556],{"style":258},"\"failed to bind 0.0.0.0:3000\"",[86,558,559],{"style":145},");",[86,561,562],{"class":88,"style":89},[86,563,276],{"style":145},[74,565,24],{"id":23},[37,567,568,571,572,575],{},[41,569,570],{},"1. Everything is a provider."," Services, controllers, repositories, and infrastructure singletons are all registered with the DI container and resolved by type. There is no shared ",[82,573,574],{},"app"," object to reach into.",[37,577,578,581,582,51,585,58,587,590,591,598,599,602,603,72],{},[41,579,580],{},"2. The graph is known at compile time."," The ",[82,583,584],{},"#[module]",[82,586,159],{},[82,588,589],{},"#[inject]"," macros emit registration metadata at compile time via the ",[592,593,595],"a",{"href":594},"https:\u002F\u002Fcrates.io\u002Fcrates\u002Finventory",[82,596,597],{},"inventory"," and ",[82,600,601],{},"linkme"," registries, which the bootstrap step assembles into the running ",[82,604,605],{},"Container",[37,607,608,611,612,615],{},[41,609,610],{},"3. The pipeline is explicit and ordered."," Requests flow through ",[82,613,614],{},"Middleware → Guards → Interceptors(before) → Pipes → Handler → Interceptors(after)",", with exception filters catching errors along the way. You control exactly which stages a route participates in.",[37,617,618,621,622,625],{},[41,619,620],{},"4. Single static binary."," No runtime, no VM, no dynamic loading. ",[82,623,624],{},"fr build --release"," produces a self-contained executable you can drop on any server.",[37,627,628,581,631,634],{},[41,629,630],{},"5. One CLI for everything.",[82,632,633],{},"fr"," binary scaffolds projects, generates artifacts, manages ecosystem crates, runs a hot-reloading dev server, drives database migrations, and exports OpenAPI specs.",[74,636,27],{"id":26},[638,639,640,656],"table",{},[641,642,643],"thead",{},[644,645,646,650,653],"tr",{},[647,648,649],"th",{},"Area",[647,651,652],{},"Crate",[647,654,655],{},"Status",[657,658,659,677,689,701,713,727,739,751,763,775,787,799,811,823,835,850,865],"tbody",{},[644,660,661,665,674],{},[662,663,664],"td",{},"Kernel & DI",[662,666,667,670,671],{},[82,668,669],{},"fr-core"," \u002F ",[82,672,673],{},"ferrite-framework",[662,675,676],{},"Stable",[644,678,679,682,687],{},[662,680,681],{},"HTTP transport",[662,683,684],{},[82,685,686],{},"ferrite-http",[662,688,676],{},[644,690,691,694,699],{},[662,692,693],{},"Configuration",[662,695,696],{},[82,697,698],{},"fr-config",[662,700,676],{},[644,702,703,706,711],{},[662,704,705],{},"Validation",[662,707,708],{},[82,709,710],{},"ferrite-validation",[662,712,676],{},[644,714,715,718,724],{},[662,716,717],{},"ORM abstraction",[662,719,720,723],{},[82,721,722],{},"ferrite-orm"," + adapters",[662,725,726],{},"Stable (in-memory + Sea adapters)",[644,728,729,732,737],{},[662,730,731],{},"Health checks",[662,733,734],{},[82,735,736],{},"ferrite-health",[662,738,676],{},[644,740,741,744,749],{},[662,742,743],{},"JWT auth",[662,745,746],{},[82,747,748],{},"ferrite-auth-jwt",[662,750,676],{},[644,752,753,756,761],{},[662,754,755],{},"OAuth2 \u002F OIDC",[662,757,758],{},[82,759,760],{},"ferrite-auth-oauth",[662,762,676],{},[644,764,765,768,773],{},[662,766,767],{},"OpenAPI \u002F Swagger",[662,769,770],{},[82,771,772],{},"ferrite-swagger",[662,774,676],{},[644,776,777,780,785],{},[662,778,779],{},"WebSockets",[662,781,782],{},[82,783,784],{},"ferrite-ws",[662,786,676],{},[644,788,789,792,797],{},[662,790,791],{},"Caching",[662,793,794],{},[82,795,796],{},"ferrite-cache-redis",[662,798,676],{},[644,800,801,804,809],{},[662,802,803],{},"Rate limiting",[662,805,806],{},[82,807,808],{},"ferrite-throttler",[662,810,676],{},[644,812,813,816,821],{},[662,814,815],{},"Testing",[662,817,818],{},[82,819,820],{},"ferrite-testing",[662,822,676],{},[644,824,825,828,833],{},[662,826,827],{},"gRPC",[662,829,830],{},[82,831,832],{},"ferrite-grpc",[662,834,676],{},[644,836,837,840,848],{},[662,838,839],{},"Messaging",[662,841,842,670,845],{},[82,843,844],{},"ferrite-nats",[82,846,847],{},"ferrite-kafka",[662,849,676],{},[644,851,852,855,863],{},[662,853,854],{},"Jobs & schedule",[662,856,857,670,860],{},[82,858,859],{},"ferrite-queue",[82,861,862],{},"ferrite-cron",[662,864,676],{},[644,866,867,870,878],{},[662,868,869],{},"CQRS \u002F i18n",[662,871,872,670,875],{},[82,873,874],{},"ferrite-cqrs",[82,876,877],{},"ferrite-i18n",[662,879,676],{},[74,881,30],{"id":29},[883,884,885,896,903,910],"ul",{},[886,887,888,892,893,72],"li",{},[592,889,891],{"href":890},"\u002Fdocs\u002Foverview\u002Ffirst-steps","First steps"," — scaffold your first service with ",[82,894,895],{},"fr new",[886,897,898,902],{},[592,899,901],{"href":900},"\u002Fdocs\u002Foverview\u002Fcontrollers","Controllers"," — handle HTTP requests.",[886,904,905,909],{},[592,906,908],{"href":907},"\u002Fdocs\u002Foverview\u002Fproviders","Providers"," — services and dependency injection.",[886,911,912,916],{},[592,913,915],{"href":914},"\u002Fdocs\u002Foverview\u002Fmodules","Modules"," — structure your application.",{"title":12,"searchDepth":13,"depth":14,"links":918},[919,920,921,922,923],{"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},"https:\u002F\u002Fgithub.com\u002Fj4flmao\u002Fferrite_rs\u002Fedit\u002Fmain\u002Fdocs\u002Fcontent\u002Foverview\u002Fintroduction.md",null,{"title":891,"slug":927},"overview\u002Ffirst-steps",1789565439198]