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::EventType
andlifecycle::Events
enums. Theconfig
utilities were moved tonakago-figment
.nakago-axum
- RemovedAxumApplication
,Route
, andRoutes
in favor of a more generic approach. Use the newInject
extractor to access dependencies in your Axum handlers.nakago-warp
- RemovedWarpApplication
,Route
, andRoutes
in 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_tag
to 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
- Theinject
namespace has been promoted to the top level. Wherenakago::inject
was used before,nakago
should now be the equivalent.nakago
- Theconfig
utilities 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 newInject
extractor 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 AxumState
to make theInject
container available to your handlers.nakago-figment
- Generic config utilities extracted from the corenakago
package.