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 & 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
- event bus system
- supports middlewares
- multiple services on a node/server
- built-in caching solution (memory, Redis)
- multiple supported transporters (NATS, MQTT, Redis)
- multiple supported serializers (JSON, Avro, MsgPack, Protocol Buffer)
- load balanced requests (round-robin, random)
- every nodes are equal, no master/leader node
- auto discovery services
- parameter validation
- distributed timeout handling with fallback response
- health monitoring, metrics & statistics
- supports versioned services (run different versions of the service)
Installation
$ npm install moleculer --saveor
$ yarn add moleculerYour first microservice
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
The fastest way is that use Moleculer CLI tool to create a new Moleculer based microservices project.
Install moleculer-cli
$ npm install moleculer-cli -g
Create a new project (named
first-demo)$ moleculer init project-simple first-demo
Add API Gateway and press Y to
npm installOpen project folder
$ cd first-demoStart project
$ npm run devOpen the http://localhost:3000/math.add?a=5&b=3 link in your browser. It will call the
addaction ofmathservice with two params via API gateway and returns with the result.
🎉Congratulation, you created your first Moleculer based microservices project. Read our documentation to learn more about Moleculer.
Documentation
You can find the documentation here.
Changelog
See CHANGELOG.md.
Roadmap
See ROADMAP.md.
License
Moleculer is available under the MIT license.
Contact
Copyright (c) 2016-2017 Ice Services