Coder Social home page Coder Social logo

chenghonour / formulago Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 10.0 925 KB

FormulaGo is an enterprise admin management application framework developed with Hertz and Ent.强劲而简洁的后台管理系统框架。

License: Apache License 2.0

Dockerfile 0.43% Go 99.57%

formulago's Introduction

FormulaGo

English | 中文

简介

一个高性能的企业后台管理框架,使用HertzEnt

  • 高生产率:短时间即可搭建一个企业管理系统。
  • 高性能:使用Go里最强性能的 Hertz 框架。字节跳动已经在上万个服务上部署应用。
  • 模块化:参考DDD设计理念,模块设计更简洁、更方便。
  • 路由接口:参考 Google 开放平台,使用 Protobuf 定义接口规范。
  • 面向接口开发,更好拓展与单元测试。

演示网站

架构图

看起来像F1赛车吗? Go Backend Clean Architecture

依赖

  • 使用 Hertz 作为 HTTP 框架
  • 使用 Protobuf IDL 定义 HTTP 接口
  • 使用 hz 工具进行代码生成
  • 使用 EntMySQL(你也可以使用PostgresSQL)
  • 使用 内存缓存Redis(Config文件配置启用)

内置功能

  1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
  2. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
  3. 角色管理:角色菜单权限分配、设置角色的权限划分。
  4. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
  5. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
  6. 在线用户:当前系统中活跃用户Token状态监控。
  7. 文件管理:文件上传,S3(Aliyun OSS)多种上传方式适配。
  8. OAuth2.0登录:支持Google, Github, Wecom 等OAuth2.0认证登录, 可以自己拓展。
  9. 常用工具:在pkg包集成常用的工具包。
  10. 开发工具:提供便捷的Struct与Protobuf转换工具,Struct to Protobuf,Delete Struct Tag等。

接口定义

本项目使用Protobuf IDL 定义HTTP 接口。对应的admin模块相关接口在 admin.proto 文件中定义。

代码生成

本项目使用 hz 生成代码. hz 详细使用说明参考 hz.

  • hz install.
go install github.com/cloudwego/hertz/cmd/hz@latest
  • hz new: 新建一个 Hertz 项目
hz new -I api -idl api/admin/admin.proto -model_dir api/model -module formulago --unset_omitempty
  • hz update: 当你的IDL文件更新,使用该指令进行项目代码更新
  • api.proto 与 base.proto是不需要更新与生成的,因为它们是由导入它们的proto文件生成的
hz update -I api -idl api/admin/admin.proto -model_dir api/model --unset_omitempty

变量绑定与校验

变量绑定与校验使用说明参考 Binding and Validate.

Ent

ent - 一个简单但功能强大的 Go 实体框架。

本项目使用 Ent 连接与操作 MySQL(你也可以使用PostgresSQL) ,详细使用说明参考 Ent.

快速开始

  • 将配置文件中数据库参数换成你自己的: Database config file.
  • 在项目根目录下依次执行以下命令, 将在目录 data/ent/schema/ 生成一个User的实体:
  cd data
  go run -mod=mod entgo.io/ent/cmd/ent init User
  • 在 User schema 中添加表字段, 运行以下命令将生成Ent的操作代码文件
  go generate ./ent
  • Ent的更多使用说明,请参考 Ent Guides.

如何运行

更新配置文件

  • 使用你自己的参考更新 Prod configuration fileDev configuration file
  • 注意,YAML文件的参数结构要与config.go里的Config结构体一致。
  • 当运行时环境变量 "IS_PROD" 等于 true, 将会使用生产环境Prod配置, 否则使用测试环境Dev配置。

使用 Docker 启动 MySQL

cd formulago && docker-compose up

运行本项目

cd formulago
go build -o formulago &&./formulago

# 项目运行后,HTTP Get请求以下路由,将会初始化数据库表数据
# 初始管理员账号: admin/formulago
@router yourHost/api/initDatabase [GET]
enjoy it!

欢迎贡献代码或提供建议

formulago's People

Contributors

chenghonour avatar sujianjob 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

Watchers

 avatar  avatar  avatar

formulago's Issues

postgres server configuratio

I attempted changing the config file for compatibility with postgres but it constant ly returns SSL not enabled.
I guess this is a general error and it might be due to a number of factors.

Any hint on how to solve this ?

Thank you!

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.