RBAC scaffolding based on Gin + Gorm + Casbin + Dig
Documentation here.
- Postgres
- Redis
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
database:
host: localhost
port: 5432
name: goadmin
env: production
user: postgres
password: 1234
sslmode: disable
redis:
enable: true
host: localhost
port: 6397
password:
database: 0
cache:
enable: true
expiry_time: 3600
$ make admin
$ go run main.go
$ docker-compose up -d
- API document at:
http://localhost:8888/swagger/index.html
├── 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
- RESTful API
- Gorm
- Swagger
- Logging
- Jwt-go
- Gin
- Graceful restart or stop (fvbock/endless)
- Cron Job
- Redis
- Dig (Dependency Injection)