https://github.com/cmmvio/docs.cmmv.io
The official documentation https://cmmv.io/docs
https://github.com/cmmvio/docs.cmmv.io
cmmv documentation nodejs typescript
Last synced: 4 months ago
JSON representation
The official documentation https://cmmv.io/docs
- Host: GitHub
- URL: https://github.com/cmmvio/docs.cmmv.io
- Owner: cmmvio
- License: mit
- Created: 2024-09-01T08:28:03.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-19T00:50:24.000Z (about 1 year ago)
- Last Synced: 2025-06-04T00:39:42.494Z (about 1 year ago)
- Topics: cmmv, documentation, nodejs, typescript
- Language: HTML
- Homepage: https://cmmv.io/docs
- Size: 8.33 MB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Contract-Model-Model-View (CMMV)
Building scalable and modular applications using contracts.
## Description
This project is compile source documentation in markdown format into the published format. The Repository contains [cmmv.io](https://cmmv.io) source code, the official CMMV documentation.
## Installing
Install project dependencies and start a local server with the following terminal commands:
```bash
$ pnpm install
$ pnpm run dev
```
Navigate to [http://localhost:3000/](http://localhost:3000/).
All pages are written in [markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) and located in the docs directory.
## Build
Use `pnpm run build` for a production build.
## Submodule Setup
The translations are stored in submodules. To initialize and update them, use the following command:
```bash
git submodule update --init --recursive
```
To push updates for submodules after making commits within the main project, use the following command to ensure the submodules are updated to their remote repositories:
```bash
git submodule foreach git push origin main
```
This command will execute git push origin main for each configured submodule in the project. Make sure you have committed the necessary changes inside the submodules before running this command.
If you want to pull the latest updates for submodules and synchronize them with the main repository, use:
```bash
git submodule foreach git pull origin main
```
## Start Processes
After initializing the submodules, start the PM2 processes using the appropriate ecosystem file for each language. Below is an example configuration for PM2:
```javascript
module.exports = {
apps: [
{
name: "docs-ptbr",
script: "pnpm run start",
env: {
DOCS_LANG: "ptbr",
PORT: 3001
}
}
]
};
```
Start the PM2 process with the following command:
```bash
pm2 start ecosystem-ptbr.config.js
```
## NGINX
The system is configured to handle languages using the `DOCS_LANG` environment variable. Each documentation process runs on an individual port and can be routed via subdomains using a load balancer like NGINX. Below is an example configuration:
```nginx
server {
listen 80 default_server;
server_name _;
location / {
proxy_buffering off;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_set_header Keep-Alive "";
proxy_set_header Proxy-Connection "keep-alive";
proxy_pass http://127.0.0.1:3000;
}
}
server {
listen 80;
server_name pt.cmmv.io;
location / {
proxy_buffering off;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_set_header Keep-Alive "";
proxy_set_header Proxy-Connection "keep-alive";
proxy_pass http://127.0.0.1:3001;
}
}
```
### Kubernetes
Create a deployment and service for the English version:
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: docs-en
labels:
app: docs
lang: en
spec:
replicas: 2
selector:
matchLabels:
app: docs
lang: en
template:
metadata:
labels:
app: docs
lang: en
spec:
containers:
- name: docs-en
image: your-docker-image:latest
ports:
- containerPort: 3000
env:
- name: DOCS_LANG
value: "en"
- name: PORT
value: "3000"
---
apiVersion: v1
kind: Service
metadata:
name: docs-en
spec:
selector:
app: docs
lang: en
ports:
- protocol: TCP
port: 80
targetPort: 3000
type: ClusterIP
```
Create a deployment and service for the Portuguese version:
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: docs-ptbr
labels:
app: docs
lang: ptbr
spec:
replicas: 2
selector:
matchLabels:
app: docs
lang: ptbr
template:
metadata:
labels:
app: docs
lang: ptbr
spec:
containers:
- name: docs-ptbr
image: your-docker-image:latest
ports:
- containerPort: 3001
env:
- name: DOCS_LANG
value: "ptbr"
- name: PORT
value: "3001"
---
apiVersion: v1
kind: Service
metadata:
name: docs-ptbr
spec:
selector:
app: docs
lang: ptbr
ports:
- protocol: TCP
port: 80
targetPort: 3001
type: ClusterIP
```
With this setup, the English documentation will be available at `http://cmmv.io` and the Portuguese documentation at `http://pt.cmmv.io`.