# ๐ Shellder
*A lightweight, Spring-inspired Dependency Injection framework for Rust.*
***"A Crab needs its Shell"***
---
## โจ Overview
**Shellder** brings a modular, ergonomic approach to Rust applications by offering:
* ๐ฆ **Dependency Injection** via `#[component]` and `#[derive(App)]` macros
* โ๏ธ **Lifecycle Hooks** (`startup`, `run`, `cleanup`)
* ๐ ๏ธ **Compile-time struct injection**
* ๐งต **Thread-safe container (`Arc`-based)**
* ๐ง **Optional lightweight logger**
Built for CLI tools, long-running services, or application backends.
---
## ๐ Quick Start
### Add Shellder to your project
```toml
[dependencies]
shellder = "0.2.5"
```
---
### Example
```rust
use std::sync::Arc;
use shellder::{App, Container, Hooks, Lifecycle};
pub struct Logger;
impl Logger {
pub fn log(&self, msg: &str) {
println!("[LOG] {}", msg);
}
}
#[derive(App)]
pub struct HelloApp {
#[component]
logger: Arc<Logger>,
}
impl Hooks for HelloApp {
fn startup(&self) {
self.logger.log("Starting up!");
}
fn run(&self) {
self.logger.log("Running...");
}
fn cleanup(&self) {
self.logger.log("Shutting down.");
}
}
```
Running this app will automatically inject dependencies and call hooks in order.
---
## ๐งฉ Features in v0.2.5
โ
`#[component]` macro for auto-registration
โ
`#[derive(App)]` macro to auto-generate `main()`
โ
Lifecycle `Hooks` trait support
โ
Thread-safe singleton container
โ
Optional custom logger
โ
Works without `tokio` or async runtime
---
## ๐ ๏ธ Planned Roadmap
* ๐ Named registration & resolution (`"db", "logger"`)
* ๐งช Test container for mocking dependencies
* ๐งฌ Config loader (from `.toml` or `.yaml`)
* ๐งฑ Fluent container builder
* ๐งฉ Macro plugins: `#[value]`, `#[config]`, etc.
* ๐งต Async hook support
* ๐ Workspace support & automatic example runner
---
## ๐ก Philosophy
Shellder follows a **Rust-first** vision:
* โ
Strong compile-time guarantees
* ๐งผ Minimal runtime dependencies
* ๐ ๏ธ Clean syntax with macros
* ๐ค Integrates well with your architecture
---
## ๐ License
Licensed under **Apache-2.0**.
---
## ๐ค Contributing
Bug reports, PRs, and feedback are welcome!
Open an issue to discuss enhancements or integrations.
---
## ๐ฃ Stay Tuned
Shellder is under active development.
Watch the repo for updates on:
* Configuration loading
* DI graphs
* CLI/web framework integrations
* Logging plugins