GithubHelp home page GithubHelp logo

innei / nest-http-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
78.0 2.0 7.0 1.58 MB

A template for NestJS 10.x Typegoose Vitest and more, fast and simple boilerplate.

License: MIT License

JavaScript 2.63% Shell 2.76% TypeScript 94.62%
nestjs typegoose vitest mongoose pnpm logger architecture boilerplate template

nest-http-boilerplate's Introduction

Nest Http Template

A NestJS template, which used the coolest and fastest stuff.

image

Which Tech Stack In Use

  • Framework: NestJS (Based on Fastify)
  • Language: TypeScript (Best practices, Not AnyScript)
  • Database ODM: Typegoose (Write schema once all in TypeScript)
  • Bundle Toolchain: @vercel/ncc Bundle (Bundle entry, go node_modules away)
  • Testing: Vitest (Test case write in TypeScript, fast and out-of-box)
  • Package Manager: PNPM (which is fastest)
  • DevOps: Docker
  • Other: Prettier, ESLint, Husky, Bump Version, etc.

How to start development

npm run dev

File Structure

.
├── app.config.ts                 # 主程序配置,数据库、程序、第三方,一切可配置项
├── app.controller.ts             # 主程序根控制器
├── app.module.ts                 # 主程序根模块,负责各业务模块的聚合
├── common                        # 存放中间件
│   ├── adapters                  # 适配器的配置
│   ├── decorator                 # 业务装饰器
│   ├── exceptions                # 自定义异常
│   ├── filters                   # 异常处理器
│   ├── guard                     # 守卫与鉴权
│   ├── interceptors              # 拦截器, 数据过滤与响应格式化处理
│   ├── middlewares               # 传统意义上的中间件
│   └── pipes                     # 管道
├── constants                     # 常量
├── main.ts                       # 引入配置,启动主程序,引入各种全局服务
├── modules                       # 业务逻辑模块
├── processors                      # 核心辅助模块
│   ├── cache                       # Redis 缓存相关
│   ├── database                    # Mongo 数据库相关
│   ├── gateway                     # Socket.IO 相关
│   ├── helper                      # 辅助类
│   └── logger                      # 自定义 Logger
├── shared                          # 通用模型
│   ├── dto                         # 数据验证模型
│   ├── interface                   # 接口
│   └── model                       # 基本数据模型
├── utils                           # 工具类
├── bootstrap.ts                    # 引导程序
└── main.ts                         # 入口

Docs

Please visit docs folder under this project.

Authors

Innei.

nest-http-boilerplate's People

Contributors

innei avatar renovate[bot] avatar zhengbangbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nest-http-boilerplate's Issues

Some questions about docker-compose.yml

Additional context

I saw that docker-compost.yml have one app services

`services:
app:
container_name: nest-http
image: nest/nest-http:latest
command: node index.js --redis_host=redis --db_host=mongo --allowed_origins=${ALLOWED_ORIGINS} --jwt_secret=${JWT_SECRET} --color --cluster
environment:
- TZ=Asia/Shanghai
- NODE_ENV=production
restart: 'on-failure'
volumes:
- ./data/nest:/root/.nest

ports:
  - '3333:3333'
depends_on:
  - mongo
  - redis
links:
  - mongo
  - redis
networks:
  - app-network`

that image is image: nest/nest-http:latest but i have no saw it in nest's official docker image,i have use docker build -t nest/nest-http:latest . to build the docker fille I don't know if that's true.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: node

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
dockerfile
  • node 20-alpine
  • node 20-alpine
github-actions
.github/workflows/build.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v3
  • pnpm/action-setup v2.4.0
  • supercharge/mongodb-github-action v1.10.0
  • supercharge/redis-github-action 1.8.0
.github/workflows/docker.yml
  • actions/checkout v4
  • docker/metadata-action v5
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • docker/build-push-action v5
  • docker/build-push-action v5
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-node v4
  • supercharge/mongodb-github-action v1.10.0
  • supercharge/redis-github-action 1.8.0
  • actions/cache v3
  • pnpm/action-setup v2.4.0
  • actions/create-release v1
  • actions/upload-release-asset v1
  • actions/checkout v4
  • actions/cache v3
  • pnpm/action-setup v2.4.0
  • actions/upload-release-asset v1
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v3
  • pnpm/action-setup v2.4.0
npm
external/pino/package.json
package.json
  • @nestjs/cache-manager 2.1.1
  • @nestjs/common 10.2.10
  • @nestjs/core 10.2.10
  • @nestjs/jwt 10.2.0
  • @nestjs/mapped-types ^2.0.4
  • @nestjs/passport 10.0.3
  • @nestjs/platform-fastify 10.2.10
  • @nestjs/schedule 4.0.0
  • @typegoose/auto-increment 4.0.0
  • @typegoose/typegoose 12.0.0
  • axios 1.6.2
  • bcrypt 5.1.1
  • cache-manager 5.3.1
  • cache-manager-ioredis 2.1.0
  • class-transformer 0.5.1
  • class-validator 0.14.0
  • class-validator-jsonschema ^5.0.0
  • cron ^3.1.6
  • dayjs 1.11.10
  • lodash *
  • mongoose 8.0.3
  • mongoose-paginate-v2 1.7.31
  • nestjs-pretty-logger 0.2.0
  • passport 0.7.0
  • passport-jwt 4.0.1
  • redis 4.6.11
  • reflect-metadata 0.1.14
  • rxjs 7.8.1
  • snakecase-keys 5.5.0
  • zx-cjs 7.0.7-0
  • @innei/bump-version ^1.5.10
  • @innei/eslint-config-ts ^0.12.0
  • @innei/prettier ^0.12.0
  • @nestjs/cli 10.2.1
  • @nestjs/schematics 10.0.3
  • @nestjs/testing 10.2.10
  • @swc/cli 0.1.63
  • @types/bcrypt 5.0.2
  • @types/cache-manager 4.0.6
  • @types/lodash 4.14.202
  • @types/node 20.10.4
  • @types/passport-jwt 3.0.13
  • @types/supertest 2.0.16
  • @types/ua-parser-js 0.7.39
  • @vercel/ncc 0.38.1
  • cross-env 7.0.3
  • eslint ^8.55.0
  • husky 8.0.3
  • ioredis ^5.3.2
  • lint-staged 15.2.0
  • prettier 3.1.1
  • rimraf 5.0.5
  • rollup-plugin-swc 0.2.1
  • source-map-support *
  • ts-loader 9.5.1
  • tsconfig-paths 4.2.0
  • typescript ^5.3.3
  • unplugin-swc 1.4.4
  • vite-tsconfig-paths 4.2.2
  • zx 7.2.3
  • mongodb-memory-server 9.1.3
  • redis-memory-server 0.10.0
  • typescript ^5.3.3
  • pnpm 8.12.0

  • Check this box to trigger a request for Renovate to run again on this repository

上传文件报错:Unsupported Media Type: multipart/form-data;

Describe the bug

上传文件报错:Unsupported Media Type: multipart/form-data;

Reproduction

上传文件报错:Unsupported Media Type: multipart/form-data;

System Info

上传文件报错:Unsupported Media Type: multipart/form-data;

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Error installing dependencies

Thanks a lot for sharing this repository! Would really appreciate if you could help me out with the issue below

On trying to install deps

