allframe 0.1.28

Complete Rust web framework with built-in HTTP/2 server, REST/GraphQL/gRPC, compile-time DI, CQRS - TDD from day zero
Documentation
# 🚀 We Just Built the World's First Zero-Cost Compile-Time DI Framework

**Date**: 2025-11-25
**Milestone**: AllFrame v0.2
**Status**: Complete

---

## The Problem Everyone Accepted

For years, we've had two bad choices for dependency injection:

1. **Runtime DI** (Spring, NestJS) → Fast to write, slow to run, reflection hell
2. **Manual wiring** (most Rust apps) → Fast to run, tedious to write, error-prone

What if there was a third way?

## Introducing AllFrame's Compile-Time DI

We just shipped something that doesn't exist anywhere else: **Dependency injection that happens entirely at compile time, with zero runtime overhead.**

```rust
#[di_container]
struct AppContainer {
    database: DatabaseService,
    repository: UserRepository,
    service: UserService,
}

let container = AppContainer::new();
// ↑ All wiring happens at compile time
// ↑ Zero reflection, zero runtime cost
// ↑ Perfect initialization order guaranteed
```

## The Magic Under the Hood

✨ **Automatic dependency graph analysis** using topological sort
✨ **Smart type-based detection** (UserService → UserRepository → Database)
✨ **Auto Arc<T> wrapping** for shared ownership
✨ **Circular dependency detection** at compile time
✨ **100% type-safe** with helpful compiler errors

## How It Compares

| Feature | AllFrame | Spring Boot | NestJS | Axum |
|---------|----------|-------------|--------|------|
| DI Resolution | Compile-time | Runtime | Runtime | Manual |
| Performance | Zero cost | Reflection overhead | Decorator overhead | N/A |
| Type Safety | 100% | Partial | TypeScript limits | Manual |
| Arc Wrapping | Automatic | N/A | N/A | Manual |

## The Numbers

- **12/12 tests passing** (100% TDD from day one)
- **Zero runtime overhead** (all codegen at macro expansion)
- **4+ levels of nesting** tested and working
- **Automatic Arc wrapping** for shared dependencies
- **Smart heuristics** detect dependencies by type names

## Real-World Example

```rust
// Your services with dependencies
struct UserRepository {
    db: Arc<DatabaseService>,  // Shared ownership
}

struct UserService {
    repo: Arc<UserRepository>,  // Shared ownership
}

// AllFrame figures out:
// ✅ DatabaseService needs Arc (shared by multiple services)
// ✅ Must create database first, then repository, then service
// ✅ How to pass Arc::clone() to constructors
// ✅ Accessor method return types

#[di_container]
struct AppContainer {
    database: DatabaseService,
    user_repository: UserRepository,
    user_service: UserService,
}

// One line. That's it.
let container = AppContainer::new();
```

## Why This Matters

**For Rust developers:** You get Spring Boot-level DX with zero runtime cost
**For the ecosystem:** Proves compile-time DI is possible and practical
**For the industry:** Challenges the "reflection is necessary" assumption

## What's Next

This is **Milestone 0.2** of AllFrame - "The Composable Rust API Framework"

Coming soon:
- 📝 Auto OpenAPI 3.1 generation (in progress)
- 🔄 Protocol-agnostic routing (REST/GraphQL/gRPC from one handler)
- 📊 OpenTelemetry auto-instrumentation
- 🤖 MCP server (let LLMs call your API as tools)

**AllFrame. One frame. Infinite transformations.**

---

## Try It Yourself

```bash
# Coming soon to crates.io
# For now: Star the repo and watch for v0.2 release!
```

**GitHub:** [Link to repo]
**Docs:** [Link to docs]
**Roadmap:** [Link to PRD]

Built with 100% TDD. Every feature has tests before implementation.

---

*What do you think? Is compile-time DI the future of Rust web frameworks?*

#rustlang #webdev #opensource #DI #dependencyinjection #zerocost #compiletime #framework