| Crates.io | zksync_node_framework |
| lib.rs | zksync_node_framework |
| version | 29.4.0-non-semver-compat |
| created_at | 2024-07-15 05:21:02.081819+00 |
| updated_at | 2025-09-24 17:48:07.673373+00 |
| description | ZKsync dependency injection framework used by node binaries |
| homepage | https://zksync.io/ |
| repository | https://github.com/matter-labs/zksync-era |
| max_upload_size | |
| id | 1303463 |
| size | 99,956 |
This is a dependency injection (DI) library used by the ZKsync node binaries (zksync_server and
zksync_external_node). The library is designed to be fully generic, so it doesn't incorporate any ZKsync-specific
domain knowledge.
The library provides following DI abstractions:
Wiring layers are defined in a decentralized way in component crates and some lower-level libraries and are assembled together in the node binary using the service builder.
Define DI logic in the separate node module of your crate.
For lower-level libraries, the module should be gated behind an opt-in node_framework feature (i.e., via
#[cfg(feature = "node_framework")]). Correspondingly, the node framework should be an optional dependency, together
with any auxiliary node-specific dependencies:
[dependencies]
zksync_node_framework = { workspace = true, optional = true }
[features]
default = []
node_framework = ["dep:zksync_node_framework"]
The node framework should not require many additional deps, maybe health checks and/or shared DI resources; if it requires heavyweight deps, you're probably doing something wrong. The reasoning behind feature-gating is that it's reasonable to assume that lower-level libraries may be used outside node binaries.
For node components, no feature-gating is necessary, but node framework logic should still be placed in the node
module, not scattered across the crate.