micro-service-maker 1.1.2 โ 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# ๐ Project architecture
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ๐ Project Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
microservice/
|
|
11
|
+
โโโ services/
|
|
12
|
+
โ โโโ gateway/ # Main gateway application
|
|
13
|
+
โโโ src/
|
|
14
|
+
โ โโโ app.ts # Configurations of concurrently running services
|
|
15
|
+
โ โโโ servers.json # List of all services
|
|
16
|
+
โ โโโ install-all.ts # Installs all services' dependencies
|
|
17
|
+
โ โโโ uninstall-all.ts # Removes all services' node_modules
|
|
18
|
+
โโโ dist/ # Compiled JavaScript
|
|
19
|
+
โโโ package.json
|
|
20
|
+
โโโ tsconfig.json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ๐ฆ Scripts
|
|
26
|
+
|
|
27
|
+
| Command | Description |
|
|
28
|
+
|--------|-------------|
|
|
29
|
+
| `npx msm` | ๐ง Create a new service inside the `services/` folder. You will be prompted to enter a service name. |
|
|
30
|
+
| `npm run install-all` | ๐ฆ Installs dependencies in all services by running. |
|
|
31
|
+
| `npm run uninstall-all` | โ Deletes `node_modules` from each service folder. |
|
|
32
|
+
| `npm run dev` | ๐ ๏ธ Runs the gateway in development mode using `ts-node-dev`. |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## ๐งฐ Tech Stack
|
|
37
|
+
|
|
38
|
+
- **Node.js**
|
|
39
|
+
- **Express.js**
|
|
40
|
+
- **TypeScript**
|
|
41
|
+
- **Mongoose**
|
|
42
|
+
- **ts-node-dev**
|
|
43
|
+
- **CMP (Service Generator)**
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## ๐งช Creating a New Service
|
|
48
|
+
|
|
49
|
+
To scaffold a new microservice:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx cmp
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
๐ Then type the desired **service name** when prompted.
|
|
56
|
+
๐ The new service will be generated automatically inside the `services/` folder.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## ๐ณ Docker Compose
|
|
61
|
+
|
|
62
|
+
This project comes with built-in support for Redis and RabbitMQ using Docker Compose.
|
|
63
|
+
|
|
64
|
+
### `docker-compose.yml`
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
version: '3.9'
|
|
68
|
+
|
|
69
|
+
services:
|
|
70
|
+
redis:
|
|
71
|
+
image: redis:7-alpine
|
|
72
|
+
container_name: redis
|
|
73
|
+
restart: unless-stopped
|
|
74
|
+
ports:
|
|
75
|
+
- "6379:6379"
|
|
76
|
+
volumes:
|
|
77
|
+
- redis_data:/data
|
|
78
|
+
|
|
79
|
+
rabbitmq:
|
|
80
|
+
image: rabbitmq:3-management
|
|
81
|
+
container_name: rabbitmq
|
|
82
|
+
restart: unless-stopped
|
|
83
|
+
ports:
|
|
84
|
+
- "5672:5672"
|
|
85
|
+
- "15672:15672"
|
|
86
|
+
environment:
|
|
87
|
+
RABBITMQ_DEFAULT_USER: admin
|
|
88
|
+
RABBITMQ_DEFAULT_PASS: admin
|
|
89
|
+
|
|
90
|
+
volumes:
|
|
91
|
+
redis_data:
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To start services:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
docker-compose up -d
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
To stop services:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
docker-compose down
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## ๐ Prerequisites
|
|
109
|
+
|
|
110
|
+
- Node.js `v16+`
|
|
111
|
+
- npm
|
|
112
|
+
- Docker & Docker Compose
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## ๐จโ๐ป Maintained by
|
|
117
|
+
|
|
118
|
+
**CodingOtt Systems**
|
|
119
|
+
๐ [Satyam Sharma](https://github.com/sharmasatyam121104-devloper)
|
|
120
|
+
|
|
121
|
+
---
|