Package Exports
- moleculer
- moleculer/index
- moleculer/src/errors
- moleculer/src/serializers/base
- moleculer/src/transporters
- moleculer/src/transporters/base
- moleculer/src/validator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (moleculer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

Moleculer 
Moleculer is a fast, modern and powerful microservices framework for NodeJS (>= v6.x).
Website: https://moleculer.services
Documentation: https://moleculer.services/docs
What's included
- Promise-based solution
- request-reply concept
- support event driven architecture with balancing
- built-in service registry & auto discovery
- load balanced requests & events (round-robin, random, cpu-usage)
- supports middlewares
- service mixins
- multiple services on a node/server
- built-in caching solution (memory, Redis)
- pluggable transporters (TCP, NATS, MQTT, Redis, NATS Streaming, Kafka)
- pluggable serializers (JSON, Avro, MsgPack, Protocol Buffer)
- pluggable validator
- all nodes are equal, no master/leader node
- parameter validation with fastest-validator
- distributed timeout handling with fallback response
- health monitoring, metrics & statistics
- supports versioned services
- official API gateway module and many other modules...
Installation
$ npm install moleculer --saveor
$ yarn add moleculerCreate your first microservice
This example shows you how to create a small service with an add action which can add two numbers.
const { ServiceBroker } = require("moleculer");
let broker = new ServiceBroker({ logger: console });
broker.createService({
name: "math",
actions: {
add(ctx) {
return Number(ctx.params.a) + Number(ctx.params.b);
}
}
});
broker.start();
// Call service
broker.call("math.add", { a: 5, b: 3 })
.then(res => console.log("5 + 3 =", res))
.catch(err => console.error(`Error occured! ${err.message}`));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-simple first-demo
Press Y on API Gateway &
npm installOpen project folder
$ cd first-demoStart project
$ npm run devOpen the http://localhost:3000/greeter/welcome?name=world link in your browser. It will call the
welcomeaction ofgreeterservice with anameparam via API gateway and returns with the result.
🎉Congratulations! Your first Moleculer based microservices project is created. Read our documentation to learn more about Moleculer.
Official modules
We have many official modules for Moleculer. Check our list!
Documentation
You can find here the documentation.
Changelog
See CHANGELOG.md.
Roadmap
See ROADMAP.md.
Contributions
We welcome you to join to the development of Moleculer. Please read our contribution guide.
License
Moleculer is available under the MIT license.
Contact
Copyright (c) 2016-2017 Ice Services