Pivot to a Dependency Injection Toolkit
Nakago Pivots to a Dependency Injection Toolkit
With the release of Nakago v0.23, the project is pivoting away from the ambitious goal of a full-featured API framework, and towards a more streamlined dependency injection toolkit instead. The async Rust ecosystem is growing rapidly, and I haven't been able to devote enough time to Nakago to grow the application lifecycle and convenience features that I had originally envisioned. There are other projects that are doing a great job of providing these features - like Loco, Tide, Seaography, or Salvo.
What I haven't seen yet, however, is an async-first dependency injection container that is as lightweight and easy to work with as Nakago is, and doesn't require a lot of opaque macros or code generation. Nakago uses macros sparingly and takes advantage of Rust's Any dynamic typing tools to support a thread-safe, async-first dependency injection container that would work well with a variety of different Rust frameworks and team sizes.
I'll continue refining Nakago and adding features and integrations as I have need of them on side projects, and I'd love to collaborate with others who are interested in building a lightweight, async-first dependency injection toolkit for Rust.
The v0.23 Changelog
Removed
nakago- RemovedApplication,Hooks, thelifecycle::EventTypeandlifecycle::Eventsenums. Theconfigutilities were moved tonakago-figment.nakago-axum- RemovedAxumApplication,Route, andRoutesin favor of a more generic approach. Use the newInjectextractor to access dependencies in your Axum handlers.nakago-warp- RemovedWarpApplication,Route, andRoutesin favor of a more generic approach. Use thewith_injection()Filter to access dependencies in your Warp handlers.
Changed
nakago- The tag-based container operations were previously the default mode of working withInject. This proved to be more verbose and than necessary in most cases, however. The new default mode is to use the type-based operations, which are more ergonomic and easier to use. The tag-based operations are still available, but they are now suffixed with_tagto make it clear that they are a different mode of operation. The type-based operations are no longer suffixed with_type, because they are now the default.nakago- Theinjectnamespace has been promoted to the top level. Wherenakago::injectwas used before,nakagoshould now be the equivalent.nakago- Theconfigutilities were moved tonakago-figment.nakago-examples-simple,nakago-examples-async-graphql,nakago-examples-simple-warp- Updated with the new approach. See these examples for more information about how to use the tools mentioned above.
Added
nakago-axum- Added a newInjectextractor to access dependencies in your Axum handlers. This is a much more idiomatic way to use Nakago with Axum, and it's more flexible than the previous approach. Use the provided AxumStateto make theInjectcontainer available to your handlers.nakago-figment- Generic config utilities extracted from the corenakagopackage.
