- Getting Started
- What's in the box ?
- Running the app
- Code scaffolding
- Build
- Test
- Further help
- Useful Docker commands
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
What things you need to install the software and how to install them :
-
Clone the git repository
git clone https://github.com/smarlhens/nest-boilerplate.git
-
Go into the project directory
cd nest-boilerplate/
-
Checkout working branch
git checkout <branch>
-
Install NPM dependencies
npm i
-
Copy
.env.dist
to.env
cp .env.dist .env
-
Replace the values of the variables with your own
-
Create Docker images and launch them
docker-compose up -d --build
CircleCI automates your software builds, tests, and deployments.
CircleCI pipeline file: .circleci/config.yml
.
For more configuration options and details, see the configuration docs.
commitizen is a command line utility that makes it easier to create commit messages following the conventional commit format specification.
Use git cz
instead of git commit
to use commitizen.
Configuration file: .czrc
.
commitlint checks if your commit messages meet the conventional commit format.
Configuration file: .commitlintrc.json
.
In general the pattern mostly looks like this:
type(scope?): subject #scope is optional
Are you a good commitizen
?
Compose file: docker-compose.yml
.
Containers :
- PostgreSQL 14
- pgAdmin 6
Compose file uses .env
.
ESLint is a fully pluggable tool for identifying and reporting on patterns in JavaScript.
Configuration file: .eslintrc.js
.
For more configuration options and details, see the configuration docs.
GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.
CI workflow file: .github/workflows/ci.yml
.
Husky is a package that helps you create Git hooks easily.
Configuration folder: .husky
.
Lint-staged is a Node.js script that allows you to run arbitrary scripts against currently staged files.
Configuration file: .lintstagedrc.json
.
Prettier is an opinionated code formatter.
Configuration file: .prettierrc.json
.
Ignore file: .prettierignore
.
For more configuration options and details, see the configuration docs.
npm run start
npm run start:dev
npm run start:prod
Run nest generate|g <schematic> <name> [options]
to generate a new Nest Element.
Run npm run build
to build the project. The build artifacts will be stored in the dist/
directory.
npm run test
npm run test:e2e
npm run test:cov
To get more help on the Nest CLI use nest --help
or go check out the Nest CLI README.
-
If you want to check that all containers are up :
docker-compose ps
-
Other Docker commands :
# Start Docker docker-compose start # Restart Docker docker-compose restart # Stop Docker docker-compose stop # Delete all containers docker rm $(docker ps -aq) # Delete all images docker rmi $(docker images -q)
-
How to get a Docker container's IP address from the host ?
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container> docker inspect $(docker ps -f name=<service> -q) | grep IPAddress