Welcome to the π¦ Microservices Suite project! This suite is a collection of Node.js microservices built using the 𦧠[mono-repo]() strategy and leveraging the yarn workspaces concept. Each microservice runs in its isolated Docker container
, and Kubernetes
orchestrates the deployment, providing scalability and efficiency.
To easily work with a @microservices-suite monorepo
you need to install Suite CLI. With Suite
you can easily scaffold,manage and automate your monorepo in development, CI as well as production. Check the installation guidelines in the README.md
section of the .suite-cli
root.
ββ node-microservices-suite
β ββ .suite-cli/
| β ββ cli/
| β β ββ scripts/
| β β ββ cli.js
| β β ββ package.json
| β β ββ README.md
β ββ gateways/
| β ββ apps/
| β | ββapp-1/
| β β | ββ webserver/
| β β | | ββDockerfile
| β β | | ββDockerfile.dev
| β β | | ββwebserver.conf
| β β | ββ docker-compose.yml
| β β | ββ docker-compose.dev.yml
| β β | ββ README.md
β ββ graphql/
| β ββ app-1/
| β β ββ apollo-server
| β β ββ README.md
β ββ data-persistence/
| β ββ db-1/
| β β ββ Dockerfile
| β β ββ README.md
β ββ k8s/
| β ββ service-1/
| β β ββ cluster-ip-service.yml
| β β ββ cluster-deployment.yml
| β β ββ ingress-service.yml
| β β ββ README.md
| ββ microservices/
| β ββ service-1/
| β β ββ src
| β β ββ .env
| β β ββ .env.dev
| β β ββ app.js
| β β ββ Dockerfile
ββ β β ββ Dockerfile.dev
| β β ββ ecosystem.config.js
| β β ββ index.js
| β β ββ package.json
| β β ββ task.json
| ββ shared/
| β ββ library-1/
| β β ββ APIError.js
| β β ββ catchAsync.js
| β β ββ index.js
| β β ββ package.json
| β β ββ pick.js
| β β ββ README.md
| β β ββ validate
β ββ tests/
| β ββ service-1/
| β β ββ e2e/
| β β ββ integration/
| β β ββ snapshot/
| β β ββ unit/
| β β ββ README.md
| ββ .gitignore
| ββ .npmrc
| ββ .yarnrc.yml
| ββ docker-compose.yml
| ββ package.json
| ββ production.yml
| ββ README.md
| ββ yarn.lock
Enforce DRY Principles:
Collaboration:
Centralized Development Chores:
.gitignore
centrally from the root directoryEasily Integrate Development Automation:
Code Sharing Anywhere:
yarn release
yarn add <@microservices-suite/foo>
yarn workspace @microservices-suite/<workspace-name> add @microservices-suite/<library>
Suite CLI
you could achieve the results with the following commands
suite release
suite add <@microservices-suite/foo>
suite -W <workspace-name> add @microservices-suite/<library>
Easily Containerize and Scale:
Yarn Workspaces:
Docker Containers:
~5MB
of real estate. That is why they are used inside your favourite smart watch βοΈ
. optimize image builds for Continuous Integration (CI)
and production
environments through the utilization of the slimmest possible images so that you dont bloat β οΈ your machine in dev and we have a lean server in prod.Multi-Stage Builds:
multi-stage builds
to optimize our image size.Hoisting and Symlinking:
DRY
(Don't Repeat Yourself) principle, they pose a threat to our objective of achieving minimized images. To mitigate this, we leverage no-hoisting and symlinked libraries
node_modules
generated by non-hoisted workspaces
. package.json
Welcome to our project! To ensure a smooth setup and development experience, ensure you have the following tools installed on your machine:
suite
: check the installation guidelines below..env
, .env.dev
and .env.staging
files and copy environment variables
from the .env.example
filecomponent
in our suite
jargon refers to a service
or application
. With @microservices-suite
you can create 1 or more services as well as applications.component-scoped
, giour strategy that enhances modularity and at the same time makes using the monorepo intuitive. Its is inspired by Single Responsibility
principle.cohessive
microservices aggregated
under the ./gateway/apps/
directory to create decoupled services to serve your client. An example is an Ecommerce app
. This app can have customer, supplier,orders and products
microservices under the ./microservices/
directory. These microservices are then referenced in docker-compose
file definitions placed under the ./gateway/apps/ecommerce-app/
directory. Other apps can be added to the ./gateway/apps
directory with their docker-compose
definitions and api-gateway configs(nginx/appache)
.kubernetes
and app-scoped k8s
configs are located under the ./k8s/
directory. Therefore the kubernetes configurations for our Ecommerce app will be located at ./k8s/ecommerce-app
development
& production
. Follow these steps to get your environment up and running:service_name
or app-name
from the workspace name found in the package.json "name":
property e.g
"name": "@microservices-suite/<component-name>"
suite
spins your app with kubectl
. You need to have minikube installed and kubectl. Otherwise defaults to docker composedocker-compose.<mode>
specified but this is not necessary with kubectl since we only run the development version of kubectl.
suite start [--kubectl,--mode]|[-km] <mode> <app-name...>
-v,--vanilla
command to start service(s) using node PM2
engine in production or nodemon
in any other mode:
suite start [--vanilla,--mode]|[-vm] <mode> <service_name...>
docker-compose -f docker-compose.yml -f production.yml up --build -d
docker-compose down
Contributions are welcome! If you'd like to contribute to the Microservices Suite project, please follow these guidelines:
Fork the repository and clone it to your local machine.
git clone https://github.com/microservices-suite/node-microservices-suite.git
Create a new branch for your feature or bug fix:
git checkout -b feat/<my-feature>
Make your changes and make sure that tests pass.
Before committing your changes, make sure it follows the conventional commits specification:
Push to the branch:
git push origin feat/<my-feature>
Submit a pull request detailing your changes.
Please ensure that your pull request adheres to the project's code style and conventions.
We would like to thank the developers and contributors to the following technologies used in this project: