All Projects → dyb881 → nest-serve

dyb881 / nest-serve

Licence: other
使用 Nestjs 8.x 以微服务方式开发的基础管理后台服务,并搭配 React 开发的管理后台前端(可自行根据 swagger 的接口开发对应的管理后台前端)

Programming Languages

typescript
32286 projects
PLpgSQL
1095 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nest-serve

MyAPI
A template to create awesome APIs easily ⚡️
Stars: ✭ 117 (+20.62%)
Mutual labels:  typeorm, nestjs
serverless-nestjs-typeorm
Example how to nestjs using the serverless framework with TypeORM
Stars: ✭ 99 (+2.06%)
Mutual labels:  typeorm, nestjs
nestjs-api-mongoose
Collection example apps with NestJS and Typeorm, Sequelize, Mongodb, PostgreSQL, MySQL, GraphQL, Mercurius, etc. for the NestJS community 😻
Stars: ✭ 153 (+57.73%)
Mutual labels:  typeorm, nestjs
car-assembly
基于Vue3.0+WebGL+Nestjs搭建的汽车组装演示系统
Stars: ✭ 44 (-54.64%)
Mutual labels:  typeorm, nestjs
microservice-template
📖 Nest.js based microservice repository template
Stars: ✭ 131 (+35.05%)
Mutual labels:  typeorm, nestjs
Domain Driven Hexagon
Guide on Domain-Driven Design, software architecture, design patterns, best practices etc.
Stars: ✭ 4,417 (+4453.61%)
Mutual labels:  typeorm, nestjs
lynx
Opinionated Framework built on top of NestJS and TypeORM
Stars: ✭ 44 (-54.64%)
Mutual labels:  typeorm, nestjs
nestjs-auth-starter-kit
NestJS Auth Starter Kit (typescript / typeorm / swagger / passport / bcrypt)
Stars: ✭ 37 (-61.86%)
Mutual labels:  typeorm, nestjs
prime-nestjs
A production-ready NestJS boilerplate using Typescript, Postgres, TypeORM, and Docker.
Stars: ✭ 140 (+44.33%)
Mutual labels:  typeorm, nestjs
nest-convoy
[WIP] An opinionated framework for building distributed domain driven systems using microservices architecture
Stars: ✭ 20 (-79.38%)
Mutual labels:  typeorm, nestjs
Nestjs Realworld Example App
Exemplary real world backend API built with NestJS + TypeORM / Prisma
Stars: ✭ 1,838 (+1794.85%)
Mutual labels:  typeorm, nestjs
nestjs-starter
🚀 Nest framework starter
Stars: ✭ 30 (-69.07%)
Mutual labels:  typeorm, nestjs
Mili
mili 是一个开源的社区系统,界面优雅,功能丰富😛
Stars: ✭ 2,875 (+2863.92%)
Mutual labels:  typeorm, nestjs
Crud
NestJs CRUD for RESTful APIs
Stars: ✭ 2,709 (+2692.78%)
Mutual labels:  typeorm, nestjs
nest-boilerplate
Nest.js boilerplate with CircleCI, Commitizen, Commitlint, Docker-Compose, ESLint, GitHub Actions, Husky, Lint-staged, OpenAPI, Prettier, PostGreSQL, Travis CI, TypeORM
Stars: ✭ 16 (-83.51%)
Mutual labels:  typeorm, nestjs
nestjs-api-example
NestJS Example
Stars: ✭ 60 (-38.14%)
Mutual labels:  typeorm, nestjs
node-nestjs-structure
Node.js framework NestJS project structure
Stars: ✭ 258 (+165.98%)
Mutual labels:  typeorm, nestjs
nest-typeorm-auth-boilerplate
A NestJS boilerplate with TypeORM and authentication
Stars: ✭ 15 (-84.54%)
Mutual labels:  typeorm, nestjs
uni-pushy-server
upushy 热更新后端。https://upushy.yoouu.cn/
Stars: ✭ 30 (-69.07%)
Mutual labels:  typeorm, nestjs
sf-nest-admin
🚀 基于NestJs + TypeScript + TypeORM + Redis + MySql + Vue2 + Element-UI编写的一款简单高效的前后端分离的权限管理系统
Stars: ✭ 125 (+28.87%)
Mutual labels:  typeorm, nestjs

