Building a REST API with Jeet: Minimal Boilerplate, Maximal Speed
Jeet is a lightweight Java web framework that auto‑configures Jersey on Jetty, enabling rapid REST API development with minimal boilerplate. This blog walks through a minimal setup, shows hot‑reload, and discusses trade‑offs before you ship production.
10 Nov 2025, 11:42 UTC

Why Jeet? A Concrete Problem
When you need a quick REST service—say, a micro‑service that exposes a single data model—setting up Spring Boot can feel like overkill. You have to write a lot of configuration, add XML or YAML, and the resulting JAR is a few hundred megabytes. Jeet solves this by auto‑configuring Jersey (the JAX‑RS reference implementation) on an embedded Jetty server, giving you a single‑file executable that starts in seconds and requires almost no boilerplate.
Thesis: Jeet’s “Auto‑Config + Hot‑Reload” makes rapid prototyping painless
Jeet’s core selling points are:
- Zero XML or YAML—just a Maven dependency and a main class.
- Embedded Jetty runs out of the box, so you can ship a single JAR.
- Jackson provider is pre‑wired, so JSON serialization is automatic.
- Reactive endpoints via
CompletionStagekeep the server non‑blocking. - Hot‑reload watches source changes and restarts the server without a full rebuild.
Setting Up a Minimal Jeet Project
Below is a minimal Maven project that demonstrates a single endpoint returning a nested JSON object. The example uses Jeet 1.2.0, which requires Java 11 or newer.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>jeet-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<jeet.version>1.2.0</jeet.version>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jeet</groupId>
<artifactId>jeet-core</artifactId>
<version>${jeet.version}</version>
</dependency>
<!-- Jackson JSON provider is bundled with Jeet, but you can add custom modules if needed -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.example.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Next, create the main class that starts Jeet’s embedded Jetty server.
package com.example;
import org.jeet.Jeat;
import org.jeet.JeatConfiguration;
public class App {
public static void main(String[] args) throws Exception {
// JeetConfiguration can be extended for custom settings
JeatConfiguration config = new JeatConfiguration();
// Default port 8080, can be overridden via env var or system property
Jeat.run(config, args);
}
}
Defining a Simple JAX‑RS Resource
Jeet auto‑detects classes annotated with @Path. Place the following in src/main/java/com/example/HelloResource.java:
package com.example;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.CompletableFuture;
@Path("/hello")
public class HelloResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public CompletionStage<Greeting> getGreeting() {
// Simulate async work
return CompletableFuture.supplyAsync(() -> new Greeting("World", 42));
}
// Simple POJO will be serialized to JSON by Jackson
public static class Greeting {
public final String name;
public final int code;
public Greeting(String name, int code) {
this.name = name;
this.code = code;
}
}
}
Running mvn package and then executing the shaded JAR will start a Jetty server on http://localhost:8080/hello. A GET request returns:
{"name":"World","code":42}
Hot‑Reload in Development
Jeet’s embedded Jetty can watch the target/classes directory. When you modify HelloResource and recompile with mvn -DskipTests compile, the server automatically picks up the new class without a full restart. This is enabled by default in the JeatConfiguration and can be toggled with config.setHotReload(true) if you prefer explicit control.
Trade‑offs and Limitations
| Aspect | Jeet | What to Watch For |
|---|---|---|
| Application Scope | REST‑only, no MVC or templating | Not suitable for full web apps with server‑side rendering |
| Ecosystem | Smaller than Spring Boot; fewer third‑party starters | Custom integrations may require manual wiring |
| Security | No built‑in CSRF or authentication filters | Implement ContainerRequestFilter or use external libraries |
| Production Tuning | Requires knowledge of Jetty and Jersey tuning knobs | Adjust thread pools, request timeouts, and connection limits manually |
Practical Checklist Before Production
- Verify the latest Jeet release on Maven Central (currently 1.2.0).
- Run
java -versionto ensure Java 11+ is available. - Use
mvn -DskipTests packageto build the fat JAR. - Test JSON serialization against your data model by sending a
GETrequest and inspecting the response. - Set up a simple
ContainerRequestFilterfor basic authentication or rate limiting. - Profile Jetty under load (e.g., using
wrkorhey) and adjust theJeatConfigurationthread pool size.
Actionable Takeaway
If your goal is a lightweight, zero‑configuration REST service that you can ship as a single JAR and iterate on quickly, Jeet is a solid choice. Start with the minimal example above, experiment with CompletionStage for async logic, and then layer on security or performance tuning as your needs grow. For larger, multi‑module applications or when you need a richer ecosystem, you might still lean toward Spring Boot or Quarkus.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.