github.com/kotovmak/go-admin@v1.1.1/README.md (about)

     1  <p align="center">
     2    <a href="https://github.com/GoAdminGroup/go-admin">
     3      <img width="48%" alt="go-admin" src="http://quick.go-admin.cn/official/assets/imgs/github_logo.png">
     4    </a>
     5  </p>
     6  
     7  <p align="center">
     8      the missing golang data admin panel builder tool.
     9  </p>
    10  
    11  <p align="center">
    12      <a href="https://book.go-admin.cn/en">Documentation</a> | 
    13  	<a href="http://doc.go-admin.cn/zh/">中文文档</a> | 
    14      <a href="./README_CN.md">中文介绍</a> |
    15      <a href="https://demo.go-admin.com">DEMO</a> |
    16      <a href="https://demo.go-admin.cn">中文DEMO</a> |
    17      <a href="https://twitter.com/cg3365688034">Twitter</a> |
    18      <a href="http://discuss.go-admin.com">Forum</a>
    19  </p>
    20  
    21  <p align="center">
    22    <a href="http://drone.go-admin.com/GoAdminGroup/go-admin"><img alt="Build Status" src="http://drone.go-admin.com/api/badges/GoAdminGroup/go-admin/status.svg?ref=refs/heads/master"></a>
    23    <a href="https://goreportcard.com/report/github.com/GoAdminGroup/go-admin"><img alt="Go Report Card" src="https://camo.githubusercontent.com/59eed852617e19c272a4a4764fd09c669957fe75/68747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f6769746875622e636f6d2f6368656e6867352f676f2d61646d696e"></a>
    24    <a href="https://goreportcard.com/report/github.com/GoAdminGroup/go-admin"><img alt="golang" src="https://img.shields.io/badge/awesome-golang-blue.svg"></a>
    25    <a href="https://t.me/joinchat/NlyH6Bch2QARZkArithKvg" rel="nofollow"><img alt="telegram" src="https://img.shields.io/badge/chat%20on-telegram-blue" style="max-width:100%;"></a>
    26    <a href="https://goadmin.slack.com"><img alt="slack" src="https://img.shields.io/badge/chat on-Slack-yellow.svg"></a>
    27    <a href="https://godoc.org/github.com/GoAdminGroup/go-admin" rel="nofollow"><img src="https://camo.githubusercontent.com/a9a286d43bdfff9fb41b88b25b35ea8edd2634fc/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f646572656b7061726b65722f64656c76653f7374617475732e737667" alt="GoDoc" data-canonical-src="https://godoc.org/github.com/derekparker/delve?status.svg" style="max-width:100%;"></a>
    28    <a href="https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/LICENSE" rel="nofollow"><img src="https://img.shields.io/badge/license-Apache2.0-blue.svg" alt="license" data-canonical-src="https://img.shields.io/badge/license-Apache2.0-blue.svg" style="max-width:100%;"></a>
    29  </p> 
    30  
    31  <p align="center">
    32      Inspired by <a href="https://github.com/z-song/laravel-admin" target="_blank">laravel-admin</a>
    33  </p>
    34  
    35  ## Preface
    36  
    37  GoAdmin is a toolkit to help you build a data visualization admin panel for your golang app.
    38  
    39  Online demo: [https://demo.go-admin.com](https://demo.go-admin.com)
    40  
    41  Quick follow up example: [https://github.com/GoAdminGroup/example](https://github.com/GoAdminGroup/example)
    42  
    43  GoAdmin+vue example: [https://github.com/GoAdminGroup/goadmin-vue-example](https://github.com/GoAdminGroup/goadmin-vue-example)
    44  
    45  ![interface](http://file.go-admin.cn/introduction/interface_en_3.png)
    46  
    47  ## Features
    48  
    49  - 🚀 **Fast**: build a production admin panel app in **ten** minutes.
    50  - 🎨 **Theming**: beautiful ui themes supported(default adminlte, more themes are coming.)
    51  - 🔢 **Plugins**: many plugins to use(more useful and powerful plugins are coming.)
    52  - ✅ **Rbac**: out of box rbac auth system.
    53  - ⚙️ **Frameworks**: support most of the go web frameworks.
    54  
    55  ## Translation
    56  We need your help: [https://github.com/GoAdminGroup/docs/issues/1](https://github.com/GoAdminGroup/docs/issues/1)
    57  
    58  ## Who is using
    59  
    60  [Comment the issue to tell us](https://github.com/kotovmak/go-admin/issues/71).
    61  
    62  ## How to
    63  
    64  Following three steps to run it.
    65  
    66  Note: now you can quickly start by doing like this.
    67  
    68  ```shell
    69  $ go install github.com/GoAdminGroup/adm@latest
    70  $ mkdir new_project && cd new_project
    71  $ adm init
    72  ```
    73  
    74  Or (use adm whose version higher or equal than v1.2.16)
    75  
    76  ```shell
    77  $ mkdir new_project && cd new_project
    78  $ go install github.com/GoAdminGroup/adm@latest
    79  $ adm init web
    80  ```
    81  
    82  ### Step 1: import sql
    83  
    84  - [mysql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.sql)
    85  - [mssql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.mssql)
    86  - [postgresql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.pgsql)
    87  - [sqlite](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.db)
    88  - [OceanBase](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.sql)
    89  
    90  
    91  ### Step 2: create main.go
    92  
    93  <details><summary>main.go</summary>
    94  <p>
    95  
    96  ```go
    97  package main
    98  
    99  import (
   100  	"github.com/gin-gonic/gin"
   101  	_ "github.com/kotovmak/go-admin/adapter/gin"
   102  	_ "github.com/kotovmak/go-admin/modules/db/drivers/mysql"
   103  	"github.com/kotovmak/go-admin/engine"
   104  	"github.com/kotovmak/go-admin/plugins/admin"
   105  	"github.com/kotovmak/go-admin/modules/config"
   106  	"github.com/GoAdminGroup/themes/adminlte"
   107  	"github.com/kotovmak/go-admin/template"
   108  	"github.com/kotovmak/go-admin/template/chartjs"
   109  	"github.com/kotovmak/go-admin/template/types"
   110  	"github.com/kotovmak/go-admin/examples/datamodel"
   111  	"github.com/kotovmak/go-admin/modules/language"
   112  )
   113  
   114  func main() {
   115  	r := gin.Default()
   116  
   117  	eng := engine.Default()
   118  
   119  	// global config
   120  	cfg := config.Config{
   121  		Databases: config.DatabaseList{
   122  			"default": {
   123  				Host:         "127.0.0.1",
   124  				Port:         "3306",
   125  				User:         "root",
   126  				Pwd:          "root",
   127  				Name:         "goadmin",
   128  				MaxIdleConns: 50,
   129  				MaxOpenConns: 150,
   130  				ConnMaxLifetime: time.Hour,
   131  				Driver:       "mysql",
   132  			},
   133          	},
   134  		UrlPrefix: "admin",
   135  		// STORE is important. And the directory should has permission to write.
   136  		Store: config.Store{
   137  		    Path:   "./uploads", 
   138  		    Prefix: "uploads",
   139  		},
   140  		Language: language.EN,
   141  		// debug mode
   142  		Debug: true,
   143  		// log file absolute path
   144  		InfoLogPath: "/var/logs/info.log",
   145  		AccessLogPath: "/var/logs/access.log",
   146  		ErrorLogPath: "/var/logs/error.log",
   147  		ColorScheme: adminlte.ColorschemeSkinBlack,
   148  	}
   149  
   150  	// add component chartjs
   151  	template.AddComp(chartjs.NewChart())
   152  
   153  	_ = eng.AddConfig(&cfg).
   154  		AddGenerators(datamodel.Generators).
   155  	        // add generator, first parameter is the url prefix of table when visit.
   156      	        // example:
   157      	        //
   158      	        // "user" => http://localhost:9033/admin/info/user
   159      	        //		
   160  		AddGenerator("user", datamodel.GetUserTable).
   161  		Use(r)
   162  	
   163  	// customize your pages
   164  	eng.HTML("GET", "/admin", datamodel.GetContent)
   165  
   166  	_ = r.Run(":9033")
   167  }
   168  ```
   169  
   170  </p>
   171  </details>
   172  
   173  More framework examples: [https://github.com/kotovmak/go-admin/tree/master/examples](https://github.com/kotovmak/go-admin/tree/master/examples)
   174  
   175  ### Step 3: run
   176  
   177  ```shell
   178  GO111MODULE=on go run main.go
   179  ```
   180  
   181  visit: [http://localhost:9033/admin](http://localhost:9033/admin)
   182  
   183  account: admin password: admin
   184  
   185  [A super simple example here](https://github.com/GoAdminGroup/example)
   186  
   187  See the [docs](https://book.go-admin.cn) for more details.
   188  
   189  ## Backers
   190  
   191   Your support will help me do better! [[Become a backer](https://opencollective.com/go-admin#backer)]
   192   <a href="https://opencollective.com/go-admin#backers" target="_blank"><img src="https://opencollective.com/go-admin/backers.svg?width=890"></a>
   193  
   194  ## Contribution
   195  
   196  [here for contribution guide](CONTRIBUTING.md)
   197  
   198  <strong>here to join into the develop team</strong>
   199  
   200  [join telegram](https://t.me/joinchat/NlyH6Bch2QARZkArithKvg)