NestJS REST API templete with TypeORM, Jest, OAuth, Logging, Swagger docs.
NestJS REST API templete(boilerplate) for quick start new project.
Support kakao & naver OAuth, common in korea.
Include example of CI/CD, deploy to AWS after testing. (by Github Actions)
- Database(TypeORM)
- Support DB
- MySQL
- Postgres
- Seeding
- Local Authentication
- OAuth(Social Login)
- Customizing user's roles(Admin, User...)
- JWT Authorization
- Slack Alert when throw ERROR
- Logging(winston)
- Swagger
- Unit Test(Jest)
- E2E Test
- File upload
- Support Cloud
- AWS S3
- CI
- Example Domain(Board with content)
# Create `.env` file with reference to `.env.example`
cp .env.example .env
- Especially,
SUPER_ADMIN
will be a master account by seeding, so please decide carefully.
# 1. Install Nest CLI
npm i -g @nestjs/cli
# 2. Install node_modules
npm ci
# 3. Setup databases by docker
npm run dev:docker:up
# 4. Load entity
npm run entity:sync
# 5. Seeding(Load Role with Super Admin)
npm run seed:run
- Set
NODE_ENV='development'
in.env
npm run start:dev
- Set
NODE_ENV='production'
in.env
npm start
- Test run on
Jest
. - Template already contains an example of
unit
ande2e
tests.
# 1. Run unit test
npm run test:cov
# 2. If you debug during testing.
npm run test:debug
# 1. Run E2E test auto mode
npm run test:e2e:auto
- Erase all data in test DB
# 1. Stop test DB running
npm run test:docker:down
# 2. Run new test DB
npm run test:docker:up
- Swagger: http://localhost:8081/docs
# 1. When project init, synchronize Entities to Database
npm run entity:sync
# 2. [Warning] When you need to erase ALL Database, DROP ALL Exist table.
npm run entity:drop
# 3. When project init, seeding data.(Roles, Super Admin)
npm run seed:run
# 4. [Warning] When you need to erase ALL Users with roles, DELETE ALL raws in user, role, user_role table.
npm run seed:revert