We make self-hosting easy

    More Articles

Introducing create-node-app & deploy-node-app

Create and deploy Node.js microservices to Kubernetes in seconds, including Redis, Postgres and more!

This post is by erulabs
Seandon Mooy
July 7, 2019

At KubeSail we're convinced we can simplify Kubernetes for developers - so today we're excited to announce create-node-app and deploy-node-app, two tools for creating and deploying microservices based on Node.js.

create-node-app

Inspired by (and making use of) create-react-app, create-node-app builds a new directory with presets for a simple Node.js API and a front-end built by create-react-app.
Deploy Node App
In its current form, create-node-app is a fairly simple, but powerful tool. We aim to support its growth and add additional features such as a template system for other types of applications (e.g, slackbot, API server, background worker).
You can run npx create-node-app myapp and start hacking on your app in seconds!

deploy-node-app

Included in create-node-app is a tool which should work in almost any existing Node.js project, deploy-node-app. This tool generates all the boilerplate required for container based deployments on Kubernetes or Docker! deploy-node-app will:
  • Create a Dockerfile if none exists
  • Create a Kubernetes Deployment or docker-compose.yaml file
  • Automatically map ports from Docker to your Node.js app
  • Build and push your Docker image
  • Deploy your app on any Kubernetes cluster, including the KubeSail free tier!
You can try npx deploy-node-app -f kubernetes in your project now to deploy any Node.js application to KubeSail!

Introducing Node.js Meta Modules

There are many Node.js app-builder tools to choose from, so we intentionally chose to keep create-node-app extremely simple and straight forward — we know the Node community tends to dislike highly opinionated tools, and we agree. But both create-node-app and deploy-node-app understand a new type of Node.js module we're calling "Meta Modules".
A Meta Module is just a normal NPM module, except with a bit of metadata. For example, the first meta module, Redis, contains the following:
  • The Node 'redis' driver as a dependency
  • A Redis service definition for docker-compose and Kubernetes
  • Metadata which matches environment variables between the Redis service and your application
What all this means is that you can simply npm install @metamodules/redis, and deploy-node-app will automatically know how to setup a local Redis instance as well as a production ready Kubernetes deployment.
What's even better, is that create-node-app uses deploy-node-app for local development, meaning that with only three commands:
You've just built a Redis/Postgres powered microservice! To really seal the deal, you can now also:
We're excited to add more metamodules, as well as additional documentation and tooling to enable authors to build their own metamodules. We believe there is simply no other tool out there which accomplishes:
  • Zero vendor lockin (Any Kubernetes works!)
  • Local development with local Redis/Postgres in one command
  • Driver / Service matching (eg: a matching version of the Redis driver and Redis database!)
  • Vastly simplified configuration via automatic environment variables (eg: REDIS_HOST and REDIS_PORT are set dynamically!)
A demo of what makes a metamodule "meta" - a simple object in the package.json file:

We've created a GitHub organization where we'll be publishing some metamodules, as well as further documentation.

Stay in the loop!

Join our Discord server, give us a shout on twitter, check out some of our GitHub repos and be sure to join our mailing list!