The MostlyJS microservices demo project splits codebases into multiple separate independently packages in one repository using a Monorepos approach.
But instead of using Lerna, the project follows a simple Alle Monorepo architecture. You have a file system looks like this:
|-- my-project-repo/
| |-- package.json
| |-- packages/node_modules
| | |-- package-1/
| | | |-- package.json
| | |-- package-2/
| | | |-- package.json
Each services/modules lives under the packages/node_modules, so that you can require common modules in a very simple way without resorting to npm link
.
var package1 = require('package-1');
Because require() just walks up the file tree until it finds a node_modules folder with a sub-folder that matches the package name.
The project uses gulp to build the project and PM2 for production deployment.
The project contains the following seperated packages:
An Express demo application serve as a RESTful gateway for calling MostlyJS microservices. Request will be mapping to corresponding microservice.
Sample microservice writing with Feathers.
Sample microservice writing with Poplarjs.
More complicated sample microservices writing with Feathers using MongoDB.
Common modules to be used by other services, for demo only.
https://nats.io/documentation/tutorials/gnatsd-install
Install dependencies in each packages using YARN
$ yarn
$ ./bin/yarn_packages.sh
$ gulp
$ bin/run_development.sh
MIT