nest-http-boilerplate on  master via  v16.15.1 
❯ pnpm i                                                                 (base)
Downloading registry.npmjs.org/typescript/4.6.2: 11.4 MB/11.4 MB, done
Packages: +746
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/rohanrajpal/Library/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server: Running postinstall script...
Progress: resolved 760, reused 321, downloaded 420, added 746, done
node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server: Running postinstall script, done in 8.3suy6pikqhtn6hfkzt5a5w4/node_modules/@nnode_modules/.pnpm/[email protected]/node_modules/bcrypt: Running install script, done in 1.4se: Running postinstall script, done in 690ms
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall scrnode_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 455ms
node_modules/.pnpm/[email protected]/node_modules/redis-memory-server: Rnode_modules/.pnpm/[email protected]/node_modules/redis-memory-server: Running postinstall script, done in 23.6s

> nest-http@ prepare /Users/rohanrajpal/Documents/experiments/nest-http-boilerplate
> husky install

husky - Git hooks installed

dependencies:
+ @nestjs/common 8.4.4
+ @nestjs/core 8.4.4
+ @nestjs/jwt 8.0.0
+ @nestjs/mapped-types 1.0.1
+ @nestjs/passport 8.2.1
+ @nestjs/platform-fastify 8.4.4
+ @nestjs/schedule 2.0.0
+ @nestjs/swagger 5.2.1
+ @typegoose/auto-increment 1.3.0
+ @typegoose/typegoose 9.8.0
+ bcrypt 5.0.1
+ cache-manager 3.6.1
+ cache-manager-ioredis 2.1.0
+ chalk 5.0.1
+ class-transformer 0.5.1
+ class-validator 0.13.2
+ consola 2.15.3
+ cron 1.8.2
+ dayjs 1.11.1
+ fastify-swagger 5.1.1
+ lodash 4.17.21
+ mongoose 6.3.0
+ mongoose-paginate-v2 1.6.3
+ nanoid 3.3.3
+ passport 0.5.2
+ passport-jwt 4.0.0
+ redis 4.0.6
+ reflect-metadata 0.1.13
+ rxjs 7.5.5
+ snakecase-keys 5.4.1
+ zx <- zx-cjs 6.1.0
+ zx-cjs 6.1.0

optionalDependencies:
+ mongodb-memory-server 8.5.0 (8.6.0 is available)
+ redis-memory-server 0.5.0

devDependencies:
+ @innei-util/eslint-config-ts 0.8.2
+ @innei-util/prettier 0.8.2
+ @nestjs/cli 8.2.5
+ @nestjs/schematics 8.0.10
+ @nestjs/testing 8.4.4
+ @types/bcrypt 5.0.0
+ @types/cache-manager 3.4.3
+ @types/cron 1.7.3
+ @types/ioredis 4.28.10
+ @types/lodash 4.14.181
+ @types/node 17.0.24
+ @types/nodemailer 6.4.4
+ @types/passport-jwt 3.0.6
+ @types/supertest 2.0.12
+ @types/ua-parser-js 0.7.36
+ @vercel/ncc 0.33.4
+ cross-env 7.0.3
+ eslint 8.11.0
+ fastify 3.27.4
+ husky 7.0.4
+ ioredis 4.28.5
+ lint-staged 12.3.8
+ prettier 2.6.2
+ rimraf 3.0.2
+ run-script-webpack-plugin 0.0.11
+ ts-loader 9.2.8
+ ts-node 10.7.0
+ tsconfig-paths 3.14.1
+ typescript 4.6.2
+ vite-tsconfig-paths 3.4.1
+ vitest 0.9.3
+ webpack 5.58.2
+ webpack-node-externals 3.0.0

 ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

.
└─┬ vite-tsconfig-paths
  └── ✕ missing peer vite@>2.0.0-0
Peer dependencies that should be installed:
  vite@>2.0.0-0  

hint: If you want peer dependencies to be automatically installed, set the "auto-install-peers" setting to "true".
hint: If you don't want pnpm to fail on peer dependency issues, set the "strict-peer-dependencies" setting to "false".

Which one of the following hints would be the right one to follow?

Facing a similar issue with setting up swagger, here's the link:
https://discord.com/channels/520622812742811698/520649487924985885/982641140358602813

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.