Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

moleculer

Package Overview
Dependencies
Maintainers
2
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moleculer

Fast & powerful microservices framework for Node.JS

  • 0.13.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47K
increased by19.01%
Maintainers
2
Weekly downloads
 
Created
Source

Moleculer logo

Build Status Coverage Status Codacy Badge Maintainability David Known Vulnerabilities Join the chat at https://gitter.im/moleculerjs/moleculer

Downloads FOSSA Status Patreon PayPal

Moleculer NPM version Twitter URL

Moleculer is a progressive microservices framework for Node.js.

Website: https://moleculer.services

Documentation: https://moleculer.services/docs

What's included

  • 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...

Installation

$ npm install moleculer --save

or

$ 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 } = require("moleculer");

// Create a broker
let broker = new ServiceBroker({ logger: console });

// Create a service
broker.createService({
    name: "math",
    actions: {
        add(ctx) {
            return Number(ctx.params.a) + Number(ctx.params.b);
        }
    }
});

// Start broker
broker.start()
    // Call service
    .then(() => broker.call("math.add", { a: 5, b: 3 }))
    .then(res => console.log("5 + 3 =", res))
    .catch(err => console.error(`Error occurred! ${err.message}`));

Try it on Runkit

Create a Moleculer project

Use the Moleculer CLI tool to create a new Moleculer based microservices project.

  1. Install moleculer-cli globally

    $ npm install moleculer-cli -g
    
  2. Create a new project (named first-demo)

    $ moleculer init project first-demo
    

    Press Y on API Gateway & npm install

  3. Open project folder

    $ cd first-demo
    
  4. Start project

    $ npm run dev
    
  5. Open the http://localhost:3000/ link in your browser. It shows a start page which contains two links to call the greeter service via API gateway.

:tada: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!

Supporting

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!

Documentation

You can find here the documentation.

Changelog

See CHANGELOG.md.

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Contributions

We welcome you to join to the development of Moleculer. Please read our contribution guide.

License

Moleculer is available under the MIT license.

3rd party licenses

Contact

Copyright (c) 2016-2018 MoleculerJS

@moleculerjs @MoleculerJS

Keywords

FAQs

Package last updated on 11 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc