Starter kit project made with Nest that demonstrates CRUD user, JWT authentication, CRUD posts and e2e tests.
- NestJS 11.x
- TypeScript 5.7
- sequelize-typescript 2.x (ORM) + Sequelize 6.x
- PostgreSQL 8.x driver (pg)
- JWT Authentication with Passport
- Jest 30.x for testing
- Swagger 11.x for API documentation
- ESLint 9.x + Prettier 3.x for code quality
- bcrypt 6.x for password hashing
- Node.js (>= 20.0.0) - Required by NestJS 11
- npm (>= 9.0.0)
- PostgreSQL (>= 10.0.0) - Recommended >= 12.0.0 for best compatibility
$ npm install
PostgreSQL database connection options are shown in the following table:
Option | Development | Test |
---|---|---|
Host | localhost | localhost |
Port | 5432 | 5432 |
Username | postgres | postgres |
Password | postgres | postgres |
Database | nest | nest_test |
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
# formatting code
$ npm run format
# run linter
$ npm run lint
# fix linting issues
$ npm run lint:fix
# unit tests
$ npm run test
# watch mode for tests
$ npm run test:watch
# test coverage
$ npm run test:cov
# e2e tests
$ npm run test:e2e
# debug tests
$ npm run test:debug
# create database
$ npm run db:create
# run migrations
$ npm run db:migrate
# run seeders
$ npm run db:seed-dev
# reset database
$ npm run db:reset
# drop database
$ npm run db:drop
# build the application
$ npm run build
# run in production mode
NODE_ENV=production \
DATABASE_HOST=db.host.com \
DATABASE_PORT=5432 \
DATABASE_USER=user \
DATABASE_PASSWORD=pass \
DATABASE_DATABASE=database \
JWT_PRIVATE_KEY=jwtPrivateKey \
npm run start:prod
This project uses the Nest swagger module for API documentation. NestJS Swagger - www.swagger.io
Swagger docs will be available at localhost:3000/documentation