A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
Docker download Docker
git clone {repository URL}
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
api description Available by link:
scheme://hostname:port/docs
- List endpoints
User
(/users
route)GET /users
- get all users (remove password from response)GET /users/:userId
- get the user by id (ex. “/users/123”) (remove password from response)POST /users
- create userPUT /users/:userId
- update userDELETE /users/:userId
- delete user
Board
(/boards
route)GET /boards
- get all boardsGET /boards/:boardId
- get the board by idPOST /boards
- create boardPUT /boards/:boardId
- update boardDELETE /boards/:boardId
- delete board and all tasks
Task
(/boards/:boardId/tasks
route)GET boards/:boardId/tasks
- get all tasksGET boards/:boardId/tasks/:taskId
- get the task by idPOST boards/:boardId/tasks
- create taskPUT boards/:boardId/tasks/:taskId
- update taskDELETE boards/:boardId/tasks/:taskId
- delete task
Files
(/files
route)GET files/:filename
- get one filePOST files
- upload one or many files. RESTRICTION: TotalSize 5MB on batch of uploades files
Authentication
(/login
route)POST login
- authenticate in APP. Response JWT-token
To upload file use route : "/files".
Restrictions: TotalSize 5MB on batch of uploades files.
Multiply upload support: Yes.
npm run lint
For use ready build
docker-compose pull node-app
docker-compose pull postgres
or new build
docker-compose build
For start container use
docker-compose up -d
For shutdown container use
docker-compose down
App can be switched between Express and Fastify.
To do this :
- docker-compose down node-app
- change env USE_FASTIFY
- docker-compose up -d node-app
environment:
TYPEORM_HOST: postgres
USE_FASTIFY: false
DB
: fastify-db
Tables
:
- Users
- Tasks
- Boards
Migrations
CLI migrations
npm run typeorm
For auto generate migrations
npm run typeorm:generate
If migrations changes
npm run typeorm:run
Docker-compose contains image dpage/pgadmin4 => pgAdmin.
To access pgadmin from docker go to http://localhost:5050.
email : admin@admin.com
password: root
To work with the pgAdmin in docker, use the next flow:
-
Authorization (admin@admin.com / root)
-
Add new server
- Enter anything connection name
- Host
postgres
- Username from .env file
- Password from .env file
-
Browse servers
For change level logs need go to env file and change
LOG_LEVEL
levels logs :
- 0: error
- 1: warn
- 2: info
- 3: debug
- 4: all
if level log === 0, all errors logs write in errorLog.log
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
In project used Artillery
http.codes.200: ................................................................ 5000
http.codes.201: ................................................................ 4000
http.request_rate: ............................................................. 80/sec
http.requests: ................................................................. 9000
http.response_time:
min: ......................................................................... 4
max: ......................................................................... 5565
median: ...................................................................... 982.6
p95: ......................................................................... 3828.5
p99: ......................................................................... 5065.6
http.responses: ................................................................ 9000
vusers.completed: .............................................................. 1000
vusers.created: ................................................................ 1000
vusers.created_by_name.NestJS API: ............................................. 1000
vusers.session_length:
min: ......................................................................... 689.9
max: ......................................................................... 21694.1
median: ...................................................................... 11050.8
p95: ......................................................................... 20958.1
p99: ......................................................................... 21381.5
http.codes.200: ................................................................ 5000
http.codes.201: ................................................................ 4000
http.request_rate: ............................................................. 83/sec
http.requests: ................................................................. 9000
http.response_time:
min: ......................................................................... 1
max: ......................................................................... 4129
median: ...................................................................... 219.2
p95: ......................................................................... 1826.6
p99: ......................................................................... 3464.1
http.responses: ................................................................ 9000
vusers.completed: .............................................................. 1000
vusers.created: ................................................................ 1000
vusers.created_by_name.NestJS API: ............................................. 1000
vusers.session_length:
min: ......................................................................... 401.9
max: ......................................................................... 15226
median: ...................................................................... 1587.9
p95: ......................................................................... 14048.5
p99: ......................................................................... 14917.2
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.