This is a RealWorld.io example backend server with Moleculer microservices framework.
- 7 microservices
- NeDB or MongoDB database without Mongoose
- User login & signup
- User authentication with JWT
- Memory caching
- Docker files
This is a simple blog example.
- Docker files
- ExpressJS www server with Pug template engine
- MongoDB database with moleculer-db and moleculer-db-adapter-mongoose modules
- NATS transporter
- Redis cacher
- Traefik reverse proxy (in micro arch)
- static frontend
The main Moleculer repository contains some examples.
To try them, at first, you should clone the Moleculer repo with the following command:
git clone https://github.com/moleculerjs/moleculer.git
This is a simple demo with a Math service which can
divide two numbers.
$ npm run demo simple
In this example, you can start any servers & clients. The servers serve the
math.add action and clients call it in a loop. You can start multiple instances from both.
They use TCP transporter, but you can change it with
TRANSPORTER env variable.
Start a server
$ node examples/client-server/server
Start a client
$ node examples/client-server/client
This example demonstrates how the middleware system works.
$ npm run demo middlewares
This example shows how you can start a broker and load services with Moleculer Runner.
$ node ./bin/moleculer-runner.js -c examples/runner/moleculer.config.js -r examples/user.service.js
It starts a broker with options from
moleculer.config.js, loads the user service from
user.service.js file and switch to REPL mode.
With this example, you can start a load test. The server & client prints how many requests executed in a second.
$ node examples/loadtest/server
Start & fork clients (number of CPU cores)
$ node examples/loadtest/clients