Self-hosted service
networknt/light-4j avatar
networknt/light-4j

Light-4J: an Undertow-based Java microservices framework with the gateway built in

A fast, lightweight and more productive microservices framework

3,674 stars622 forksJavaApache-2.0

At a glance

What is it?
Light-4J packs OAuth2 JWT checks, OpenAPI validation, metrics and rate limiting into one Java framework on the Undertow HTTP core. Its speed figures are the author's own, and its tooling assumes you adopt the surrounding Light ecosystem.
Who is it for?
Light-4J fits a Java team that wants an Undertow-based service with security, validation and metrics already wired and is willing to design the API in OpenAPI first. It fits poorly if you need a non-Java stack, since Node.js work is internal and Go is only a maybe.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly Java, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • networknt/light-4j3,674 ★ · +1
Star history
Repository2026-10-092026-11-22
networknt/light-4j3.7k3.7k

1 Stars in the last 44 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Built on Undertow because Java EE and Spring Boot were judged too heavy

The author's account of the origin is personal and specific. He had worked on Java EE platforms since early 2000 and ran into performance and productivity problems. By 2014 he saw the industry moving from monolith to microservices and from on-premise data centers to public clouds. To cut production cost he wanted a Java platform with a small memory footprint, high throughput and low latency.

His verdict was that Java EE and Spring or Spring Boot were too heavy to consider. Other lightweight Java platforms, in his view, blurred the line between business logic and technical cross-cutting concerns, and were not designed for containers or cloud. Finding nothing suitable, he built light-4j on top of the Undertow HTTP core, following a set of published principles.

Those are the author's judgments, not measurements, and the project does not show what the comparison looked like. What the choice does fix is the foundation. Every module in the repository sits on Undertow's handler model, so a team that standardizes on another server or on a servlet container will not get the same pieces. The author also notes that companies run it in production and that he accepts sponsorship to keep working on the open-source projects.

The 44 times faster figure comes from the author's own benchmark repository

The headline claim is that light-4j is 44 times faster than Spring Boot with embedded Tomcat and uses only one fifth of the memory. The project links a benchmark repository, `networknt/microservices-framework-benchmark`, that compares it with Spring Boot and other microservices frameworks. A third-party comparison against other web frameworks is linked from TechEmpower.

Treat the numbers as a claim to reproduce. The first comparison was published by the same person who wrote the framework, the workload is whatever his benchmark repository defines, and no hardware, payload or concurrency detail appears in the project description. A hello-world style service says little about a service that spends its time waiting on a database. The memory claim is just as dependent on settings, since a Java process footprint moves with heap flags.

The fair reading is narrower. Light-4J starts from a minimal HTTP core, so its baseline cost is likely lower than a full stack, but how much lower on your service is something only a run on your own hardware will tell. Clone the benchmark repository, point it at an endpoint shaped like yours, and compare before the speed argument counts for anything in a design review.

One config module per middleware, listed as sibling directories

The embedded gateway is the framework's main idea. Instead of putting cross-cutting work in a separate proxy, the framework ships it as middleware and startup or shutdown hooks that you wire in. The list in the project covers distributed OAuth2 JWT security verification, runtime request and response validation against an OpenAPI specification, global exception handling, masking of sensitive data such as credit card and SIN numbers before logging, and cross-site scripting sanitization for query parameters, headers and body.

It continues with audit dumps of the request and response, body parsing for different content types, standardized response codes and messages from a configuration file, a CORS pre-flight handler for single-page apps on another domain, and rate limiting for services exposed to the Internet. Metrics go to InfluxDB or Prometheus and are viewed in Grafana, for both services and clients.

The repository layout matches this. The top level holds one directory per module, and many have a paired configuration directory, such as `audit` and `audit-config`, `cors` and `cors-config`, `body` and `body-config`, `health` and `health-config`. Configuration is externalized for all modules for the dockerized environment, so changing a middleware's behavior means editing its config files, not rebuilding the service.

Service discovery is client-side, with direct, Consul and Zookeeper registries

Light-4J does not assume a sidecar or an external load balancer. The service registry and discovery support direct addresses, Consul and Zookeeper. On the calling side, client-side discovery and load balancing remove the need for a proxy between services. The repository contains a `consul` directory next to `balance`, `cluster` and `client` modules, which is where that work lives.

The client module is tightly integrated with Light-OAuth2 and supports traceability. That integration is useful if you run the matching OAuth2 server, because token handling between services comes from one place. It is a constraint if you run Keycloak or a hosted identity provider and want the same convenience, since the project describes no equivalent path for other servers.

