tree -L 8 -I 'node_modules|.git|dist'
echo "20" > .nvmrc
nvm install
nvm use
rm -rf node_modules
rm -rf dist
rm -rf ~/.pnpm-store
pnpm install
npm rebuild bcrypt
find node_modules -name bcrypt_lib.node
pnpm prisma:generate:mysql
pnpm prisma:generate:mongo
pnpm prisma:generate
## to install redis server locally
docker run -d --name box-redis -p 6379:6379 redis:7
docker compose down -v
docker compose --env-file .env.docker up -d
docker compose --env-file .env.docker up -d box-mongodb-init
docker compose ps
## to start redis server
docker start box-redis
## to stop redis server
docker stop box-redis
## to remove redis server
docker rm -f box-redis
# test redis connection
redis-cli -h 127.0.0.1 -p 6379 ping
# Generate a new module
nest g module mgnt-backend/feature/video-medias --project box-mgnt-api
docker run -d \
--name box-rabbitmq \
-p 5672:5672 \
-p 15672:15672 \
-e RABBITMQ_DEFAULT_USER=boxrabbit \
-e RABBITMQ_DEFAULT_PASS='BoxRabbit#2025' \
rabbitmq:3.13-management
Docker Compose now brings up Redis, RabbitMQ, MongoDB (with a single-node replica set), MySQL, and all three APIs with multi-stage builds, shared networking, healthchecks, and service-healthy dependencies so docker compose up -d gives you the full stack in one go.
Compose orchestrates Redis, RabbitMQ, Mongo, MySQL, and the mgnt/app/stats builds with named volumes, healthchecks, env_file wiring, single box-network, and service_healthy dependencies so each API waits for infra services (docker-compose.yml (lines 3-163)). Dockerfiles for each API reuse the workspace cache, run the respective pnpm build:* target, and ship only the production runtime to keep images small (Dockerfile (lines 1-30), Dockerfile (lines 1-30), Dockerfile (lines 1-30)). .env.docker centralizes database, Redis, and RabbitMQ credentials/routing so the APIs stay consistent while allowing per-service overrides (ports, Redis DB, TLS) in Compose (.env.docker (lines 1-30)). Mongo init script starts mongod --replSet rs0 --bind_ip_all and ensures rs0 is initiated only once before touching the box_admin and box_stats logical databases (init-repl.js (lines 1-56)). Docs explain the one-command workflow, helper commands, and stack highlights for any teammate who needs to get the stack running (DOCKER.md (lines 1-30)). Tests: Not run (Docker stack not started).
Next steps:
Run docker compose up -d (or docker compose up -d --build after code changes) to verify the stack builds and services become healthy. Use docker compose exec box-mongodb mongosh --eval 'rs.status()' or docker compose logs -f box-mgnt-api if you need to inspect the replica set or API startup.
# RabbitMQ Management UI Access
http://localhost:15672
Username: boxrabbit
Password: BoxRabbit#2025
# create RabbitMQ User and vhost
rabbitmqctl add_user boxrabbit 'BoxRabbit#2025'
# give administrator tag to user
rabbitmqctl set_user_tags boxrabbit administrator
# Grant full permissions on the default / vhost
rabbitmqctl set*permissions -p / boxrabbit ".*" ".\_" ".\*"
# Enable it with:
rabbitmq-plugins enable rabbitmq_management
systemctl restart rabbitmq-server
# Or generate a complete resource (module + controller + service + DTOs)
nest g resource mgnt-backend/feature/video-medias --project box-mgnt-api
## generate secret
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
video-medias/
├── dto/
│ ├── create-video-media.dto.ts
│ └── update-video-media.dto.ts
├── entities/
│ └── video-media.entity.ts
├── video-medias.controller.ts
├── video-medias.service.ts
└── video-medias.module.ts