Moleculer is a progressive microservices framework for Node.js.
- Promise-based solution
- request-reply concept
- support streams
- support event driven architecture with balancing
- built-in service registry & dynamic service discovery
- load balanced requests & events (round-robin, random, cpu-usage, latency)
- many fault tolerance features (Circuit Breaker, Bulkhead, Retry, Timeout, Fallback)
- supports middlewares
- supports versioned services
- service mixins
- built-in caching solution (memory, Redis)
- pluggable transporters (TCP, NATS, MQTT, Redis, NATS Streaming, Kafka)
- pluggable serializers (JSON, Avro, MsgPack, Protocol Buffer, Thrift)
- pluggable validator
- multiple services on a node/server
- all nodes are equal, no master/leader node
- parameter validation with fastest-validator
- built-in health monitoring & metrics
- official API gateway module and many other modules...
$ npm install moleculer --save
$ yarn add moleculer
Create your first microservice
This example shows you how to create a small service with an
add action which can add two numbers and how to call it.
const ServiceBroker = ;// Create a brokerlet broker = logger: console ;// Create a servicebroker;// Start brokerbrokerstart// Call service;
Create a Moleculer project
Use the Moleculer CLI tool to create a new Moleculer based microservices project.
Install moleculer-cli globally$ npm install moleculer-cli -g
Create a new project (named
first-demo)$ moleculer init project first-demo
Press Y on API Gateway &
Open project folder$ cd first-demo
Start project$ npm run dev
🎉Congratulations! Your first Moleculer based microservices project is created. Read our documentation to learn more about Moleculer.
We have many official modules for Moleculer. Check our list!
Moleculer is an open source project. It is free to use for your personal or commercial projects. However, developing it takes up all my free time to make it better and better on a daily basis. If you like Moleculer framework, please support it.
Thank you very much!
You can find here the documentation.
We welcome you to join to the development of Moleculer. Please read our contribution guide.
Moleculer is available under the MIT license.
Copyright (c) 2016-2018 MoleculerJS