ligero
The lightweight Java web framework โ a micro-framework's speed and footprint, with the batteries the micro-frameworks leave out.
Why Ligero
Ligero (Spanish for lightweight) is a web framework for Java 21+ that proves you don't have to choose between fast and lean and productive. On the zero-dependency JDK engine it tops a same-app benchmark โ ~13k req/s, ~0.43 s cold start, a 3 MB dependency tree โ while shipping a DI container, feature modules, a visual debugger, JPA/Redis integrations and more.
Ligero app = Ligero.create(8080);
app.get("/hello/{name}", ctx ->
ctx.json(Map.of("message", "Hello, " + ctx.pathParam("name") + "!")));
app.start(); // running in ~0.4 s
Built around a few firm ideas:
- Zero dependencies in the core โ
ligero-coredepends only onslf4j-api. JSON, server engines, templates, metrics, config, data โ every one is an optional, pluggable adapter behind an SPI. Pay only for what you use. - Virtual threads by default โ blocking, easy-to-read handler code that scales like async, courtesy of Project Loom.
- No runtime magic โ no classpath scanning, no reflection-based injection. Wiring is explicit code the compiler checks; an optional annotation processor can generate it for you at compile time if you prefer brevity.
- Batteries, but ร la carte โ a DI container, feature modules, a visual devtools dashboard, auth, OpenAPI, templates, tracing, JPA and Redis โ each a module you add when you need it, never weight you carry by default.
What's in the boxโ
Everything below is optional โ add the module, or don't.
| Area | Module(s) | What you get |
|---|---|---|
| HTTP core | ligero-core | router, middleware, Context, SPIs, config โ zero deps |
| Engines | ligero-server-jdk ยท ligero-server-jetty | zero-dep JDK engine or Jetty (HTTP/2, WebSockets) โ swap in one line |
| DI | ligero-core (Beans) ยท ligero-processor | explicit lambda wiring, or generate it at compile time |
| Modules | ligero-core (LigeroModule) | feature slices, wiring out of the startup class |
| Devtools | ligero-devtools | /ligero/dev โ bean graph + live per-request traces |
| Data | ligero-jdbc ยท ligero-jpa ยท ligero-migrations | SQL โ records (no ORM), a thin JPA/Hibernate helper, and Flyway migrations at startup |
| Validation | ligero-validation | annotation-based request validation โ automatic 400 |
| Config | ligero-config-yaml | ligero.yml + profiles, ${ENV:-default} |
| Scale-out | ligero-redis | distributed rate-limit + session stores |
| Also | auth ยท JSON ยท templates (ร3) ยท OpenAPI ยท metrics ยท OTel tracing | JWT/CSRF/sessions, Jackson, Mustache/FreeMarker/Pebble, โฆ |
See the full list on the Modules reference.
When to use Ligeroโ
- REST APIs and microservices where startup time and footprint matter.
- Services that want plain, debuggable Java instead of framework magic.
- Anywhere you'd reach for a micro-framework but still want DI, modules and first-class devtools.
When not to use itโ
If you need the full Jakarta EE surface or Spring's ecosystem breadth (reactive stacks, the vast starter/integration catalog), use those โ Ligero optimizes for the lean, explicit end of the spectrum.
How it comparesโ
Same products CRUD app, measured identically (see Benchmarks):
| Ligero (JDK engine) | Javalin | Spring Boot | |
|---|---|---|---|
| Core dependencies | 0 (slf4j-api) | Jetty | dozens |
| Programming model | handlers + middleware, explicit DI | handlers | annotations + DI |
| Virtual threads | default | optional | optional |
| Cold start | ~0.43 s | ~0.62 s | ~2 s |
| Throughput | ~13k req/s | ~11k | ~5.8k |
| Dependency size | 3 MB | 8 MB | 20 MB |
Ready to dive in? Start with the Quickstart, or follow the Learning Path for a guided route from your first route to a production service.