Just a simple NestJS template for me.
This repo uses node v20.11.0
and npm v10.2.4
. These can be installed by using NVM, node version manager, to run the command:
$ nvm use
$ nvm install
Create a .env
file from the local example (.env.example
) and fill in the missing values by pinging another dev.
Once the file are defined you can start the app.
Run the following commands to clone the repo and install dependencies:
$ git clone [email protected]:oscarbotteri/nestjs-swagger-auth0-typeorm-starter.git
¢ cd nestjs-swagger-auth0-typeorm-starter
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
To perform unit tests and e2e tests, we are using NestJS's testing utility library and golevelup/ts-jest
to create mocks easily.
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
To interact with TypeORM from the comand line, we created some npm scripts to run migrations, seeds, etc:
# create migration to create a new table
$ npm run db:migrate:create ./database/migrations/CreateUsersTable
# Run all migrations
$ npm run db:migrate:run
# Populate DB with mock data
$ npm run db:seed
# Rolllback all migrations
$ npm run db:reset