Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.7.0 #490

Merged
merged 7 commits into from
Nov 6, 2023
Merged

5.7.0 #490

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
APP_NAME=ACK
APP_ENV=development
APP_LANGUAGE=en
APP_MAINTENANCE=false

HTTP_ENABLE=true
HTTP_HOST=localhost
HTTP_PORT= 3000
HTTP_VERSIONING_ENABLE=true
HTTP_VERSION=1

DEBUGGER_HTTP_WRITE_INTO_FILE=false
DEBUGGER_HTTP_WRITE_INTO_CONSOLE=false
DEBUGGER_SYSTEM_WRITE_INTO_FILE=false
DEBUGGER_SYSTEM_WRITE_INTO_CONSOLE=false
DEBUGGER_WRITE_INTO_FILE=false

JOB_ENABLE=false

Expand All @@ -28,21 +26,25 @@ AUTH_JWT_AUDIENCE=https://example.com

AUTH_JWT_ACCESS_TOKEN_SECRET_KEY=1234567890
AUTH_JWT_ACCESS_TOKEN_EXPIRED=1h

AUTH_JWT_REFRESH_TOKEN_SECRET_KEY=0987654321
AUTH_JWT_REFRESH_TOKEN_EXPIRED=182d
AUTH_JWT_REFRESH_TOKEN_NOT_BEFORE_EXPIRATION=0

AUTH_JWT_PAYLOAD_ENCRYPT=false
AUTH_JWT_PAYLOAD_ACCESS_TOKEN_ENCRYPT_KEY=qwerty
AUTH_JWT_PAYLOAD_ACCESS_TOKEN_ENCRYPT_IV=123456
AUTH_JWT_PAYLOAD_REFRESH_TOKEN_ENCRYPT_KEY=ytrewq
AUTH_JWT_PAYLOAD_REFRESH_TOKEN_ENCRYPT_IV=654321

AWS_CREDENTIAL_KEY=
AWS_CREDENTIAL_SECRET=
AWS_S3_CREDENTIAL_KEY=
AWS_S3_CREDENTIAL_SECRET=
AWS_S3_REGION=ap-southeast-3
AWS_S3_BUCKET=
AWS_SES_CREDENTIAL_KEY=
AWS_SES_CREDENTIAL_SECRET=
AWS_SES_REGION=ap-southeast-3
AWS_SES_FROM_EMAIL=


SSO_GOOGLE_CLIENT_ID=
SSO_GOOGLE_CLIENT_SECRET=
SSO_GOOGLE_CLIENT_SECRET=

SENTRY_DSN=
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: echo ${{ steps.vars.outputs.sha_short }}

- name: Setup node version ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v3

- name: Setup node version ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@

## Todo

* [x] Remove Debugger HTTP
* [x] Setting Move to Modules
* [x] Debugger env change
* [x] Add exception filter to Sentry.io
* [x] Add Email Module with AWS SES
* [ ] Push docker image to AWS ECR
* [ ] CI/CD Using AWS ECS and deploy to AWS EC2
* [ ] Update Package, and remove unused package
* [ ] Update Documentation, add behaviors
* [ ] Update Documentation, and include an diagram for easier comprehension
* [ ] Add Redis / Move to stateful Authorization Token (security and ux reason)
* [ ] Implement GraphQL
* [ ] Implement GraphQL, just an options for running ?

## Documentation

Expand Down
39 changes: 15 additions & 24 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ Describes which version.
* Production ready 🔥
* Repository Design Pattern (Multi Repository, can mix with other orm)
* Swagger / OpenAPI 3 included
* Authentication (`Access Token`, `Refresh Token`, `API Key`)
* Authorization, Role and Permission Management
* Google SSO for Login and Sign Up
* Authentication (`Access Token`, `Refresh Token`, `API Key`, `Google SSO`)
* Authorization, Role Management.
* Support multi-language `i18n` 🗣, can controllable with request header `x-custom-lang`
* Request validation for all request params, query, dan body with `class-validation`
* Serialization with `class-transformer`
* Url Versioning, default version is `1`
* Server Side Pagination
* Import and export data with CSV or Excel by using `decorator`
* Sentry.io for Monitoring Tools
* Debugger with `Winston` 📝

### Database

Expand All @@ -73,10 +74,6 @@ Describes which version.
* Database Soft Delete
* Database Migration

### Logger and Debugger

* Logger with `Morgan`
* Debugger with `Winston` 📝

### Security

Expand All @@ -92,40 +89,34 @@ Describes which version.
* Centralize exception filter
* Setting from database 🗿