Nest Serve v3

使用 Nestjs 8.x 以微服务方式开发的基础管理后台服务,并搭配 React 开发的管理后台前端(可自行根据 swagger 的接口开发对应的管理后台前端)

旧版本

使用方法

配置

一般情况下可以直接用当前配置,但如果要区分环境的话,就需要在 config 文件夹下添加这两个文件

  • development.yaml
  • production.yaml

在运行时会根据环境变量 NODE_ENV=配置文件名 进行选择加载,如

NODE_ENV=production yarn start // 加载 production.yaml 覆盖配置

环境变量为空时,默认会尝试加载 development.yaml

开发环境

一般情况下需要一个个单独启动服务

yarn start:dev account
yarn start:dev infos
yarn start:dev admin

部署

yarn build:all // 打包所有
yarn pm2 // 用 pm2 运行所有服务
yarn pm2:pd // 使用 /config/production.yaml + pm2 运行所有服务

基础服务

  • account 账号管理模块
    • admin 管理员账号
    • admin-role 管理员角色
    • user 用户账号
  • infos 信息管理模块
    • category 信息分类
    • article 文章列表

网关服务

  • admin 管理后台网关
    • account 账号管理相关接口
    • infos 信息管理相关接口
    • auth 鉴权接口

自定义库

public-module 公共模块

主要是将,常用的业务功能抽象成模块

  • global 用于初始化的全局模块(除了配置文件外,其他只有配置为 true 时,才会开启)
    • 配置文件初始化
    • typeorm 模块初始化
    • multer 文件模块初始化
    • 缓存模块初始化
    • jwt 鉴权模块初始化
    • 阿里云短信服务模块
    • files 文件上传模块
    • 阿里云 oss 对象储存模块
  • logger 日志模块

public-class 公共类

因为 nestjs 主要是写法都是 class,开发基类可以对开发效率和拓展性都有很大的提升,如

/**
 * 公用实体
 * 一条数据必须存在的属性
 */
export class CommonEntity {
  @ApiProperty('ID')
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @ApiProperty('创建时间')
  @CreateDateColumn({ comment: '创建时间', transformer: dateTransformer })
  create_date: Date;

  @ApiProperty('更新时间')
  @UpdateDateColumn({ comment: '更新时间', transformer: dateTransformer })
  update_date: Date;
}

/**
 * 基础账号实体
 * 一个账号必须存在的属性
 */
export class AccountEntity extends CommonEntity {
  @ApiProperty('用户名')
  @Column('用户名', 32, { unique: true })
  username: string;

  // 省略
}
  • controller 常用的控制器类
  • dto 接口参数类型定义,以及对于 swagger 的注解
  • entity 公用的数据库实体类
  • service 公用的服务类,自带 CRUD,继承即可使用(待优化)

public-decorator 公共装饰器

主要是把一些装饰器,柯里化成一些语义化的函数,如

// typeorm api
Column('simple-json', { comment: 'json 数据' }) = ColumnJson('json 数据');
  • swagger 接口文档标注装饰器
  • transformer 基于 class-transformer 的数据转化装饰器
  • typeorm 基于 typeorm 注册列的装饰器
  • validator 基于 class-validator 的数据验证装饰器

public-tool 公共工具库

主要封装了全局常用工具

  • data 数据处理工具函数
  • bootstrap 服务启动引导程序
  • service 在服务中常用的函数
  • typeorm 针对数据库的数据转化工具
  • http.exception.filter 异常拦截器
  • transform.interceptor 响应参数转化为统一格式

配套 UI 效果图(兼容移动端)

cra-template-seasoning中使用 pc-admin 模版 效果图 效果图 效果图 效果图 效果图 效果图 效果图 效果图 效果图 效果图 效果图 效果图 效果图

如果觉得项目还不错,请打赏一波,您的支持是我最大的动力。

二维码

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].