Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quangdangfit/go-admin
RBAC scaffolding based on Gin + Gorm + Casbin + Dig
https://github.com/quangdangfit/go-admin
casbin dig gin golang gorm postgresql rbac rbac-management redis
Last synced: about 1 month ago
JSON representation
RBAC scaffolding based on Gin + Gorm + Casbin + Dig
- Host: GitHub
- URL: https://github.com/quangdangfit/go-admin
- Owner: quangdangfit
- License: mit
- Created: 2020-08-15T02:41:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-16T15:37:23.000Z (almost 2 years ago)
- Last Synced: 2024-12-18T22:02:18.420Z (about 1 month ago)
- Topics: casbin, dig, gin, golang, gorm, postgresql, rbac, rbac-management, redis
- Language: Go
- Homepage:
- Size: 191 KB
- Stars: 26
- Watchers: 3
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Admin
[![Master](https://github.com/quangdangfit/go-admin/workflows/master/badge.svg)](https://github.com/quangdangfit/go-admin/actions)RBAC scaffolding based on Gin + Gorm + Casbin + Dig
[Documentation here](https://pkg.go.dev/github.com/quangdangfit/go-admin).## How to run
### Required
- Postgres
- Redis### Config
Simply run `make startup`, or run following commands step - by - step:
- Copy config file: `cp config/config.sample.yaml config/config.yaml`
- You should modify `config/config.yaml`
```yaml
database:
host: localhost
port: 5432
name: goadmin
env: production
user: postgres
password: 1234
sslmode: disableredis:
enable: true
host: localhost
port: 6397
password:
database: 0cache:
enable: true
expiry_time: 3600
```### Migration - Create Admin User
```shell script
$ make admin
```### Run
```shell script
$ go run main.go
```### Run with docker
```shell script
$ docker-compose up -d
```### Document
* API document at: `http://localhost:8888/swagger/index.html`### Structure
```shell
├── app
│ ├── api # Handle request & response
│ ├── dbs # Database Layer
│ ├── middleware # Middlewares
│ │ ├── cache # Cache middleware
│ │ ├── jwt # JWT middleware
│ │ └── roles # Authorization middleware
│ ├── migration # Migration
│ ├── mocks # Mocks
│ ├── models # Models
│ ├── repositories # Repository Layer
│ │ └── impl # Implement repositories
│ ├── router # Router api
│ ├── schema # Schemas
│ ├── services # Business Logic Layer
│ │ └── impl # Implement services
│ └── test # Test
├── cmd # Contains commands
├── config # Config files
├── docs # Swagger API document
├── pkg # Internal packages
│ ├── app # App packages
│ ├── errors # Errors packages
│ ├── http # HTTP packages
│ ├── jwt # JWT packages
│ └── utils # Utils packages
├── scripts # Scripts
```### Techstack
- RESTful API
- Gorm
- Swagger
- Logging
- Jwt-go
- Gin
- Graceful restart or stop (fvbock/endless)
- Cron Job
- Redis
- Dig (Dependency Injection)