### Third Party Integration

* SSO `Google`
* Storage integration with `AwsS3`
* Upload file `single` and `multipart` to AwsS3

### Others

* Support Docker installation
* Support CI/CD (Eg: Github Action, Jenkins)
* Support CI/CD (Eg: Github Action)
* Husky GitHook for run linter before commit 🐶
* Linter with EsLint for Typescript


## Third Party Integration

* AWS S3
* AWS SES
* AWS EC2
* AWC ECS
* Sentry.io
* Google

## Installation

Installation will describe in difference doc. [here][doc-installation].

## API Spec

You can check The API Spec after running this project. [here][api-spec-docs]

## More Docs

You can find more docs about this project in [here][ack-doc]
You can check The API Spec after running this project. in `localhost:3000/docs`.


[doc-installation]: /docs/installation.md

<!-- API Reference -->
[api-spec-docs]: http://localhost:3000/docs

[ack-doc]: ./docs

<!-- Reference -->
[ref-nestjs]: http://nestjs.com
[ref-mongoose]: https://mongoosejs.com
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,9 @@ This project need to do migration for running. [Read this][ack-database-migratio

## API Reference

You can check The ApiSpec after running this project. [here][api-reference-docs]
You can check The API Spec after running this project. in `localhost:3000/docs`.

<!-- API Reference -->
[api-reference-docs]: http://localhost:3000/docs
[ack-database-migration-doc]: ./database/database_migration.md

<!-- Reference -->
[ref-nestjs]: http://nestjs.com
Expand Down
4 changes: 0 additions & 4 deletions docs/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,12 @@ Server-Side Pagination that contains 2 main features

# PaginationQuery

> Next development will use repository for convert the `@Query` so it will support all repository

`@PaginationQuery` is a helper for converting a `@Query` into a `query database`.
This decorator consumes `pipe` from `nestjs` with some manipulation.
Now there are 7 Types that have different purpose.

List of `@Query` that used by `@PaginationQuery`

> If you want to know what is this, you can jump to scenario section of PaginationQuestion

- `search`: text searching
- `perPage`: set limit
- `page`: set page
Expand Down
66 changes: 34 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ack-nestjs-boilerplate",
"version": "5.6.1",
"version": "5.7.0",
"description": "Ack NestJs Boilerplate",
"repository": {
"type": "git",
Expand All @@ -14,7 +14,7 @@
"license": "MIT",
"scripts": {
"upgrade:package": "ncu -u",
"prebuild": "rimraf dist",
"clean": "rimraf dist",
"build": "nest build",
"format": "yarn format:src && yarn format:test",
"format:src": "prettier --write src/**/*.ts",
Expand All @@ -35,49 +35,52 @@
"spell": "yarn spell:src && yarn spell:test",
"spell:src": "cspell lint --config cspell.json src/**/*.ts --color --gitignore --no-must-find-files --no-summary --no-progress || true",
"spell:test": "cspell lint --config cspell.json test/**/*.ts --color --gitignore --no-must-find-files --no-summary --no-progress || true",
"seed:setting": "nestjs-command seed:setting",
"seed:apikey": "nestjs-command seed:apikey",
"seed:role": "nestjs-command seed:role",
"seed:user": "nestjs-command seed:user",
"rollback:setting": "nestjs-command remove:setting",
"seed:email": "nestjs-command seed:email",
"rollback:apikey": "nestjs-command remove:apikey",
"rollback:role": "nestjs-command remove:role",
"rollback:user": "nestjs-command remove:user",
"seed": "yarn seed:setting && yarn seed:role && yarn seed:user && yarn seed:apikey",
"rollback": "yarn rollback:setting && yarn rollback:apikey && yarn rollback:user && yarn rollback:role"
"rollback:email": "nestjs-command remove:email",
"seed": "yarn seed:email && yarn seed:role && yarn seed:user && yarn seed:apikey",
"rollback": "yarn rollback:email && yarn rollback:apikey && yarn rollback:user && yarn rollback:role"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.433.0",
"@aws-sdk/client-s3": "^3.441.0",
"@aws-sdk/client-ses": "^3.441.0",
"@casl/ability": "^6.5.0",
"@faker-js/faker": "^8.2.0",
"@joi/date": "^2.1.0",
"@nestjs/axios": "^3.0.0",
"@nestjs/common": "^10.2.7",
"@nestjs/axios": "^3.0.1",
"@nestjs/common": "^10.2.8",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.2.7",
"@nestjs/core": "^10.2.8",
"@nestjs/jwt": "^10.1.1",
"@nestjs/mongoose": "^10.0.1",
"@nestjs/passport": "^10.0.2",
"@nestjs/platform-express": "^10.2.7",
"@nestjs/schedule": "^3.0.4",
"@nestjs/swagger": "^7.1.13",
"@nestjs/platform-express": "^10.2.8",
"@nestjs/schedule": "^4.0.0",
"@nestjs/swagger": "^7.1.14",
"@nestjs/terminus": "^10.1.1",
"@nestjs/throttler": "^5.0.0",
"@nestjs/throttler": "^5.0.1",
"@ntegral/nestjs-sentry": "^4.0.0",
"@sentry/node": "^7.77.0",
"@types/response-time": "^2.3.7",
"axios": "^1.5.1",
"axios": "^1.6.0",
"bcryptjs": "^2.4.3",
"case": "^1.6.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"crypto-js": "^4.1.1",
"google-auth-library": "^9.1.0",
"crypto-js": "^4.2.0",
"google-auth-library": "^9.2.0",
"helmet": "^7.0.0",
"joi": "^17.11.0",
"moment": "^2.29.4",
"mongoose": "^7.6.3",
"morgan": "^1.10.0",
"mongoose": "^8.0.0",
"nest-winston": "^1.9.4",
"nestjs-command": "^3.1.4",
"nestjs-i18n": "^10.3.6",
"nestjs-i18n": "^10.3.7",
"passport": "^0.6.0",
"passport-headerapikey": "^1.2.2",
"passport-jwt": "^4.0.1",
Expand All @@ -86,39 +89,38 @@
"rimraf": "^5.0.5",
"rotating-file-stream": "^3.1.1",
"rxjs": "^7.8.1",
"ua-parser-js": "^1.0.36",
"ua-parser-js": "^1.0.37",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1",
"xlsx": "^0.18.5",
"yargs": "^17.7.2",
"yarn": "^1.22.19"
},
"devDependencies": {
"@nestjs/cli": "^10.1.18",
"@nestjs/schematics": "^10.0.2",
"@nestjs/testing": "^10.2.7",
"@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^10.2.8",
"@types/bcryptjs": "^2.4.5",
"@types/bytes": "^3.1.3",
"@types/cors": "^2.8.15",
"@types/cron": "^2.0.1",
"@types/crypto-js": "^4.1.3",
"@types/express": "^4.17.20",
"@types/jest": "^29.5.6",
"@types/jest": "^29.5.7",
"@types/lodash": "^4.14.200",
"@types/morgan": "^1.9.7",
"@types/ms": "^0.7.33",
"@types/multer": "^1.4.9",
"@types/node": "^20.8.7",
"@types/passport-jwt": "^3.0.11",
"@types/node": "^20.8.10",
"@types/passport-jwt": "^3.0.12",
"@types/supertest": "^2.0.15",
"@types/ua-parser-js": "^0.7.38",
"@types/uuid": "^9.0.6",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"cspell": "^7.3.8",
"eslint": "^8.52.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"prettier": "^3.0.3",
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { JobsModule } from 'src/jobs/jobs.module';
import { AppController } from './controllers/app.controller';
import { RouterModule } from 'src/router/router.module';
import { CommonModule } from 'src/common/common.module';
import { AppMiddlewareModule } from 'src/app/middleware/app.middleware.module';

@Module({
controllers: [AppController],
providers: [],
imports: [
CommonModule,
AppMiddlewareModule,

// Jobs
JobsModule.forRoot(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ import {
MiddlewareConsumer,
RequestMethod,
} from '@nestjs/common';
import { SettingMaintenanceMiddleware } from 'src/common/setting/middleware/maintenance/setting.maintenance.middleware';
import { AppMaintenanceMiddleware } from 'src/app/middleware/maintenance/app.maintenance.middleware';

@Module({})
export class SettingMiddlewareModule implements NestModule {
export class AppMiddlewareModule implements NestModule {
configure(consumer: MiddlewareConsumer): void {
consumer
.apply(SettingMaintenanceMiddleware)
.apply(AppMaintenanceMiddleware)
.exclude(
{
path: 'api/v:version*/user/login',
path: 'api/v:version*/auth/login',
method: RequestMethod.POST,
},
{
path: 'api/user/login',
path: 'api/auth/login',
method: RequestMethod.POST,
},
{
path: 'api/v:version*/user/refresh',
path: 'api/v:version*/auth/refresh',
method: RequestMethod.POST,
},
{
path: 'api/user/refresh',
path: 'api/auth/refresh',
method: RequestMethod.POST,
},
{
Expand Down
Loading