Skip to content

Commit 2f03104

Browse files
committed
refactor: update readme
1 parent 73ff584 commit 2f03104

File tree

4 files changed

+322
-65
lines changed

4 files changed

+322
-65
lines changed

README.md

Lines changed: 118 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -7,71 +7,124 @@ To easily work with a `@microservices-suite monorepo` you need to install [Suite
77

88
## Project file structure
99
```sequence
10-
├─ node-microservices-suite
11-
│ ├─ .suite-cli/
12-
| │ ├─ cli/
13-
| │ │ ├─ scripts/
14-
| │ │ ├─ cli.js
15-
| │ │ ├─ package.json
16-
| │ │ ├─ README.md
17-
│ ├─ docker/
18-
| │ ├─ apps/
19-
| │ | ├─app-1/
20-
| │ │ | ├─ data/
21-
| │ │ | ├─ krakend/
22-
| │ │ | ├─ webserver/
23-
| │ │ | | ├─Dockerfile
24-
| │ │ | | ├─Dockerfile.dev
25-
| │ │ | | ├─webserver.conf
26-
| │ │ | ├─ docker-compose.yml
27-
| │ │ | ├─ docker-compose.dev.yml
28-
| │ │ | ├─ README.md
29-
│ ├─ graphql/
30-
| │ ├─ app-1/
31-
| │ │ ├─ apollo-server
32-
| │ │ ├─ README.md
33-
│ ├─ k8s/
34-
| │ ├─ service-1/
35-
| │ │ ├─ cluster-ip-service.yml
36-
| │ │ ├─ cluster-deployment.yml
37-
| │ │ ├─ ingress-service.yml
38-
| │ │ ├─ README.md
39-
| ├─ microservices/
40-
| │ ├─ service-1/
41-
| │ │ ├─ src
42-
| │ │ ├─ .env
43-
| │ │ ├─ .env.dev
44-
| │ │ ├─ app.js
45-
| │ │ ├─ Dockerfile
46-
├─ │ │ ├─ Dockerfile.dev
47-
| │ │ ├─ ecosystem.config.js
48-
| │ │ ├─ index.js
49-
| │ │ ├─ package.json
50-
| │ │ ├─ task.json
51-
| ├─ shared/
52-
| │ ├─ library-1/
53-
| │ │ ├─ APIError.js
54-
| │ │ ├─ catchAsync.js
55-
| │ │ ├─ index.js
56-
| │ │ ├─ package.json
57-
| │ │ ├─ pick.js
58-
| │ │ ├─ README.md
59-
| │ │ ├─ validate
60-
│ ├─ tests/
61-
| │ ├─ service-1/
62-
| │ │ ├─ e2e/
63-
| │ │ ├─ integration/
64-
| │ │ ├─ snapshot/
65-
| │ │ ├─ unit/
66-
| │ │ ├─ README.md
67-
| ├─ .gitignore
68-
| ├─ .npmrc
69-
| ├─ .yarnrc.yml
70-
| ├─ docker-compose.yml
71-
| ├─ package.json
72-
| ├─ production.yml
73-
| ├─ README.md
74-
| ├─ yarn.lock
10+
.
11+
├── CHANGELOG.md
12+
├── CODE_OF_CONDUCT.md
13+
├── CONTRIBUTING.md
14+
├── LICENSE
15+
├── README.md
16+
├── docker
17+
│   ├── README.md
18+
│   └── apps
19+
│   └── nyati
20+
│   ├── docker-compose.dev.yml
21+
│   ├── docker-compose.yml
22+
│   ├── krakend
23+
│   │   └── krakend.json
24+
│   └── nginx
25+
│   ├── Dockerfile
26+
│   ├── Dockerfile.dev
27+
│   └── default.conf
28+
├── graphql
29+
│   ├── README.md
30+
│   └── nyati-app
31+
│   └── appollo-server.yml
32+
├── k8s
33+
│   ├── broker
34+
│   │   ├── clusterIp.yaml
35+
│   │   ├── deployment.yaml
36+
│   │   ├── loadBalancer.yaml
37+
│   │   └── nodePort.yaml
38+
│   ├── ingress
39+
│   │   └── ingress.yaml
40+
│   └── ns
41+
│   └── default
42+
│   └── nyati
43+
│   ├── combo.yaml
44+
│   └── payment
45+
│   ├── configMap.yaml
46+
│   ├── db
47+
│   │   ├── clusterIp.yaml
48+
│   │   ├── deployment.yaml
49+
│   │   ├── loadBalancer.yaml
50+
│   │   └── nodePort.yaml
51+
│   ├── secret.yaml
52+
│   └── server
53+
│   ├── clusterIp.yaml
54+
│   ├── deployment.yaml
55+
│   ├── loadBalancer.yaml
56+
│   └── nodePort.yaml
57+
├── microservices
58+
│   └── payment
59+
│   ├── Dockerfile.dev
60+
│   ├── ecosystem.config.js
61+
│   ├── index.js
62+
│   ├── package.json
63+
│   └── src
64+
│   ├── controllers
65+
│   │   ├── controllers.js
66+
│   │   └── index.js
67+
│   ├── models
68+
│   │   ├── index.js
69+
│   │   └── models.js
70+
│   ├── routes
71+
│   │   ├── index.js
72+
│   │   └── routes.js
73+
│   ├── services
74+
│   │   ├── index.js
75+
│   │   └── services.js
76+
│   └── subscriber
77+
│   ├── index.js
78+
│   └── subscriber.js
79+
├── package.json
80+
├── production.yml
81+
├── shared
82+
│   ├── README.md
83+
│   ├── broker
84+
│   │   ├── README.md
85+
│   │   ├── package.json
86+
│   │   └── rabbitmq
87+
│   │   ├── exchange.js
88+
│   │   ├── index.js
89+
│   │   ├── publisher.js
90+
│   │   ├── subscriber.js
91+
│   │   └── worker.queue.js
92+
│   ├── config
93+
│   │   ├── README.md
94+
│   │   ├── config.js
95+
│   │   ├── index.js
96+
│   │   ├── logger.js
97+
│   │   ├── morgan.js
98+
│   │   └── package.json
99+
│   ├── constants
100+
│   │   ├── README.md
101+
│   │   └── package.json
102+
│   ├── errors
103+
│   │   ├── README.md
104+
│   │   ├── errors.handler.js
105+
│   │   ├── index.js
106+
│   │   └── package.json
107+
│   ├── middlewares
108+
│   │   ├── README.md
109+
│   │   └── package.json
110+
│   └── utilities
111+
│   ├── APIError.js
112+
│   ├── README.md
113+
│   ├── asyncErrorHandler.js
114+
│   ├── index.js
115+
│   ├── package.json
116+
│   ├── pick.js
117+
│   └── validate.js
118+
├── suite.config
119+
├── suite.html
120+
├── suite.json
121+
└── tests
122+
├── README.md
123+
└── cli
124+
└── scripts
125+
└── retrieveWorkspaceName.test.js
126+
127+
36 directories, 80 files
75128
```
76129
## Monorepo strategy benefits for microservices:
77130

docker/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Docker Application Setup
2+
3+
This directory contains configurations and assets for Docker-based applications, generated interactively through the **suiteCLI**. By default, **Krakend** is configured as the API gateway, and users can choose microservices from the existing `microservices` directory created earlier with the `suite generate service` command.
4+
5+
## Interactive Setup with suiteCLI
6+
7+
The `suite generate app` command prompts users to select configurations for their application, including web servers, API gateways, and available microservices. **Krakend** is the default API gateway, with options to configure Nginx as a reverse proxy.
8+
9+
Users can also select any microservices they have created in the `microservices` directory to integrate with their application.
10+
11+
## Folder Structure
12+
13+
After generating an app, your project folder structure will look like this:
14+
15+
```sequence
16+
docker
17+
├── README.md
18+
└── apps
19+
└── <your_app>
20+
├── data
21+
├── docker-compose.dev.yml
22+
├── docker-compose.yml
23+
├── krakend
24+
│   └── krakend.json
25+
└── nginx
26+
├── Dockerfile
27+
├── Dockerfile.dev
28+
└── default.conf
29+
30+
```
31+
32+
### Directory and File Descriptions
33+
34+
#### Docker Structure
35+
36+
- **`<your_app>/`**: Directory for a specific application’s Docker configuration files, tailored based on your selections.
37+
38+
- **`data/`**: Holds application data or volumes, set up if persistence is selected.
39+
40+
- **`docker-compose.dev.yml`**: Development Docker Compose configuration, enabling hot-reloading and other development features.
41+
42+
- **`docker-compose.yml`**: Production Docker Compose configuration, optimized for deployment.
43+
44+
- **`krakend/krakend.json`**: Configuration file for the Krakend API Gateway, defining routes and backend integrations with selected microservices.
45+
46+
- **`nginx/`**: Contains Nginx configurations if Nginx is selected as a reverse proxy.
47+
48+
- **`Dockerfile`**: Production Dockerfile for Nginx.
49+
50+
- **`Dockerfile.dev`**: Development Dockerfile for Nginx.
51+
52+
- **`default.conf`**: Nginx server configuration for routing and proxying.
53+
54+
## Usage
55+
56+
### Running the Interactive Command
57+
58+
To scaffold a new application with Krakend, selected microservices, and deployment options, run:
59+
60+
```bash
61+
suiteCLI generate app --name <your_app>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Microservices Suite
2+
3+
## API-GATEWAY Package. Remember to provide redundancy to eliminate the `single point of failure`
4+
5+
The API-GATEWAY serves as the front-facing layer of our Microservices Suite, designed to efficiently route client requests to the appropriate internal service. By abstracting the internal services network from the client, it exposes a singular endpoint that consolidates and manages access to your suite of APIs.
6+
7+
### Key Features
8+
9+
- **Unified Endpoint**: Offers a single endpoint for all client-side applications to interact with, simplifying API consumption and integration.
10+
- **Request Routing**: Dynamically routes client requests to the appropriate microservice based on the request path, method, and other criteria.
11+
- **Response Aggregation**: Collects responses from various microservices and consolidates them into a single response for the client, facilitating smoother interaction patterns.
12+
- **Security and Abstraction**: Enhances security by hiding the internal structure of the microservices network from the clients.
13+
14+
## Getting Started
15+
16+
### Prerequisites
17+
18+
Before setting up the API-GATEWAY, ensure that you have the following:
19+
- A current version of Node.js installed (preferably version 12.x or newer).
20+
- Basic knowledge of how microservices architecture operates.
21+
- Access to the microservices that the gateway will route requests to.
22+
23+
### Installation
24+
25+
To install the API-GATEWAY, follow these steps:
26+
27+
<!-- TODO: document usage here -->
28+
29+
### Configuration
30+
31+
<!-- TODO: build on this -->
32+
Configure the gateway by setting up environment variables or editing a `.env` file in the root directory of the API-GATEWAY project. Key configurations include the gateway's port, microservices endpoints, and any security credentials like API keys.
33+
34+
### Running the Gateway
35+
36+
<!-- TODO: build on this but ideally is supposed to be run just like any other service in our ms-suite -->
37+
38+
39+
<!-- Handling client requests -->
40+
41+
<!-- Microfrontend client request -->
42+
43+
<!-- Monolithic client request -->
44+
45+
### Handling client requests
46+
47+
#### Microfrontend client
48+
- Microservices
49+
50+
#### Monolithic client
51+
- Monolith client apps which are the traditional frontend applications
52+
- They make requests to the server by making a http request to one `base_url/<endpoint>`
53+
- In microservices architecture they will make a call to this service(`the gateway`) which sits in front of all her services
54+
- On getting the request the `API-Gateway` then `decomposes` the request into different `api calls` that are routed internally to different services.
55+
- On completion the gateway aggregates/consolidates the response into one and returns back to the monolithic application

k8s/README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Microservices Suite CLI
2+
3+
## Kubernetes Orchestration and Application Scaffolding
4+
5+
The **suiteCLI** tool streamlines the development workflow by automatically generating Kubernetes configurations for new applications. With the `suite generate app` command, developers can scaffold microservices and their required configurations effortlessly, accelerating setup and deployment in Kubernetes environments.
6+
7+
### Overview
8+
9+
The `suite generate app` command creates essential configurations in a structured, scalable way. It injects all necessary components within the folder structure, making it easier to manage configurations across different microservices. The CLI follows a modular approach, organizing Kubernetes and service files to support the entire development lifecycle.
10+
11+
### Folder Structure
12+
13+
After running `suite generate app`, your project will be structured as follows:
14+
```sequence
15+
k8s
16+
├── README.md
17+
├── broker
18+
│   ├── clusterIp.yaml
19+
│   ├── deployment.yaml
20+
│   ├── loadBalancer.yaml
21+
│   └── nodePort.yaml
22+
├── ingress
23+
│   └── ingress.yaml
24+
└── ns
25+
└── default
26+
└── <your_app>
27+
├── combo.yaml
28+
└── <app_service>
29+
├── configMap.yaml
30+
├── db
31+
│   ├── clusterIp.yaml
32+
│   ├── deployment.yaml
33+
│   ├── loadBalancer.yaml
34+
│   └── nodePort.yaml
35+
├── secret.yaml
36+
└── server
37+
├── clusterIp.yaml
38+
├── deployment.yaml
39+
├── loadBalancer.yaml
40+
└── nodePort.yaml
41+
42+
```
43+
44+
45+
### Directory and File Descriptions
46+
47+
- **`k8s/`**: Contains all Kubernetes configurations for deploying your application.
48+
49+
- **`broker/`**: Houses service configurations, allowing various access methods (ClusterIP, LoadBalancer, NodePort) for internal and external communication.
50+
51+
- **`ingress/`**: Includes Ingress configurations for routing external traffic to your services.
52+
53+
- **`ns/default/<your_app>/`**: Contains namespace-specific configurations for your application.
54+
55+
- **`combo.yaml`**: Central configuration that ties together all components for deployment.
56+
57+
- **`<app_service>/`**: Directory for a specific application service, including:
58+
59+
- **`configMap.yaml`**: Configuration data for the application service.
60+
61+
- **`db/`**: Contains database service configurations with various access methods.
62+
63+
- **`clusterIp.yaml`**: Configuration for accessing the database via ClusterIP.
64+
65+
- **`deployment.yaml`**: Deployment configuration for the database service.
66+
67+
- **`loadBalancer.yaml`**: Configuration for exposing the database service via LoadBalancer.
68+
69+
- **`nodePort.yaml`**: Configuration for exposing the database service via NodePort.
70+
71+
- **`secret.yaml`**: Contains sensitive data (e.g., passwords) required by the application service.
72+
73+
- **`server/`**: Contains server-related configurations.
74+
75+
- **`clusterIp.yaml`**: Configuration for accessing the server via ClusterIP.
76+
77+
- **`deployment.yaml`**: Deployment configuration for the server service.
78+
79+
- **`loadBalancer.yaml`**: Configuration for exposing the server service via LoadBalancer.
80+
81+
- **`nodePort.yaml`**: Configuration for exposing the server service via NodePort.
82+
83+
### Usage
84+
85+
To scaffold a new application with the necessary Kubernetes configurations, run:
86+
87+
```bash
88+
suiteCLI generate app --name <your_app>

0 commit comments

Comments
 (0)