nestifined-ms-framework
v0.0.5
Published
This is a NestJS project that offers a streamlined, sophisticated, and well-structured codebase for beginning a fresh microservice initiative.
Downloads
190
Readme
Description
nestifined-ms-framework is a refined and optimized codebase for setting up NestJS microservices.
Installation
$ yarn install
Running the app
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
Test
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
Linting
# lint the code
$ yarn run lint
# lint and fix the code
$ yarn run lint:fix
Docker
Building the Docker Image
docker build -t nestifined-ms-framework .
Running the Docker Container
docker run -p 3000:3000 --env-file .env nestifined-ms-framework
Kubernetes Deployment
Build and Push Docker Image
# Build the Docker image
docker build -t your-docker-username/nestifined-ms-framework:latest .
# Push the Docker image to a container registry
docker push your-docker-username/nestifined-ms-framework:latest
Apply Kubernetes Configurations
Development Environment
kubectl apply -k k8s/development/
Staging Environment
kubectl apply -k k8s/staging/
Production Environment
kubectl apply -k k8s/production/
Husky
Husky is used to manage Git hooks. The following hooks are configured:
pre-commit
: Runs lint-staged to lint and format code before committing.commit-msg
: Ensures commit messages follow the conventional commit format.post-commit
: Runs after a commit is made.pre-push
: Runs before pushing code to the repository.post-merge
: Runs after merging branches.post-checkout
: Runs after checking out a branch.prepare-commit-msg
: Runs before the commit message editor is opened.post-rewrite
: Runs after a commit is rewritten.pre-rebase
: Runs before rebasing branches.
Environment Variables
The application uses environment variables for configuration. Create a .env
file in the root of the project and add the following variables:
NODE_ENV=development
APP_NAME=MyApp
HOST=127.0.0.1
PORT=3000
CORS={"origin": ["http://example1.com", "/\\.example2\\.com$/"], "methods": ["GET", "POST"], "credentials": true}
API_PREFIX=api
RELEASE=1.0.0
S2S_TRANSPORT=RABBITMQ
S2S_REDIS_URL=redis://localhost:6379
S2S_RABBITMQ_URL=amqp://localhost:5672
S2S_RABBITMQ_QUEUE=my_queue
Support
This project is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Your Name
- Website - https://nestjs.com
- Twitter - @nestframework
License
This project is MIT licensed.