Skip to content

Commit

Permalink
feat(swagger): add swagger comment introspection
Browse files Browse the repository at this point in the history
feat(swagger): add swagger stats
  • Loading branch information
rubiin committed Sep 22, 2022
1 parent 9321070 commit e1235a2
Show file tree
Hide file tree
Showing 13 changed files with 369 additions and 234 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Note: If you are using windows, `SET NODE_ENV=dev npm run start`
## Features covered:

- 🌐 **i18n** - Internationalization
- 🧵 **Stats** - swagger stats for common server metrics
- 🧵 **piscina** - threads for cpu extensive tasks
- 💬 **Twillio** - sms support
- 📱 **NestJS** — latest version
Expand Down Expand Up @@ -83,31 +84,31 @@ Additionally, you can also see the scripts in `makefile`
# Migration and seeding

Migrations are used to update the database schema. The migration files are stored in `migrations` directory.

```sh
env=dev make migrate # applies migration for dev env
```

Seeding is used to insert data into the database. The seeding files are stored in `common/database/seeders` directory.

```sh
env=dev USER_PASSWORD=Test@1234 make seed # seeds data for dev env with user password set as Test@1234
```




## Start application

- `NODE_ENV=[env name] npm run start` (without ssl)
- `NODE_ENV=[env name] SSL=true npm run start` (with ssl)
- Test api by browsing to `http://localhost:[port]/v1/user`
- View automatically generated swagger api docs by browsing to `http://localhost:[port]/docs`
- View automatically generated swagger stats dashboard by browsing to `http://localhost:[port]/stats`. The username and password is the values set in the env file under `SWAGGER_USERNAME` and `SWAGGER_PASS` respectively

---

# Authentication

This applications uses JSON Web Token (JWT) to handle authentication. The token is passed with each request using the `Authorization` header with `Token` scheme. The JWT authentication middleware handles the validation and authentication of the token.


# Deployment

You need to have docker and docker-compose installed. Also since we are using makefiles for deployment, you need to have make installed.
Expand Down
2 changes: 2 additions & 0 deletions nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"name": "@nestjs/swagger/plugin",
"options": {
"classValidatorShim": true,
"introspectComments": true,
"controllerKeyOfComment": "description",
"dtoFileNameSuffix": [".entity.ts", ".dto.ts"],
"controllerFileNameSuffix": [".controller.ts"]
}
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ultimate-nest",
"version": "1.6.0",
"version": "1.6.5",
"description": "NestJS + MikroORM realworld API example",
"license": "MIT",
"repository": "https://github.com/rubiin/ultimate-nest",
Expand All @@ -22,9 +22,9 @@
},
"dependencies": {
"@aws-sdk/client-ses": "^3.171.0",
"@casl/ability": "^6.1.1",
"@casl/ability": "^6.2.0",
"@golevelup/nestjs-modules": "^0.6.1",
"@golevelup/nestjs-rabbitmq": "^3.2.0",
"@golevelup/nestjs-rabbitmq": "^3.3.0",
"@mikro-orm/core": "^5.4.2",
"@mikro-orm/migrations": "^5.4.2",
"@mikro-orm/nestjs": "^5.1.2",
Expand All @@ -34,12 +34,12 @@
"@nestjs/axios": "^0.1.0",
"@nestjs/class-transformer": "^0.4.0",
"@nestjs/class-validator": "^0.13.4",
"@nestjs/common": "9.0.11",
"@nestjs/common": "9.1.1",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "9.0.11",
"@nestjs/core": "9.1.1",
"@nestjs/jwt": "^9.0.0",
"@nestjs/passport": "^9.0.0",
"@nestjs/platform-express": "^9.0.11",
"@nestjs/platform-express": "^9.1.1",
"@nestjs/serve-static": "^3.0.0",
"@nestjs/swagger": "^6.1.2",
"@nestjs/terminus": "^9.1.1",
Expand All @@ -58,11 +58,11 @@
"eta": "^1.12.3",
"firebase-admin": "^11.0.1",
"helmet": "^6.0.0",
"helper-fns": "^2.5.14",
"helper-fns": "^2.5.15",
"joi": "^17.6.0",
"nanoid": "^4.0.0",
"nestjs-i18n": "^9.1.10",
"nestjs-minio": "^2.2.0",
"nestjs-minio": "^2.2.1",
"nestjs-pino": "^3.1.1",
"nodemailer": "^6.7.8",
"passport": "0.6.0",
Expand All @@ -77,7 +77,7 @@
"rxjs": "^7.5.6",
"sharp": "^0.31.0",
"swagger-stats": "^0.99.2",
"twilio": "^3.82.0"
"twilio": "^3.82.1"
},
"devDependencies": {
"@firebase/app-compat": "0.x",
Expand All @@ -87,7 +87,7 @@
"@mikro-orm/seeder": "^5.4.2",
"@nestjs/cli": "9.1.3",
"@nestjs/schematics": "9.0.3",
"@nestjs/testing": "9.0.11",
"@nestjs/testing": "9.1.1",
"@types/cache-manager": "^4.0.2",
"@types/cache-manager-redis-store": "^2.0.1",
"@types/compression": "^1.7.2",
Expand All @@ -104,8 +104,8 @@
"@types/sharp": "^0.31.0",
"@types/supertest": "2.0.12",
"@types/swagger-ui-express": "^4.1.3",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -122,7 +122,7 @@
"sample-env": "^1.0.2",
"supertest": "6.2.4",
"ts-jest": "29.0.1",
"ts-loader": "9.3.1",
"ts-loader": "9.4.1",
"ts-node": "10.9.1",
"tsconfig-paths": "4.1.0",
"typescript": "^4.8",
Expand Down
Loading

0 comments on commit e1235a2

Please sign in to comment.