A fast, lightweight and cloud-native microservices framework.
Light means lightweight, lightning fast and shedding light on how to program with modern Java SE for cloud-native deployment.
I had been working on the Java EE platforms since early 2000 and suffered the performance and productivity issues. In 2014, I realized that the IT industry was moving from Monolithic to Microservices and from on-premise data centers to the public clouds.
To reduce the production cost for my applications, I need to find a lightweight platform that has a small memory footprint, high throughput, and low latency in Java. Java EE and Spring/Spring Boot are too heavy to be considered. Other lightweight Java platforms all have different issues on the separation between the business logic and technical cross-cutting concerns. Moreover, they are not cloud-native or designed for container/cloud.
Without finding anything suitable, I started to build my open-source platform light-4j on top of the Undertow HTTP core by following the principles. Because my approach is very radical, and it is against products from big corporations, I have been attacked by some entities online and offline constantly. However, I am so convinced that my approach is the future direction and spend all my effort to continue the development. Today, a lot of companies are using light-4j on production with very positive feedback. It further encourages me to devote myself to the framework and to extend the platform to build an ecosystem.
For users who benefit from the platform, you can become a sponsor for me so that I can put all my effort into the open-source projects.
It is 44 times faster than the most popular microservices platform Spring Boot embedded Tomcat and use only 1/5 of memory. Here are the benchmark results compare with Spring Boot and other microservices frameworks. Here is the third party comparison with other Web frameworks.
Design OpenAPI specification and generate the service from it. The specification is also part of the framework to drive security verification and request validation at runtime.
Unit/End-to-End test stubs are generated to enable test driven approach for quality product.
Debugging within IDE just like standalone application for better developer productivity.
Dockerfile and DevOps supporting files are generated to support dockerization and continuous integration to production.
All the open sourced frameworks are built in Java and we are working on Nodejs framework internally. In the future, we might provide Golang framework as well and all them are sharing the same eco-system and market place.
There are two ways to start your project:
You can use light-codegen to generate a working project. Currently, it supports light-rest-4j, light-graphql-4j, light-hybrid-server-4j and light-hybrid-service-4j. light-eventuate code generator is coming.
The light-codegen project README.md describes four ways to use the generator with examples.
The other way to start your project is to copy from light-example-4j.
You can find the description of these examples
Also, there are some tutorials
To run/debug from IDE, you need to configure a Java application with main class "com.networknt.server.Server" and working directory is your project folder. There is no container and you are working on just a standalone Java application.
create a Java application that main class is com.networknt.server.Server and working directory is your project root folder. You can debug your server just like a POJO application.
java -jar target/demo-0.1.0.jar
you can use Ctrl+C to kill the server but for production use the following command
kill -s TERM <pid>
The server has a shutdown hook and the above command allow it to clean up. For example, complete in-flight requests and close the database connections etc. If service registry and discovery is used, then the server will send shutdown event to service registry and keep processing requests for 30 seconds until all clients refreshes their local cache before shutting down.
Light-4j and all light-*-4j frameworks are available under the Apache 2.0 license. See the LICENSE file for more info.