Node.js and Express Gateway in a Cloud Native World
Microservices Solves Core Roadblocks for Cloud Native
From humble grassroots, the “cloud native” movement has transformed into the “cloudification” of large scale applications and the infrastructure they run in. Originally, practitioners faced the challenges of entering and staying in the cloud. Now, challenges are becoming opportunity to operate efficiently and innovate.
Operationalizing and innovating your applications demands the kind of flexibility offered by “microservices,” an architectural style that has been refined over the past decade by Martin Fowler and other leading technologists.
The idea is simple: build an application as a set of discrete, loosely coupled, and well-defined, divided services.
While this is not necessarily new, it is important to recognize that running these services as lightweight orchestrated processes in the cloud has placed new demands on technologists to maintain the agility and flexibility they need to grow their business.
Microservices solve a myriad of issues for cloud native applications. As an architectural style, microservices are language and framework agnostic. However, there are choices of languages and platforms that can support or adversely affect your ability to execute your microservices strategy. Node.js is an open source, existing language and platform that was crafted with the microservices paradigm in mind.
Node.js: What Does It Mean To Be Cloud Native from Day 0?
As one of the largest open source projects on the planet, Node.js was born in the era of the cloud as a networking and I/O library. Before containerization became the runtime specification and standard, developers ran Node.js as a single process. Then they would replicate and scale the application (even within its native facility) through its Cluster API.
Additionally, Node.js technology stacks can be as minimal or expansive as you need them to be. This level of customization allows you to maintain your agility. The core of Node.js is minimal without some “web” library and utilities. Like Python and Ruby, Node.js has built-in classes like HTTP and even HTTP/2, but these are at a much lower level. This is where Express.js, a minimalistic framework for Node.js, can take over.
Express.js, a Minimalistic Node.js Framework, Completes the Cloud Native Strategy
Express.js has one of the highest adoption rates among Node.js frameworks. As a framework, it’s just enough to stand up your barebone static web application or any complex web application through its vast number of middleware modules and add-ons. At the time of this post, Express.js has over 3,000 middleware modules and add-ons. The incredible volume of application and router-based middleware attests to its popularity and ease of use.
Importantly, middleware modules and add-ons represent the vast number of use cases utilizing the Express.js core to develop microservice based applications. For example, Express.js “session” modules, express-session, and data store extensions to persist the session data like express-mysql-session, connect-mongodb-session, and hundreds more.
As a quick recap: Express.js provides a minimalistic and extensible framework for Node.js. Node.js provides a flexible and agile language and platform for Microservices. Microservices, an architectural style that breaks down monolithic architecture into services, supports the scalability and effective management of complex cloud native applications.
Express Gateway And The Modern Microgateway
At the heart of a microservices architecture is an API gateway, a centralized piece of infrastructure that sits between consumers and producers of APIs and microservices. Every consumer — including another microservice — could be facilitated through a gateway and then aggregated to a higher level of consumers internally or externally. The expanding role and use cases of API gateways evolved from this general term to include “microgateway”.
For practitioners, using microgateways is an opportunity to take advantage of all of the benefits of an API Gateway, but at the individual microservice level.
Upon closer examination of these two diagrams, it becomes clear that evolving the API Gateway conceptually to provide additional control and flexibility within the core pieces of the microservices architecture yields more consistent and manageable results. In order to continue the alignment exercise throughout the tech stack, Express Gateway, an open source API Gateway built on Express.js, would provide a very practical solution within this architecture. Whether Express Gateway serves as an API Gateway or deeper down at the microservice level as a microgateway, there are distinct advantages of aligning this piece to a larger cloud native strategy.
How Express Gateway Supports a Cloud Native Strategy
Express Gateway combines the ecosystem of both infrastructure and application modules of Express.js with the flexibility of quick and easy scripting by anyone — developer/devops, CS major, or JS hobbyist. This open source project democratizes microservices for anyone, regardless of skill level, to help manage, control, and securely expose your microservices for consumption.
The gateway is extrapolated out of your web application — and the same minimalistic web framework is re-utilized to provide only gateway functions. In a cloud native world, these functions could and should be applied to any of your applications in a consistent, well-orchestrated layer as a running set of microservices independent of what goes on behind it.
Express Gateway takes this concept even one level further. Express.js modules do not require developers to “hand roll” them statically into the web application, and they are not even statically rolled into the gateway itself.
You can declare your gateway’s configuration and dynamically configure and invoke the middleware modules as a set of plugins through conditions and actions. Essentially, this manipulates one declarative config construct in real time with quicker cycles of deployment and hot reload instead of cycling down your process because of static code changes.
Additionally, Express Gateway adds in the twelve factor principles of maintaining config from code. This allows developers to segment the gateway into many microgateways horizontally and vertically. So, the horizontal deployment model meets traditional deployment topologies of infrastructure concerns federated across multiple instances of Express Gateway, predominantly focused on external and internal consumers. On the other hand, the vertical deployment model couples an Express Gateway instance — as a microgateway — with each microservice, forming the backbone of a service mesh. Both models can be used in conjunction to divert application-level versus infrastructure-level concerns globally for the application and/or individually at the microservice level.
The next step from cloud native is a multi-cloud strategy that can drive down operational costs, preserve flexibility, and increase agility to adapt key resources to market fluctuations. A multi-cloud strategy will depend on overall architectural style, microservices composition, and microservices management.
How Express Gateway Enables a Multi-Cloud Strategy Compared to Commercial Counterparts
It goes without saying that for many of its commercial counterparts, with the exception of Kong and Tyk, Express Gateway has the advantage of being completely open source, community driven, and built with cloud native principles in mind.
For example, Express Gateway does not provide opinionation on any given cloud. You want it running on Joyent Triton — absolutely. You want your cloud running on AWS? No problem. The urgent demand for choice of cloud provider is driving the industry-wide evolution from cloud or hybrid to a truly multi-cloud model, a key advantage in cost savings with cloud native applications.
According to the Rightscale 2018 State of the Cloud Report, 81% of enterprises have a multi-cloud strategy. Think — what differentiators will be key to your success in building, supporting, and maintaining your agility and flexibility?
When it comes to its composition and configuration, there are strong differentiators with how Express Gateway interacts with the rest of your cloud native initiatives. In addition to other areas, there are two key areas where Express Gateway stands out:
- Its integration with dynamically declaring service endpoints. This provides easier and more rapid integration with the next generation of service meshes and orchestrated microservices.
- Its declarative config that integrates with cloud enabled CI/CD and orchestration runtimes and, importantly, with Kubernetes. Think ConfigMaps, Pod Autoscale friendliness, Ingress controller potential.
These are just a few of the advantages that developers experience by leveraging Express Gateway. As multi-cloud strategies continue to gain adoption and popularity, Express Gateway is positioned to support these demands.
Post written by Al Tsang