• Stars
    star
    6,089
  • Rank 6,614 (Top 0.2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸš€ Progressive microservices framework for Node.js

Moleculer logo

CI test Coverage Status Maintainability Codacy Badge Known Vulnerabilities Discord chat

Downloads FOSSA Status Patreon

Moleculer NPM version Twitter URL

Moleculer is a fast, modern and powerful microservices framework for Node.js. It helps you to build efficient, reliable & scalable services. Moleculer provides many features for building and managing your microservices.

Website: https://moleculer.services

Documentation: https://moleculer.services/docs

Top sponsors

What's included

  • Promise-based solution (async/await compatible)
  • request-reply concept
  • support event driven architecture with balancing
  • built-in service registry & dynamic service discovery
  • load balanced requests & events (round-robin, random, cpu-usage, latency, sharding)
  • many fault tolerance features (Circuit Breaker, Bulkhead, Retry, Timeout, Fallback)
  • plugin/middleware system
  • support versioned services
  • support Streams
  • service mixins
  • built-in caching solution (Memory, MemoryLRU, Redis)
  • pluggable loggers (Console, File, Pino, Bunyan, Winston, Debug, Datadog, Log4js)
  • pluggable transporters (TCP, NATS, MQTT, Redis, NATS Streaming, Kafka, AMQP 0.9, AMQP 1.0)
  • pluggable serializers (JSON, Avro, MsgPack, Protocol Buffer, Thrift, CBOR, Notepack)
  • pluggable parameter validator
  • multiple services on a node/server
  • master-less architecture, all nodes are equal
  • built-in parameter validation with fastest-validator
  • built-in metrics feature with reporters (Console, CSV, Datadog, Event, Prometheus, StatsD)
  • built-in tracing feature with exporters (Console, Datadog, Event, Jaeger, Zipkin, NewRelic)
  • official API gateway, Database access and many other modules...

Installation

$ npm i moleculer

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
const broker = new ServiceBroker();

// 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 in your browser

Create a Moleculer project

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

  1. Create a new project (named moleculer-demo)

    $ npx moleculer-cli -c moleculer init project moleculer-demo
  2. Open the project folder

    $ cd moleculer-demo
  3. Start the project

    $ npm run dev
  4. Open the http://localhost:3000/ link in your browser. It shows a welcome page that contains more information about your project & you can test the generated services.

πŸŽ‰ Congratulations! Your first Moleculer-based microservices project is created. Read our documentation to learn more about Moleculer.

Welcome page

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 our free time to make it better and better on a daily basis. If you like Moleculer framework, please support it.

Thank you very much!

For enterprise

Available as part of the Tidelift Subscription.

The maintainers of moleculer and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

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 in the development of Moleculer. Please read our contribution guide.

Project activity

Alt

License

Moleculer is available under the MIT license.

3rd party licenses

Contact

Copyright (c) 2016-2023 MoleculerJS

@moleculerjs @MoleculerJS

More Repositories

1

awesome-moleculer

πŸš€ A list of awesome things related to Moleculer microservices framework
JavaScript
361
star
2

moleculer-web

🌍 Official API Gateway service for Moleculer framework
JavaScript
291
star
3

moleculer-examples

🎲 Examples for Moleculer microservices framework
HTML
160
star
4

moleculer-db

πŸ”‹ Database access service mixins for Moleculer
JavaScript
152
star
5

moleculer-template-project-typescript

Typescript project template for Moleculer microservices framework.
TypeScript
122
star
6

moleculer-apollo-server

πŸš€ Apollo GraphQL server for Moleculer
JavaScript
100
star
7

moleculer-addons

🎁 Official addons for Moleculer framework
JavaScript
86
star
8

moleculer-io

Socket.io API GateWay service for Moleculer framework
JavaScript
80
star
9

moleculer-channels

Reliable messages for Moleculer services via external queue/channel/topic.
JavaScript
72
star
10

moleculer-realworld-example-app

🌏 RealWorld example app with Moleculer microservices framework
JavaScript
54
star
11

moleculer-cli

🌿 Command line tool for Moleculer
JavaScript
48
star
12

moleculer-metrics

πŸ“ˆ Official monitoring & metrics addons for Moleculer framework
JavaScript
47
star
13

database

Advanced Database Access Service for Moleculer microservices framework
JavaScript
32
star
14

moleculer-repl

REPL module for Moleculer framework
JavaScript
27
star
15

moleculer-cheatsheets

πŸ“š Cheatsheets for Moleculer microservices framework
JavaScript
26
star
16

moleculer-template-project

πŸŽ“ Common project template for Moleculer-based projects
JavaScript
21
star
17

site

🌐 Official website for Moleculer
JavaScript
21
star
18

moleculer-http-client

HTTP client mixin that allows Moleculer services to communicate with remote REST APIs
JavaScript
17
star
19

docker-demo

Kubernetes & Docker demo for Moleculer project testing & prototyping.
HTML
17
star
20

sidecar

[WIP] Sidecar for Moleculer framework with HTTP support.
JavaScript
15
star
21

moleculer-db-adapter-typeorm

typescript sql adapter using typeorm
TypeScript
10
star
22

kubernetes-demo

Kubernetes demo for Moleculer microservices framework
9
star
23

educational-content

A guide to create educational content for the Moleculer ecosystem
9
star
24

moleculer-template-nano-typescript

Minimal project template for one Moleculer microservice with typescript.
TypeScript
8
star
25

moleculer-template-nano

πŸŽ“ Minimal project template for one microservice.
JavaScript
7
star
26

perf-tester

Performance tester docker image to test your tech stack (transporter, serializer, discoverer)
JavaScript
6
star
27

sandbox-moleculer-db

Moleculer Database service sandbox for prototyping.
JavaScript
5
star
28

project-demo

Demo Project. Generated by official "project" template
JavaScript
5
star
29

moleculer-docgen

πŸ“œ Documentation generator for Moleculer services
JavaScript
5
star
30

incubator

🐣 A comprehensive Moleculer demo project to try out new ideas and test all framework features and modules.
4
star
31

moleculer-agent

🚦 [PoC] Agent to control your Moleculer nodes remotely
JavaScript
4
star
32

moleculer-db-adapter-macrometa

MacroMeta adapter for Moleculer DB service.
JavaScript
4
star
33

moleculer-web-addons

Mixin & middleware addons for official Moleculer API Gateway service.
3
star
34

sandbox-moleculer-api-routing

Moleculer API Gateway routing sandbox on Codesandbox.io
JavaScript
3
star
35

moleculer-appsignal

[WIP] Moleculer Metrics reporter and Tracing exporter for AppSignal
JavaScript
3
star
36

rfcs

Request-For-Comments collection for Moleculer microservices framework
2
star
37

moleculer-template-addon

πŸŽ“ Addon template for moleculer-addons package
JavaScript
2
star
38

moleculer-template-module

πŸŽ“ Simple module template for moleculer-cli
JavaScript
2
star
39

project-typescript-demo

Demo Project. Generated by official "project-typescript" template
TypeScript
2
star
40

moleculer-middlewares

Middleware Monorepo for MoleculerJS
TypeScript
1
star
41

generator-moleculer

Yeoman generator to generate a Moleculer project
JavaScript
1
star
42

katacoda-scenarios

Katacoda scenarios for Moleculer microservices framework
1
star
43

sandbox-moleculer-project

Moleculer project sandbox for prototyping on CodeSandbox.io
JavaScript
1
star