The registry list is also a boundary. A team using Eureka, Kubernetes service discovery or etcd has to supply the lookup on its own, or choose direct addressing. None of those are named in the project's description, and the three that are named cover a narrower field than a service mesh would. Decide which registry you run before choosing Light-4J, because it shapes how much of the client module you can use.

Design-first workflow: the OpenAPI file generates the service and drives runtime checks

The workflow starts with an OpenAPI specification. You design it, generate the service from it, and the same specification then drives security verification and request validation at runtime. Unit and end-to-end test stubs are generated so you can work test-first. Dockerfile and DevOps support files are generated for dockerization and continuous integration to production. The project also says you can debug inside an IDE just like a standalone application.

Generation is done by `light-codegen`, which currently supports light-rest-4j, light-graphql-4j, light-hybrid-server-4j and light-hybrid-service-4j. The generator for light-eventuate is described as coming, so an event-sourcing project has no generated starting point today. Four ways to run light-codegen are listed. You can clone and build it and use the `codegen-cli` utility, use the `networknt/light-codegen` Docker image, run `generate.sh` from the `model-config` repository, or call the codegen-web API. That last route has an API but no finished UI.

The other starting path is copying from the `light-example-4j` repository. Because validation reads the same specification at runtime, an edit to the spec changes request handling, so version the file as carefully as the code.

Four sibling frameworks, all Java, with Node.js work still internal

Light-4J is the base for several frameworks aimed at different service types. `light-rest-4j` is for RESTful services with OpenAPI code generation and runtime security and validation. `light-graphql-4j` supports schema generation from IDL and plugins. `light-hybrid-4j` takes advantage of both monolithic and microservice architectures. `light-eventuate` is a messaging-based framework built on Kafka, event sourcing and CQRS.

The language story is short. All open-sourced frameworks are built in Java. A Node.js framework is being worked on internally, and a Golang framework might come later, all sharing the same ecosystem and marketplace. That is a plan, not a release, and no date is given.

A polyglot shop should read this literally. Today the choice is a Java framework, and anything written in another language on your side talks to Light-4J services over their HTTP endpoints without the shared client module or codegen. Choose the sibling that matches your service type before you start, because the generator, the validation and the examples differ per framework. Light-rest-4j is the one with the most matching detail in the project description.

Releases 2.4.0 and 2.4.1 arrived within a week in October 2026

The repository is not archived, and the last push was on 2026-10-20. Release 2.4.1 is dated 2026-10-11, 2.4.0 is dated 2026-10-07, and 2.3.7 is dated 2026-08-13. Two minor-version tags in four days after a two-month gap suggests a batch of changes landed together, so read the CHANGELOG before upgrading across that boundary. The license is Apache-2.0.

Around the framework sits an ecosystem the author wants you to adopt. A separate OAuth2 server, `light-oauth2`, handles security. `light-portal` is for production monitoring and management and is described as a marketplace that links clients and services together. These pieces are separate repositories, so adopting the whole stack means running several projects, not one.

Support channels listed include Stack Overflow under the `light-4j` tag, a Google Group, Gitter, a subreddit and a YouTube channel, plus documentation at doc.networknt.com. The project is funded partly through sponsorship of its author, so the maintenance picture depends heavily on one person. Check the commit history for how many people besides him merge changes before you depend on it for a long-lived service.

Editorial conclusion

Light-4J fits a Java team that wants an Undertow-based service with security, validation and metrics already wired and is willing to design the API in OpenAPI first. It fits poorly if you need a non-Java stack, since Node.js work is internal and Go is only a maybe. Run the author's benchmark repository on your own hardware before trusting the 44 times claim, because that figure is the project's, not an independent one.

Frequently asked questions

What is Light-4J?

Light-4J is a fast, lightweight and cloud-native Java microservices framework built on the Undertow HTTP core. It ships an embedded gateway with security, validation, metrics and rate limiting.

What are some frameworks for microservices in the Light-4J family?

light-rest-4j for RESTful services, light-graphql-4j for GraphQL, light-hybrid-4j for a hybrid of monolith and microservices, and light-eventuate for Kafka-based event sourcing and CQRS.

What is microservices and light weight architecture according to Light-4J?

The author describes it as a platform with a small memory footprint, high throughput and low latency in Java, with business logic kept separate from technical cross-cutting concerns and designed for containers and cloud.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. networknt/light-4j on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/networknt-light-4j.svg)](https://hysenlabs.com/projects/networknt-light-4j)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/networknt-light-4j.svg)](https://hysenlabs.com/projects/networknt-light-4j)

Was this useful?