Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kentloog/nestjs-sequelize-typescript
Nest + sequelize-typescript + JWT + Jest + Swagger
https://github.com/kentloog/nestjs-sequelize-typescript
Last synced: about 1 month ago
JSON representation
Nest + sequelize-typescript + JWT + Jest + Swagger
- Host: GitHub
- URL: https://github.com/kentloog/nestjs-sequelize-typescript
- Owner: kentloog
- Created: 2019-04-18T19:19:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T22:36:00.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T19:57:32.038Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.28 MB
- Stars: 350
- Watchers: 7
- Forks: 86
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-nestjs - Nest sequelize-typescript - Nest + sequelize-typescript + JWT + Jest + Swagger. (Resources)
- awesome-nestjs - Nest sequelize-typescript - Nest + sequelize-typescript + JWT + Jest + Swagger (资源 / 集成)
README
![Nest](assets/logo.png)
## Description
Starter kit project made with [Nest](https://github.com/nestjs/nest) that demonstrates CRUD user, JWT authentication, CRUD posts and e2e tests.
### Technologies implemented:
- [sequelize-typescript](https://github.com/RobinBuschmann/sequelize-typescript) (ORM) + [PostgreSQL](https://www.postgresql.org/)
- [JWT](https://jwt.io/)
- [Jest](https://jestjs.io/)
- [Swagger](https://swagger.io/)## Prerequisites
- [Node.js](https://nodejs.org/) (>= 10.8.0)
- [npm](https://www.npmjs.com/) (>= 6.5.0)## Installation
```bash
$ npm install
```## Setting up the database for development and test
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 |## Running the app
```bash
# development
$ npm run start# watch mode
$ npm run start:dev# production mode
$ npm run start:prod
```## Test
```bash
# e2e tests
$ npm run test
```## Other commands
```bash
# formatting code
$ npm run format# run linter
$ npm run lint# 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```
## Run production configuration
```
NODE_ENV=production \
DATABASE_HOST=db.host.com \
DATABASE_PORT=5432 \
DATABASE_USER=user \
DATABASE_PASSWORD=pass \
DATABASE_DATABASE=database \
JWT_PRIVATE_KEY=jwtPrivateKey \
ts-node -r tsconfig-paths/register src/main.ts
```## Swagger API docs
This project uses the Nest swagger module for API documentation. [NestJS Swagger](https://github.com/nestjs/swagger) - [www.swagger.io](https://swagger.io/)
Swagger docs will be available at localhost:3000/documentation