The complete nestjs boiler plate that uses typeorm
for postgresql mapping.
- Clone the repo
- Make copy of
.env.example
with db configuration credentials.
- Run
yarn start:dev
to run dev server - Run
yarn migration:generate -- <migration name>
to generate new migration - Run
yarn migration:run
to run migration - Run
yarn schema:drop
to reset the db schemas - Run
yarn seed:run
to run seeds
The template contains a pre-configured swagger-ui documentation accessed over localhost:3000/docs
$ npm install
Ensure also that Docker is installed on your work station
# development
$ npm run start:dev
or
nest start
# Debug/watch
$ npm run start:debug
# production
$ npm run build:prod
$ npm start
# Build the image
$ docker build -t nest-boiler-plate:v1.0 .
# Run the image interactively
$ docker run -it -p 3000:3000 nest-boiler-plate:v1.0
$ docker rmi -f $(docker images -a -q)
# Build the docker image
$ docker-compose build
# Start and login to the container
$ docker-compose up -d
$ docker-compose exec app sh
# Get the container ID
$ docker ps
# View logs
$ docker logs <container id>
# Enter the container (In alpine, use sh because bash is not installed by default)
$ docker exec -it <container id> /bin/sh
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov