Git Product home page Git Product logo

go-admin's Introduction

go-admin

基于golang的后台管理系统,力求适中简化后台开发过程,满足中小项目开发需要。 使用到的主要技术框架: Gin、Vue2.0的ElementUI等

关于前端技术我解释下
因为我不太会前端,而且VUE3.0的Element-UI我感觉很难看,并且对VUE3.0也不怎么熟悉,因此就只能用vue2.0了,不想用这个前端的小伙伴,有兴趣的也可以自行搞一套。
对我而言,我主要目的是能有效完成中小项目,能对数据管理有一定帮助就行,因此,短时间内,不会对前端框架有调整。

初衷
有很多开源的go-admin,但其实都是在别的开源项目的基础上各种迭代的,代码冗余,功能冗余,结构上也不尽人意。
为了满足个人日常需要(统计数据、中小单体项目开发等),我经过多个项目的磨合,对该项目做了大量的精简和调整,也对很多功能做了重新规划和设计。
对很多人而言,仅仅需要最基础的功能,剩下的根据需要自行迭代,而这套框架也刚好满足你。

我的开发准则:
大道至简

启动

在线体验:go-admin 入口
内置两个默认账户:
账户:admin 密码:123456 顶级账户
账户:test 密码:123456 菜单权限受限的账户
注::该项目没有任何商业行为,只作为公开分享和交流,请友善体验,不要非法攻击该在线地址。所有功能对外开放,期间可能有小伙伴无意间操作导致页面显示异常,我发现后会及时恢复数据库,或者可以发Issues提醒我处理。

1. 项目结构

我将前后端都放在一个项目了,对于中小项目,这个管理反而会很方便。
其实它本质还是前后端分离。
web目录是前端目录,基于VUE2.0,完全独立,可以独立开发和部署。除了该目录,剩下的都属于后台接口的

2. 当前主要功能

基础功能:
-- 登录身份鉴权,支持session和jwt两种方式、支持单点登录
-- 公司、岗位、角色、管理员等基本通用功能
-- 数据权限管理
-- 根据模板快速生成前端页面以及后端相应业务代码,满足常用的增删改
-- 插件化管理,尽可能独立化每个功能
-- 支持mysql(20231022-打算支持postgres,先等我熟悉了,冒失新增,怕造成不稳定)
-- 接口支持多语言
-- 其余常用的功能,这里就不一一列举了

扩展功能(一般项目都能用到的)
-- app用户管理,包括对应配置管理里
-- 等级管理
-- 账变记录
-- 国际区号
-- 插件(基本的CMS内容管理、App安装包管理、消息管理)

备注:截止目前,我也不打算提供定时任务和swagger功能,对我而言,我认为完全没必要。首先,定时任务和后台耦合,每次后台发布,很容易引起定时任务的异常,定时任务完全可以搞成一个独立的脚本去运行,彻底解耦。而swagger,我只感觉鸡肋,除了给自己增加工作量,眼前还没发现任何优势。这两个功能谁如果需要,完全可以自行在现有框架中加进去。

3. 遵守规则

  1. 数据库表
    1. 系统基础表,以sys_为前缀,后面衔接模块业务名
    2. 插件表,以plugins_为前缀,后面衔接模块业务名
    3. 主业务项目,以app_为前缀,后面衔接模块业务名
  2. 项目结构
    1. 参考现有结构,时间不充裕,没法详细解释
  3. 别的规则暂时记不起来了,后面想到了我再补充

4. 部署

内置两个默认账户:
账户:admin 密码:123456 顶级账户
账户:test 密码:123456 菜单权限受限的账户

4.1 数据库部署

  1. 项目根目录的app.sql是当前的最新库,自行导入数据库即可

4.2 后台接口部署与启动

  1. 编译项目,项目根目录执行如下:
go mod tidy

# 直接编译
go build -a -o go-admin-api main.go

# 交叉编译为linux amd64:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o go-admin-api main.go
  1. 项目根目录,找到conf/,可以直接再settings.yml中配置数据库,或者可以拷贝一份,重新命名,比如:settings.dev.yml,具体的配置信息,请自行去文件中参考
  2. 启动项目,参考如下两种方式:
# 将会默认读取conf/目录中settings.yml配置,并启动接口
./admin server

# 读取自定义配置
./admin server -c=config/settings.dev.yml
  1. 启动并录入所有接口到表sys_api中,需要在启动的时候加参数-a,这样就能方便菜单接口权限管理了:
# 这是使用默认配置
./admin server -a

4.3 web页面编译和部署

  1. 依赖安装:
cd ./web
npm install --force
  1. 本地启动:
npm run dev

浏览器打开:http://127.0.0.1:1688

  1. 补充:编译:
npm run build:prod
  1. 补充:检测package.json中哪些依赖是否有用,可以精简无效依赖,我已经精简了,这里记录下:
npm i -g npm-check
cd web
npm-check

5. 其余

这里只是大概讲了下基本情况,具体更多内容,还是需要在使用中一点点去发现。

感谢

go-admin-team
flipped-aurora

go-admin's People

Contributors

bitxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-admin's Issues

后端启动报错

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x1272c0a]

后台刷新会出现404

进演示的后台,随便点击一个菜单,然后点击地址栏的刷新按钮刷新页面,就会出现404 Not Found错误,返回也一样。通过菜单按钮点击则无任何问题。
Chrome,版本 123.0.6312.122(正式版本) (x86_64)

master v1.1.0-5-gfe24fc2 Web 依赖版本冲突

依赖版本相互循环冲突,问题例举如下:
Node 初始版本v20.12.2 报 :
warning [email protected]: This project has been renamed to 'tasksfile'. Install using 'npm install tasksfile' instead.
warning runjs > [email protected]: This project has been renamed to @pawelgalazka/cli . Install using @pawelgalazka/cli instead
warning runjs > microcli > [email protected]: This project has been renamed to @pawelgalazka/cli-args. Install using @pawelgalazka/cli-args instead
warning [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
[3/5] Fetching packages...
error @achrinza/[email protected]: The engine "node" is incompatible with this module. Expected version "8 || 10 || 12 || 14 || 16 || 17". Got "20.12.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
切换Node版本为v16.20.2报
warning chokidar > [email protected]: "Please update to latest v2.3 or v2.2"
warning compression-webpack-plugin > cacache > @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
warning [email protected]: This project has been renamed to 'tasksfile'. Install using 'npm install tasksfile' instead.
warning runjs > [email protected]: This project has been renamed to @pawelgalazka/cli . Install using @pawelgalazka/cli instead
warning runjs > microcli > [email protected]: This project has been renamed to @pawelgalazka/cli-args. Install using @pawelgalazka/cli-args instead
warning [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
[3/5] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.20.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

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.