MCPcopy Index your code
hub / github.com/moleculerjs/moleculer

github.com/moleculerjs/moleculer @v0.15.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.15.0 ↗
2,379 symbols 6,207 edges 563 files 977 documented · 41% 1 cross-repo links
README

Moleculer logo

CI test Coverage Status Maintainability Codacy Badge Known Vulnerabilities Discord chat Gurubase

Downloads 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, Kafka, AMQP 0.9, AMQP 1.0)
  • pluggable serializers (JSON, JSONExt, MsgPack, 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) bash $ npx moleculer-cli -c moleculer init project moleculer-demo

  2. Open the project folder bash $ cd moleculer-demo

  3. Start the project bash $ 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.

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

Contact

Copyright (c) 2016-2026 MoleculerJS

@moleculerjs @MoleculerJS

Extension points exported contracts — how you extend this code

Promise (Interface)
(no doc)
types/extends.d.ts
TestService4SettingSchema (Interface)
(no doc)
test/typescript/tsd/ServiceSchema_lifecycles.test-d.ts
Middleware (Interface)
(no doc)
src/middleware.d.ts
RunnerFlags (Interface)
(no doc)
src/runner.d.ts
PacketPayload (Interface)
(no doc)
src/packets.d.ts
BrokerErrorHandlerInfoAction (Interface)
(no doc)
src/service-broker.d.ts
TransitOptions (Interface)
(no doc)
src/transit.d.ts
LoggerBindings (Interface)
(no doc)
src/logger-factory.d.ts

Core symbols most depended-on inside this repo

resolve
called by 683
src/transporters/amqp.js
call
called by 555
src/context.js
init
called by 392
src/errors.js
stop
called by 240
src/tracing/tracer.js
createService
called by 233
src/service-broker.js
start
called by 232
src/tracing/span.js
register
called by 207
src/metrics/registry.js
delay
called by 189
types/extends.d.ts

Shape

Method 962
Function 740
Class 521
Interface 156

Languages

TypeScript100%

Modules by API surface

src/errors.js69 symbols
src/service-broker.js50 symbols
src/errors.d.ts43 symbols
src/transit.js39 symbols
test/integration/middlewares.spec.js32 symbols
src/transporters/tcp.js29 symbols
src/registry/registry.js29 symbols
src/service.js28 symbols
dev/middleware_v2.js28 symbols
src/utils.js27 symbols
src/metrics/types/histogram.js27 symbols
src/transporters/base.js23 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@eslint/js10.0.1 · 1×
@opentelemetry/auto-instrumentations-node0.64.5 · 1×
@opentelemetry/exporter-metrics-otlp-proto0.205.0 · 1×
@opentelemetry/exporter-trace-otlp-proto0.205.0 · 1×
@opentelemetry/instrumentation0.205.0 · 1×
@opentelemetry/sdk-node0.205.0 · 1×
@opentelemetry/semantic-conventions1.37.0 · 1×
@platformatic/kafka1.18.0 · 1×
@sinonjs/fake-timers15.0.0 · 1×
@types/bunyan1.8.11 · 1×
@types/node25.5.0 · 1×
@types/pino7.0.5 · 1×

For agents

$ claude mcp add moleculer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact