A progressive Node.js framework for building efficient and scalable server-side applications.
- RESTful API: api.techcell.cloud
- Documentations: docs.techcell.cloud
- Source code docs: architecture.techcell.cloud
This application is built using a microservices architecture with Nest and RabbitMQ. It includes the following features:
-
Infrastructure:
- Monorepo with Nest Monorepo
- Containerization with Docker and Docker Compose
- Message Broker with RabbitMQ
- Cache with Redis
- Database with MongoDB
- Job queue with BullMQ
- Deploy with Google Cloud, Azure, and other cloud services
- CI/CD with Github Actions
- Reverse proxy with Nginx
- SSL with Let's Encrypt, ZeroSSL, and Cloudflare
- High availability with HAProxy
-
Features:
- User, Profile, Product, Order, Category, Notification, Attribute, Cart, Otp management ...
- Transaction order with Mongodb transaction and distributed lock with Redlock
- Multi languages with i18n
- Authentication with JWT
- Login, sign up with Credentials (email verified), Google
- Storage with Cloudinary
- Custom domain emails with Sendgrid, Resend, and Gmail
- Notifications with Socket.io, using job queue to send notifications
- Cron jobs to clean unused data
- Payment integration with VNPay
- Shipping integration with GiaoHangNhanh
- Docker, docker-compose ...
- Or custom install:
- Nodejs: nodejs 18
- Package Manager: yarn
- Message Broker: RabbitMQ
- Database: Mongodb with replica set mode or mongodb atlas
- Cache: Redis
- Ubuntu or WSL (Windows subsystems for Linux) is recommended for both development and production
- Windows is not recommended, can use in development not for production
- Copy the .env.example and rename to .env.
- Change the default values to your own.
- Core services:
- Database
- Message Broker
- Reverse proxy
- Application services (each folder in
apps
folder is a service):- api
- auth
- search
- .etc..
yarn up:core # start core services
service_name
- optional: is the name of the service you want to start, by default it will start all services
yarn up:prod <service_name> # start all services in production mode
service_name
- optional: is the name of the service you want to start, by default it will start all services
yarn down:prod <service_name> # stop all services
# or
yarn down:core # stop core services
service_name
- optional: is the name of the service you want to start, by default it will start all services
yarn restart:prod <service_name> # restart and rebuild all services
# or
yarn restart:core # restart and rebuild core services
service_name
- optional: is the name of the service you want to start, by default it will start all services- Update the services to the latest version from the docker registry
- Make sure your github repository is up to date
git pull # update the repository
yarn update:prod <service_name> # update core services
- Make sure all the following core services have been installed and run successfully
- RabbitMQ: port 5672
- Mongodb: port 27017, replica set mode
- Redis: port 6379
- Or you can run core services in docker and run app services manually
- Or you can using cloud services like mongodb atlas, redis cloud, rabbitmq cloud
service_name
- optional: is the name of the service you want to start, by default it isapi
service
# You can run core services in docker and run app services manually
yarn start <service_name> # start the service as normal mode
yarn start:dev <service_name> # start the service as development mode
yarn start:prod <service_name> # start the service as production mode
# Just CTRL-C to stop the service
- Check what is running on docker:
docker ps -a
- Get the log of a container:
docker logs <CONTAINER_ID> # get logs
docker logs -f <CONTAINER_ID> # get logs realtime
# Remember to replace `<CONTAINER_ID>` with the actual ID of the container you want to inspect.
- To remove all containers, volumes, and images that are not currently running, you can use the following commands:
docker container prune # remove all stopped containers
docker volume prune # remove all unused volumes
docker image prune # remove all unused images
# or just one
docker system prune -a # remove all stopped containers and unused volumes, images
Nest is MIT licensed.