README-en.md 13.1 KB
Newer Older
Sliver_Horn's avatar
Sliver_Horn 已提交
1

Mr.奇淼('s avatar
Mr.奇淼( 已提交
2 3 4 5
<div align=center>
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
</div>
<div align=center>
6
<img src="https://img.shields.io/badge/golang-1.18-blue"/>
T
task 已提交
7
<img src="https://img.shields.io/badge/gin-1.9.1-lightBlue"/>
8 9 10
<img src="https://img.shields.io/badge/vue-3.3.4-brightgreen"/>
<img src="https://img.shields.io/badge/element--plus-2.3.8-green"/>
<img src="https://img.shields.io/badge/gorm-1.25.2-red"/>
Mr.奇淼('s avatar
Mr.奇淼( 已提交
11 12 13 14
</div>

English | [简体中文](./README.md)

m0_50812349's avatar
m0_50812349 已提交
15 16 17 18 19 20 21 22
[gitee](https://gitee.com/pixelmax/gin-vue-admin): https://gitee.com/pixelmax/gin-vue-admin

[github](https://github.com/flipped-aurora/gin-vue-admin): https://github.com/flipped-aurora/gin-vue-admin

[Vue3 version branch address](https://github.com/flipped-aurora/gin-vue-admin/tree/vue3Develop): https://github.com/flipped-aurora/gin-vue-admin/tree/vue3Develop

[Approval flow branch](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_workflow): https://github.com/flipped-aurora/gin-vue-admin/tree/gva_workflow

Mr.奇淼('s avatar
Mr.奇淼( 已提交
23 24 25
# Project Guidelines
[Online Documentation](https://www.gin-vue-admin.com/) : https://www.gin-vue-admin.com/

m0_50812349's avatar
m0_50812349 已提交
26
[From the environment to the deployment of teaching videos](https://www.bilibili.com/video/BV1fV411y7dT)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
27

28
[Development Steps](https://www.gin-vue-admin.com/guide/start-quickly/env.html) (Contributor:  <a href="https://github.com/LLemonGreen">LLemonGreen</a> And <a href="https://github.com/fkk0509">Fann</a>)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
29 30 31 32 33

## 1. Basic Introduction

### 1.1 Project Introduction

m0_50812349's avatar
m0_50812349 已提交
34 35 36
> Gin-vue-admin is a backstage management system based on [vue](https://vuejs.org) and [gin](https://gin-gonic.com), which separates the front and rear of the full stack. It integrates jwt authentication, dynamic routing, dynamic menu, casbin authentication, form generator, code generator and other functions. It provides a variety of sample files, allowing you to focus more time on business development.

[Online Demo](http://demo.gin-vue-admin.com): http://demo.gin-vue-admin.com
Mr.奇淼('s avatar
Mr.奇淼( 已提交
37 38 39 40 41

username:admin

password:123456

m0_50812349's avatar
m0_50812349 已提交
42
### 1.2 Contributing Guide
Mr.奇淼('s avatar
Mr.奇淼( 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

Hi! Thank you for choosing gin-vue-admin.

Gin-vue-admin is a full-stack (frontend and backend separation) framework for developers, designers and product managers.

We are excited that you are interested in contributing to gin-vue-admin. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.

#### 1.2.1 Issue Guidelines

- Issues are exclusively for bug reports, feature requests and design-related topics. Other questions may be closed directly. If any questions come up when you are using Element, please hit [Gitter](https://gitter.im/element-en/Lobby) for help.

- Before submitting an issue, please check if similar problems have already been issued.

#### 1.2.2 Pull Request Guidelines

- Fork this repository to your own account. Do not create branches here.

- Commit info should be formatted as `[File Name]: Info about commit.` (e.g. `README.md: Fix xxx bug`)

- <font color=red>Make sure PRs are created to `develop` branch instead of `master` branch.</font>

- If your PR fixes a bug, please provide a description about the related bug.

- Merging a PR takes two maintainers: one approves the changes after reviewing, and then the other reviews and merges.

### 1.3 Version list

- master: 2.0 code, for prod
- develop: 2.0 dev code, for test
Sliver_Horn's avatar
Sliver_Horn 已提交
72 73
- [gin-vue-admin_v2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 [GormV1](https://v1.gorm.io) Stable branch)
- [gva_gormv2_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_gormv2_dev) (v2.0 [GormV2](https://v2.gorm.io) Development branch)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
74 75 76

## 2. Getting started

77 78
```
- node version > v8.6.0
Mr.奇淼('s avatar
Mr.奇淼( 已提交
79
- golang version >= v1.14
80
- IDE recommendation: Goland
m0_50812349's avatar
m0_50812349 已提交
81 82
- initialization project: different versions of the database are not initialized. See synonyms at initialization https://www.gin-vue-admin.com/docs/first
- Replace the Qiniuyun public key, private key, warehouse name and default url address in the project to avoid data confusion in the test file.
83 84
```

m0_50812349's avatar
m0_50812349 已提交
85 86 87
### 2.1 server project

use `Goland` And other editing tools,open server catalogue,You can't open it. `gin-vue-admin` root directory
Mr.奇淼('s avatar
Mr.奇淼( 已提交
88 89 90

```bash
# clone the project
m0_50812349's avatar
m0_50812349 已提交
91
git clone https://github.com/flipped-aurora/gin-vue-admin.git
Mr.奇淼('s avatar
Mr.奇淼( 已提交
92

m0_50812349's avatar
m0_50812349 已提交
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
# open server catalogue
cd server

# use go mod And install the go dependency package
go generate

# Compile 
go build -o server main.go (windows the compile command is go build -o server.exe main.go )

# Run binary
./server (windows The run command is server.exe)
```

### 2.1 web project

```bash
Mr.奇淼('s avatar
Mr.奇淼( 已提交
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
# enter the project directory
cd web

# install dependency
npm install

# develop
npm run serve
```

### 2.2 Server

```bash
# using go.mod

# install go modules
go list (go mod tidy)

# build the server
go build
```

### 2.3 API docs auto-generation using swagger

#### 2.3.1 install swagger 

##### (1) Using VPN or outside mainland China
````
go get -u github.com/swaggo/swag/cmd/swag
````

##### (2) In mainland China
Sliver_Horn's avatar
Sliver_Horn 已提交
141

m0_50812349's avatar
m0_50812349 已提交
142
In mainland China, access to go.org/x is prohibited,we recommend [goproxy.io](https://goproxy.io/zh/) or [goproxy.cn](https://goproxy.cn)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
143 144

````bash
m0_50812349's avatar
m0_50812349 已提交
145 146
# If you are using a version of Go 1.13 - 1.15 Need to set up manually GO111MODULE=on, The opening mode is as follows, If your Go version is 1.16 ~ Latest edition You can ignore the following step one
# Step one、Enable Go Modules Function
Mr.奇淼('s avatar
Mr.奇淼( 已提交
147
go env -w GO111MODULE=on 
m0_50812349's avatar
m0_50812349 已提交
148 149
# Step two、Configuration GOPROXY Environment variable
go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
Mr.奇淼('s avatar
Mr.奇淼( 已提交
150

m0_50812349's avatar
m0_50812349 已提交
151 152 153 154 155
# If you dislike trouble,You can use the go generate Automatically execute code before compilation, But this can't be used command line terminal of `Goland` or `Vscode` 
cd server
go generate -run "go env -w .*?"

# 使用如下命令下载swag
156
go get -u github.com/swaggo/swag/cmd/swag
Mr.奇淼('s avatar
Mr.奇淼( 已提交
157 158 159 160 161 162 163 164
````

#### 2.3.2 API docs generation

````
cd server
swag init
````
m0_50812349's avatar
m0_50812349 已提交
165 166

> After executing the above command,server directory will appear in the docs folder `docs.go`, `swagger.json`, `swagger.yaml` Three file updates,After starting the go service, type in the browser [http://localhost:8888/swagger/index.html](http://localhost:8888/swagger/index.html) You can view swagger document
Mr.奇淼('s avatar
Mr.奇淼( 已提交
167 168 169 170


## 3. Technical selection

m0_50812349's avatar
m0_50812349 已提交
171 172 173
- Frontend: using [Element](https://github.com/ElemeFE/element) based on [Vue](https://vuejs.org),to code the page.
- Backend: using [Gin](https://gin-gonic.com/) to quickly build basic RESTful API. [Gin](https://gin-gonic.com/)is a web framework written in Go (Golang).
- DB: `MySql`(5.6.44),using [gorm](http://gorm.io)` to implement data manipulation, added support for SQLite databases.
Mr.奇淼('s avatar
Mr.奇淼( 已提交
174 175
- Cache: using `Redis` to implement the recording of the JWT token of the currently active user and implement the multi-login restriction.
- API: using Swagger to auto generate APIs docs。
m0_50812349's avatar
m0_50812349 已提交
176 177
- Config: using [fsnotify](https://github.com/fsnotify/fsnotify) and [viper](https://github.com/spf13/viper) to implement `yaml` config file。
- Log: using [zap](https://github.com/uber-go/zap) record logs。
Mr.奇淼('s avatar
Mr.奇淼( 已提交
178 179 180 181 182 183 184 185 186 187 188 189 190 191

## 4. Project Architecture

### 4.1 Architecture Diagram

![Architecture diagram](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)

### 4.2 Front-end Detailed Design Diagram (Contributor: <a href="https://github.com/baobeisuper">baobeisuper</a>)

![Front-end Detailed Design Diagram](http://qmplusimg.henrongyi.top/naotu.png)

### 4.3 Project Layout

```
m0_50812349's avatar
m0_50812349 已提交
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
    ├── server
        ├── api             (api entrance)
        │   └── v1          (v1 version interface)
        ├── config          (configuration package)
        ├── core            (core document)
        ├── docs            (swagger document directory)
        ├── global          (global object)                    
        ├── initialize      (initialization)                        
        │   └── internal    (initialize internal function)                            
        ├── middleware      (middleware layer)                        
        ├── model           (model layer)                    
        │   ├── request     (input parameter structure)                        
        │   └── response    (out-of-parameter structure)                            
        ├── packfile        (static file packaging)                        
        ├── resource        (static resource folder)                        
        │   ├── excel       (excel import and export default path)                        
        │   ├── page        (form generator)                        
        │   └── template    (template)                            
        ├── router          (routing layer)                    
        ├── service         (service layer)                    
        ├── source          (source layer)                    
        └── utils           (tool kit)                    
            ├── timer       (timer interface encapsulation)                        
            └── upload      (oss interface encapsulation)  
            
Mr.奇淼('s avatar
Mr.奇淼( 已提交
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
    └─web            (frontend)
        ├─public        (deploy templates)
        └─src           (source code)
            ├─api       (frontend APIs)
            ├─assets	(static files)
            ├─components(components)
            ├─router	(frontend routers)
            ├─store     (vuex state management)
            ├─style     (common styles)
            ├─utils     (frontend common utilitie)
            └─view      (pages)

```

## 5. Features

- Authority management: Authority management based on `jwt` and `casbin`. 
m0_50812349's avatar
m0_50812349 已提交
234 235
- File upload and download: implement file upload operations based on `Qiniuyun', `Aliyun 'and `Tencent Cloud` (please develop your own application for each platform corresponding to `token` or `key` ).
- Pagination Encapsulation:The frontend uses `mixins` to encapsulate paging, and the paging method can call `mixins` .
Mr.奇淼('s avatar
Mr.奇淼( 已提交
236 237 238 239
- User management: The system administrator assigns user roles and role permissions.
- Role management: Create the main object of permission control, and then assign different API permissions and menu permissions to the role.
- Menu management: User dynamic menu configuration implementation, assigning different menus to different roles.
- API management: Different users can call different API permissions.
m0_50812349's avatar
m0_50812349 已提交
240
- Configuration management: the configuration file can be modified in the foreground (this feature is not available in the online experience site).
Mr.奇淼('s avatar
Mr.奇淼( 已提交
241 242
- Conditional search: Add an example of conditional search.
- Restful example: You can see sample APIs in user management module.
m0_50812349's avatar
m0_50812349 已提交
243 244 245
  - Front-end file reference: [web/src/view/superAdmin/api/api.vue](https://github.com/flipped-aurora/gin-vue-admin/blob/master/web/src/view/superAdmin/api/api.vue).
  - Stage reference: [server/router/sys_api.go](https://github.com/flipped-aurora/gin-vue-admin/blob/master/server/router/sys_api.go).
- Multi-login restriction: Change `user-multipoint` to true in `system` in `config.yaml` (You need to configure redis and redis parameters yourself. During the test period, please report in time if there is a bug).
Mr.奇淼('s avatar
Mr.奇淼( 已提交
246 247 248 249
- Upload file by chunk:Provides examples of file upload and large file upload by chunk.
- Form Builder:With the help of [@form-generator](https://github.com/JakHuang/form-generator).
- Code generator: Providing backend with basic logic and simple curd code generator.

m0_50812349's avatar
m0_50812349 已提交
250
## 6. Knowledge base
Mr.奇淼('s avatar
Mr.奇淼( 已提交
251

m0_50812349's avatar
m0_50812349 已提交
252
### 6.1 Team blog
Mr.奇淼('s avatar
Mr.奇淼( 已提交
253 254 255 256 257

> https://www.yuque.com/flipped-aurora
>
>There are video courses about frontend framework in our blo. If you think the project is helpful to you, you can add my personal WeChat:shouzi_1994,your comments is welcomed。

m0_50812349's avatar
m0_50812349 已提交
258
### 6.2 Video courses
Mr.奇淼('s avatar
Mr.奇淼( 已提交
259 260

(1) Development environment course
m0_50812349's avatar
m0_50812349 已提交
261

Mr.奇淼('s avatar
Mr.奇淼( 已提交
262
> Bilibili:https://www.bilibili.com/video/BV1Fg4y187Bw/
Sliver_Horn's avatar
Sliver_Horn 已提交
263

Mr.奇淼('s avatar
Mr.奇淼( 已提交
264
(2) Template course
m0_50812349's avatar
m0_50812349 已提交
265

Mr.奇淼('s avatar
Mr.奇淼( 已提交
266 267
> Bilibili:https://www.bilibili.com/video/BV16K4y1r7BD/

m0_50812349's avatar
m0_50812349 已提交
268 269
(3) 2.0 version introduction and development experience

Mr.奇淼('s avatar
Mr.奇淼( 已提交
270 271
> Bilibili:https://www.bilibili.com/video/BV1aV411d7Gm#reply2831798461

m0_50812349's avatar
m0_50812349 已提交
272
(4) Golang basic course
Mr.奇淼('s avatar
Mr.奇淼( 已提交
273 274 275

> https://space.bilibili.com/322210472/channel/detail?cid=108884

m0_50812349's avatar
m0_50812349 已提交
276 277 278 279 280 281 282 283 284 285 286
(5) gin frame basic teaching

> bilibili:https://space.bilibili.com/322210472/channel/detail?cid=126418&ctype=0

(6) gin-vue-admin version update introduction video
> bilibili:https://space.bilibili.com/322210472/channel/detail?cid=126418&ctype=0

## 7.Contacts

### 7.1 Groups

Mr.奇淼('s avatar
Mr.奇淼( 已提交
287 288
#### QQ group: 622360840

Mr.奇淼('s avatar
Mr.奇淼( 已提交
289
| QQ group |d
Sliver_Horn's avatar
Sliver_Horn 已提交
290
|  :---:  |
Mr.奇淼('s avatar
Mr.奇淼( 已提交
291 292 293
| <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |


294
#### Wechat group: comment "加入gin-vue-admin交流群"
Mr.奇淼('s avatar
Mr.奇淼( 已提交
295

296 297 298
| Wechat |
|  :---:  | 
| <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png"> 
Mr.奇淼('s avatar
Mr.奇淼( 已提交
299

300
#### [About Us](https://www.gin-vue-admin.com/about/join.html)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
301

m0_50812349's avatar
m0_50812349 已提交
302 303 304 305 306 307 308 309 310
## 8. Contributors

Thank you for considering your contribution to gin-vue-admin!

<a href="https://github.com/flipped-aurora/gin-vue-admin/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=flipped-aurora/gin-vue-admin" />
</a>

## 9. Donate
Mr.奇淼('s avatar
Mr.奇淼( 已提交
311

312
If you find this project useful, you can buy author a glass of juice :tropical_drink: [here](https://www.gin-vue-admin.com/coffee/index.html)
Mr.奇淼('s avatar
Mr.奇淼( 已提交
313

m0_50812349's avatar
m0_50812349 已提交
314
## 10. Commercial considerations
Mr.奇淼('s avatar
Mr.奇淼( 已提交
315 316

If you use this project for commercial purposes, please comply with the Apache2.0 agreement and retain the author's technical support statement.
Mr.奇淼('s avatar
Mr.奇淼( 已提交
317