Code Monkey home page Code Monkey logo

tg_bot's Introduction

fullstack-app-template

lang code style: prettier

一个完善的基于 koa.js 开发的全栈应用模板,可在生产项目中使用。

功能列表

  • node-config 支持不同环境配置
  • dotenv 支持环境变量管理
  • 基于 @koa/router 构建的蓝图功能
  • 使用 swagger-ui 生成 api 文档
  • 添加 parameter 模块来支持表单验证
  • 数据库默认是 sqlite,可以支持其他数据,如 mysql,由 prisma2 驱动
  • 支持 typescript 编写
  • 支持应用分层写法

目录结构

├── docs/
├── migrations/                               # 数据库迁移脚本
├── run/
|   ├── application_config.json               # 应用运行时的配置信息
|   └── application_config_meta.json          # 应用运行时的配置的元数据
├── src/
|   ├── setup.ts                              # 启动脚本
|   ├── main.ts                               # 应用入口
|   ├── config/                                   # 应用配置 
|   |   ├── default.ts  
|   |   ├── development.ts
|   |   └── production.ts
|   ├── contract/
|   |   ├── request/                          # 表单验证规则和输入字段定义
|   |   ├── response/                         # 输出数据转换和安全字段拦截
|   |   └── *.yaml                            # swagger ui 定义文件
|   ├── db/ 
|   |   └── client.ts                         # @prisma/client 实例对象
|   ├── extend/
|   |   ├── application.ts
|   |   └── context.ts
|   ├── shared/                                  # 公共代码 
|   ├── middleware/                           # 中间件函数
|   ├── modules/  
|   |   ├── admin/                            # 管理后台 
|   |   |   ├── static/                       # 静态文件
|   |   |   ├── templates/                    # 模板文件
|   |   |   └── main.ts                       # 模块入口
|   |   |
|   |   ├── api/                              # 数据接口
|   |   |   └── main.ts
|   |   |
|   |   ├── mobile/                           # 移动端 
|   |   |   ├── static/                       # 静态文件
|   |   |   ├── templates/                    # 模板文件
|   |   |   └── main.ts                       # 模块入口
|   |   └── web/                              # 官网
|   |       ├── static/                       # 静态文件
|   |       ├── templates/                    # 模板文件
|   |       └── main.ts                       # 模块入口
|   └── service/                              # 内部调用服务
├── .env                                      # 环境配置文件
├── ecosystem.config.js                       # pm2 配置文件
├── tsconfig.json
├── schema.prisma                             # prisma 定义文件
└── README.md

文档

启动项目

注意: 请确保本地安装有 redis,或修改 redis 的主机地址,否则项目将无法启动。

你需要安装 Node.js 的版本为 12+,应用依赖 redis 服务。

克隆此仓库后运行:

# 安装依赖
$ npm install

# 更新数据库
$ npm run db:up

# 启动开发模式
# 打开 http://127.0.0.1:8080/api/docs 可以查看 api 文档
$ npm run dev

# 启动调试模式,需要其他工具配合,如:vscode,Chrome devtools
$ npm run debug

更多 npm version 的命令可使用 npm version --help 查看

感谢

感谢以下开源项目给予的灵感和帮助,以下排名不分先后。

License

  • MIT

tg_bot's People

Watchers

jack avatar

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.