micro-service-maker
v1.1.6
Published
This monorepo serves as the main entry point and controller for all microservices under a single gateway. It uses TypeScript, Express, and custom tooling to streamline development.
Downloads
41
Readme
🚀 Project architecture
This monorepo serves as the main entry point and controller for all microservices under a single gateway. It uses TypeScript, Express, and custom tooling to streamline development.
📁 Project Structure
microservice/
├── services/
│ └── gateway/ # Main gateway application
├── src/
│ ├── app.ts # Configurations of concurrently running services
│ ├── servers.json # List of all services
│ ├── install-all.ts # Installs all services' dependencies
│ └── uninstall-all.ts # Removes all services' node_modules
├── dist/ # Compiled JavaScript
├── package.json
└── tsconfig.jsonRecommended:
To avoid configuration mistakes and save setup time, it is recommended to clone the ready-made repository from the link below instead of creating the project structure manually.
After cloning this repository to your system, run the following command in the root directory to install the micro-service-maker package:
npm install micro-service-maker⬇️ After this section, you can continue with the next process or steps as required.
📦 Scripts
| Command | Description |
|--------|-------------|
| npx msm | 🔧 Create a new service inside the services/ folder. You will be prompted to enter a service name. |
| npm run install-all | 📦 Installs dependencies in all services by running. |
| npm run uninstall-all | ❌ Deletes node_modules from each service folder. |
| npm run dev | 🛠️ Runs the gateway in development mode using ts-node-dev. |
🧰 Tech Stack
- Node.js
- Express.js
- TypeScript
- Mongoose
- ts-node-dev
- msm (Service Generator)
🧪 Creating a New Service
To scaffold a new microservice:
npx msm👉 Then type the desired service name when prompted.
📁 The new service will be generated automatically inside the services/ folder.
🐳 Docker Compose
This project comes with built-in support for Redis and RabbitMQ using Docker Compose.
docker-compose.yml
version: '3.9'
services:
redis:
image: redis:7-alpine
container_name: redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
restart: unless-stopped
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin
volumes:
redis_data:To start services:
docker-compose up -dTo stop services:
docker-compose down📋 Prerequisites
- Node.js
v16+ - npm
- Docker & Docker Compose
👨💻 Maintained by
Satyam Sharma
🔗 Satyam Sharma
