Starter kit project made with Nest and nestjs-sequelize-typescript that demonstrate CRUD use and e2e tests.
- sequelize-typescript (ORM) + MySQL
- Jest
- Swagger
$ npm install
Run mysql container
docker-compose up
Connect MySQL console
docker exec -it <CONTAINER_ID> mysql -uroot -p
Create account and set authorization
CREATE USER 'root'@'172.17.0.1' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'172.17.0.1' WITH GRANT OPTION;
Apply and exit
flush privileges;
exit
MySQL database connection options are shown in the following table:
Option | Local(Test) |
---|---|
Host | localhost |
Port | 3306 |
Username | user |
Password | password |
Database | database |
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# e2e tests
$ npm run test:e2e
NODE_ENV=production \
URL=host.com \
PORT=3000 \
DB_HOST=db.host.com \
DB_PORT=3306 \
DB_USER=user \
DB_PASSWORD=pass \
DB_DATABASE=database \
ts-node -r tsconfig-paths/register src/main.ts
This project uses the Nest swagger module for API documentation. NestJS Swagger - www.swagger.io
Swagger docs will be available at localhost:3000/docs
- Authentication
- Authorization
- Helmet
- CORS
- Microservices