AI-Cloud-Services / node-backend

NestJs Boilerplate. Authentication (JWT, OAuth2, API Key, Basic Auth, Role Management), Mongoose, MongoDB , Configuration, Multi Languages (i18n), etc. Advance Example πŸ₯Ά. NestJs v8.x πŸ₯³, Typescript πŸš€. Production Ready πŸ”₯

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues MIT License

NestJs NodeJs Typescript MongoDB JWT Jest Yarn Docker

ACK NestJs Boilerplate Mongoose πŸ”₯ πŸš€

Best uses for Restful API, Microservice, or SaaS Project

ack-nestjs-boilerplate-mongoose is a NestJs Boilerplate with Mongoose and MongoDB as Database.

Made with following

You can Request Feature or Report Bug with following this link

Important

ack-nestjs-boilerplate-mongoose still on trial and error phase and the test will base on real projects or cases. So there will be (always) have new update and new features.

If you change env value of APP_MODE to secure that will trigger more Middleware and Guard.

  1. TimestampMiddleware, tolerant 5 minutes of request.
  2. UserAgentMiddleware, whitelist of user agent.
  3. ApiKeyGuard, check api key based on database.
  4. CorsMiddleware, check cors based on configs.

You can see our e2e testing file or read the documentation on section environment.

Build with

Describes which version of the main packages and main tools.

Name Version
NestJs v8.x
NodeJs v17.x
Typescript v4.x
Mongoose v6.x
MongoDB v5.x
Yarn v1.x
NPM v8.x
Docker v20.x
Docker Compose v2.x

Objective

ack-nestjs-boilerplate-mongoose have some objective.

  • Simple, scalable and secure
  • Avoid spaghetti code
  • Component based
  • Reusable component
  • Easy to maintenance
  • Support for all microservice patterns

Features

  • NestJs v8.x πŸ₯³
  • Production Ready πŸ”₯
  • Typescript πŸš€
  • Authentication and Authorization (JWT, OAuth2, API Key, Basic Auth, Role Management) πŸ’ͺ
  • Mongodb Integrate by Using Mongoose Package πŸŽ‰
  • Database Migration (NestJs-Command)
  • Storage Management with AWS (S3), and can switch with Internal Storage using FS Package
  • Server Side Pagination (3 Types)
  • Url Versioning
  • Request Validation Pipe with Custom Message πŸ›‘
  • Custom Error Status Code 🀫
  • Logger (Morgan) and Debugger (Winston) πŸ“
  • Centralize Configuration πŸ€–
  • Centralize Exception Filter, and Custom Error Structure
  • Multi-language (i18n) πŸ—£
  • Timezone Awareness, and Custom Timezone
  • Request Timeout, and Custom Timeout (Override) βŒ›οΈ
  • Dynamic Setting from Database πŸ—Ώ
  • Maintenance Mode on / off 🐀
  • Cache Manager Implementation, can switch with Redis, Memcached, or anything else
  • Advance Example πŸ₯Ά
  • Support Docker Installation
  • Support CI/CD with Github Action or Jenkins
  • Husky GitHook For Check Source Code, and Run Test Before Commit 🐢
  • Linter with EsLint for Typescript
  • Etc.

Prerequisites

We assume that everyone who comes here is programmer with intermediate knowledge and we also need to understand more before we begin in order to reduce the knowledge gap.

  1. Understand NestJs Fundamental, Main Framework. NodeJs Framework with support fully TypeScript.
  2. UnderstandTypescript Fundamental, Programming Language. It will help us to write and read the code.
  3. Understand ExpressJs Fundamental, NodeJs Base Framework. It will help us in understanding how the NestJs Framework works.
  4. Understand what NoSql is and how it works as a database, especially MongoDB.
  5. Understand Microservice Architecture and the design pattern.
  6. The Twelve Factor Apps
  7. Optional, Understand Docker that can help you to run the project

Todo

Next development

  • Pagination Optimization, Pagination Category
  • Default Timezone, and custom timezone (by x-timezone)
  • Add response header x-custom-lang, x-timestamp, and x-timezone, and x-request-id
  • Add x-request-id middleware
  • Add x-request-id per debugger log, to make more specific log per request
  • Cors optimization allowed header, and allowed method
  • Implement Cache Manager for response (for improve performance)
  • Response Timeout, custom timeout with decorator
  • Convert time using ms package in Config Module. Centralize
  • Add cSpell
  • Add ErrorLogInterceptor
  • Add LoggerInterceptor
  • Timezone in serialization and dto
  • Utils unit test
  • Add Redis Configuration
  • Update Documentation
  • Versioning Serialization (Low Priority)
  • Docker Compose File Mongodb Replication Set (Low Priority)
  • Swagger (Low Priority)

Documentation

Let's go into deep ! πŸš€

Endpoints

Import endpoints.json into postman or see our e2e testing

Microservice

Nestjs microservice or Kafka integration will put in separate repo ack-microservice-nestjs-boilerplate-mongoose.

License

Distributed under MIT licensed.

Contributors

Thanks goes to these wonderful people

Boilerplate

PSheon
PSheon

aallithioo
aallithioo

Documentation

Tiaamoo
Tiaamoo

Contact

Andre Christi kan

Github LinkedIn Instagram

About

NestJs Boilerplate. Authentication (JWT, OAuth2, API Key, Basic Auth, Role Management), Mongoose, MongoDB , Configuration, Multi Languages (i18n), etc. Advance Example πŸ₯Ά. NestJs v8.x πŸ₯³, Typescript πŸš€. Production Ready πŸ”₯

License:MIT License


Languages

Language:TypeScript 99.9%Language:Shell 0.1%