Environment
JDK 8 or JDK 11 (Mandatory) Currently, the majority of the components in Light 1.5.x or 1.6.x is based on Java 8, and master 2.0.x is based on Java 11. Before starting your first project, we need to install the following software packages on your system.
Most of our customers are working on light-4j production ready 1.5.x and 1.6.x versions which are dependent on Java 8. We have released 2.
Read More »
Light Codegen Tool
The code generator light-codegen could be used to support project scaffolding for all the frameworks provided by Light.
The code generator based on Rocker template engine that can be used as a utility or web service. It is used currently as scaffold services which include light-rest-4j, light-graphql-4j, light-eventuate-4j and light-hybrid-4j.
Workflow Light-codegen generates initialized microservice projects based on user-defined specification and configuration file:
– Light-rest-4j
for OpenAPI based generation: OpenAPI JSON/YAML format specification and configuration file
Read More »
Light Rest 4j
The light-rest-4j is a framework that is designed to speed up RESTful API development and deployment. On top of light-4j, it has several middleware handlers specifically designed around Swagger 2.0 and OpenAPI 3.0 specifications. With the specification ready, you can scaffold project with light-codegen, and the specification will be loaded during the runtime to enable JWT scope verification and schema validation for the request based on the spec.
Setup Local Development Environment Build Systems and Dependency Management Design First Create an OpenAPI 3.
Read More »
Light Graphql 4j
GraphQL is a new style of protocol open sourced by Facebook and it is getting popular especially in Mobile and Single Page Applications as a front end. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
light-graphql-4j is a GraphQL framework built on top of light-4j and graphql-java.
Read More »
Light Hybrid 4j
For public APIs, it makes sense to use RESTful; however, if it is an internal API, the RPC based API style will be more efficient. These days, Javascript on the browser is really powerful, and it can deal with JSON or other binary protocols very easily. These browser objects (JSON/Binary) contain type information so that there is no need to do Object to URI and URI to Object transformation based on OpenAPI specification or RAML.
Read More »
Light Eventuate 4j
One of the major issues that we have seen occur in a system with microservices is the way transactions work when they span over different services. Within our old monolithic architecture, we have been using distributed transactions to resolve this, but they come with their own issues. It is very hard to avoid deadlocks and scale the application when business grows.
Distributed transaction management is a key architectural consideration that needs to be addressed whenever you are proposing a microservices deployment model to a customer.
Read More »
Getting Started
Quick start and guides for staring your first microserivce on your preferred operating system.
Read More »
Light Oauth2
The nature of the services is easy to access so security is the most important thing when deploying services. Light is a security first design and an OAuth 2.0 service provider is available as part of the ecosystem. Along with light-portal client registration and service registration, light-oauth2 provides more than normal OAuth 2.0 for microservices such as public key distribution, scope management, and distributed policy management.
If you are new to OAuth 2.
Read More »
Light Portal Service
Light encourages microservices or serverless architecture although it can be used to build monolithic services. When you have too many services running within the organization, managing these service specifications during development and instances during runtime can become a daunting job. Light-portal provides features that help you manage the entire life-cycle of services from planning to decommission.
lightapi.net portal Install light-portal light-portal components
Read More »
Light Proxy Server
For an organization that establishes infrastructure to support services built on top of Light, chances are they have some existing services built with other platforms or even different languages. To leverage the security, metrics, logging, tracing, auditing, client-side service discovery for these existing services, it is a good idea to put light-proxy in front of these services to provide cross-cutting concerns and gateway features for them. Although the light-proxy adds an additional network hop, however, it might be faster given it supports HTTP 2.
Read More »
Light Config Server
Each plugin in Light has a configuration file to control if the component is enabled and its behaviour during runtime. Most modules have a default configuration file in the module src/main/resources/config folder that can be overridden by the application level configuration with the same file name in the same location. Also, the configuration files can be externalized to a file system folder specified by a system property. To help manage these config files in a hierarchical structure, we have created a config server for services to load their config during startup.
Read More »
Light Saga 4j
In microservices architecture, one request might trigger multiple services in the call stack, so to ensure data consistency between services, we have provided light-saga-4j to manage distributed transactions. Sagas require your services to be idempotent and provide a compensation action for each update action. light-saga-4j is built on top of light-eventuate-4j.
Read More »
Light Session 4j
Most people think Light is only for services as it is our forte. However, it can be used to build web applications that support Mobile Native and Single Page applications. To provide Single Sign-On and High availability, we need to support multiple instances of server running and session replication among them. Light-session-4j is designed for this and it supports in-memory, Hazelcast, Redis and JDBC for session replication.
Read More »
Webserver
Most people use Light to build services instead of web servers; however, today’s Mobile Native applications and Single Page applications running on browsers makes the traditional server side rendering provided by Java EE obsolete. For your browsers and mobile devices you need a web server that can serve Javascript with static content as well as APIs. This is the strength of Light.
Read More »
Websocket
HTTP protocol is pretty efficient, especially HTTP 2.0; however, to handle repeated communication between server to browser or between browser to browser, nothing can compete with Websocket. Once the connection is established, the communication channel is open until it is closed. It is very efficient to handle messages or events in an event driven application.
Read More »
Spring Boot Servlet
In this tutorial, we are going to generate a typical Spring Boot application from https://start.spring.io/ and modify it to inject light-4j middleware handlers. The final application can be found at https://github.com/networknt/light-example-4j/tree/master/springboot/servlet
Light-4j encourages a design driven approach and it loads the specification during the runtime to validate the request and verify the JWT token scopes based on the specification. For this example application, the specification can be found at https://github.com/networknt/model-config/blob/master/rest/springboot/servlet/openapi.yaml
Read More »