Dart is an incredible language for backend development—but building enterprise APIs in Dart has historically meant reinventing the wheel. There has been no standard dependency injection, no annotation-driven configuration, and no true Spring Boot equivalent.
JetLeaf changes that.
JetLeaf is an enterprise-grade, modular Dart backend framework. It brings over 25 packages to the Dart ecosystem, giving you a batteries-included toolkit for building production-ready server applications without ever leaving the Dart language.
At its core, JetLeaf is built on four pillars:
- Simplicity: Convention over configuration. Annotate your classes, and the framework handles the rest.
- Productivity: Boot an application context, wire dependencies, and serve requests in minutes, not hours.
- Extensibility: A modular architecture where every layer can be used independently or composed together.
- Robustness: Full application lifecycle management, conditional pod registration, profile-based environments, and built-in fault tolerance.
The "What": Core Capabilities Out of the Box
JetLeaf brings a familiar, annotation-driven development model to Dart.
1. IoC Container (Pod Factory)
JetLeaf uses a layered Inversion of Control (IoC) architecture. jetleaf_pod provides a full-featured bean container supporting singleton and prototype scopes, lifecycle hooks (@PostConstruct, @PreDestroy), and dynamic expressions. On top of that, jetleaf_core adds an AnnotationConfigApplicationContext that auto-discovers annotated classes and wires dependencies through constructor and field injection.
2. Annotation-Driven Configuration
The entire framework is driven by annotations. A @Configuration class defines @Pod factory methods. @ConfigurationProperty binds externalized configuration (from YAML, JSON, or properties files) directly into Dart objects with full nested property support.
3. Component Scanning & Conditional Registration
Drop @Service, @Repository, or @Controller on a class, and JetLeaf finds it automatically. You can even register pods conditionally based on the environment using @ConditionalOnProperty, @ConditionalOnProfile, or @ConditionalOnClass.
The "Hello World"
The simplest JetLeaf application requires just two lines of boilerplate:
import 'package:jetleaf/jetleaf.dart';
void main(List<String> args) {
JetApplication.run(MyApplication, args);
}
@JetLeafApplication()
class MyApplication {}
@JetLeafApplication is a meta-annotation that enables auto-configuration, component scanning, and context bootstrapping.
Want to see it in action with actual components?
import 'package:jetleaf/jetleaf.dart';
@Service()
class Greeter {
void greet() => print('Hello from JetLeaf!');
}
void main(List<String> args) async {
final context = await JetApplication.run(MyApplication(), args);
final greeter = await context!.getPod<Greeter>('greeter');
greeter.greet(); // Hello from JetLeaf!
await context.close();
}
@JetLeafApplication()
class MyApplication {}
The Greeter service is discovered via component scanning, instantiated as a singleton, and injected into the context—without writing a single line of wiring code.
The Ecosystem
JetLeaf’s true power comes from its modular ecosystem:
| Package | What It Does |
|---|---|
jetleaf_core |
The foundation: IoC container, annotation processing, lifecycle management, and events. |
jetleaf_web |
HTTP server with REST controllers (@RestController), routing, and content negotiation. |
jetleaf_data |
Data access layer with the repository pattern and CRUD operations. |
jetleaf_devtool |
Developer CLI tools (jl dev for hot-reload, jl build for AOT compilation). |
Beyond these, there are packages for security, scheduling, validation, retries, and more.
If you've ever wished Dart had a first-class backend framework with dependency injection and a rich ecosystem of composable modules—JetLeaf is it.
Top comments (0)