LyricTian/gin-admin
Fork: 480 Star: 2309 (更新于 1970-01-01 00:00:00)
license: Apache-2.0
Language: Go .
A lightweight, flexible, elegant and full-featured RBAC scaffolding based on GIN + GORM 2.0 + Casbin 2.0 + Wire DI.
最后发布版本: v10.0.1 ( 2023-11-07 23:00:38)
Gin-Admin
A lightweight, flexible, elegant and full-featured RBAC scaffolding based on GIN + GORM 2.0 + Casbin 2.0 + Wire DI.
English | 中文
Features
- :scroll: Follow the
RESTful API
design specification & interface-based programming specification - :house: More concise project structure, modular design, improve code readability and maintainability
- :toolbox: Based on the
GIN
framework, it provides rich middleware support (JWTAuth, CORS, RequestLogger, RequestRateLimiter, TraceID, Casbin, Recover, GZIP, StaticWebsite) - :closed_lock_with_key: RBAC access control model based on
Casbin
- :card_file_box: Database access layer based on
GORM 2.0
- :electric_plug: Dependency injection based on
WIRE
-- the role of dependency injection itself is to solve the cumbersome initialization process of hierarchical dependencies between modules - :zap: Log output based on
Zap & Context
, and unified output of key fields such as TraceID/UserID through combination with Context (also supports log hooks written toGORM
) - :key: User authentication based on
JWT
- :microscope: Automatically generate
Swagger
documentation based onSwaggo
- Preview - :test_tube: Implement API unit testing based on
testify
- :100: Stateless service, horizontally scalable, improves service availability - dynamic permission management of Casbin is implemented through scheduled tasks and Redis
- :hammer: Complete efficiency tools, can develop complete code modules through configuration - gin-admin-cli
Frontend
- Frontend project based on Ant Design React - Preview: admin/abc-123
- Frontend project based on Vue.js - Preview: admin/abc-123
Dependencies
- Go 1.19+
-
Wire
go install github.com/google/wire/cmd/wire@latest
-
Swag
go install github.com/swaggo/swag/cmd/swag@latest
-
GIN-ADMIN-CLI
go install github.com/gin-admin/gin-admin-cli/v10@latest
Quick Start
Create a new project
gin-admin-cli new -d ~/go/src --name testapp --desc 'A test API service based on golang.' --pkg 'github.com/xxx/testapp'
Start the service
cd ~/go/src/testapp
make start
# or
go run main.go start
Generate a new module
For more detailed usage instructions, please refer to gin-admin-cli
gin-admin-cli gen -d . -m CMS -s Article --structs-comment 'Article management'
Remove a module
gin-admin-cli rm -d . -m CMS -s Article
Build the service
make build
# or
go build -ldflags "-w -s -X main.VERSION=v1.0.0" -o ginadmin
Generate swagger docs
make swagger
# or
swag init --parseDependency --generalInfo ./main.go --output ./internal/swagger
Generate wire inject
make wire
# or
wire gen ./internal/wirex
Project Layout
├── cmd
│ ├── start.go
│ ├── stop.go
│ └── version.go
├── configs
│ ├── dev
│ │ ├── logging.toml (Log configuration file)
│ │ ├── middleware.toml (Middleware configuration file)
│ │ └── server.toml (Service configuration file)
│ ├── menu.json (Initialize menu file)
│ └── rbac_model.conf (Casbin RBAC model configuration file)
├── internal
│ ├── bootstrap
│ │ ├── bootstrap.go (Initialization)
│ │ ├── http.go (HTTP service)
│ │ └── logger.go (Log service)
│ ├── config (Configuration file)
│ │ ├── config.go
│ │ ├── consts.go
│ │ ├── middleware.go
│ │ └── parse.go
│ ├── mods
│ │ ├── rbac (RBAC module)
│ │ │ ├── api (API layer)
│ │ │ ├── biz (Business logic layer)
│ │ │ ├── dal (Data access layer)
│ │ │ ├── schema (Data model layer)
│ │ │ ├── casbin.go (Casbin initialization)
│ │ │ ├── main.go (Module initialization)
│ │ │ └── wire.go (Dependency injection)
│ │ ├── sys
│ │ │ ├── api
│ │ │ ├── biz
│ │ │ ├── dal
│ │ │ ├── schema
│ │ │ ├── main.go
│ │ │ └── wire.go
│ │ └── mods.go
│ ├── utility
│ │ └── prom
│ │ └── prom.go (Prometheus)
│ └── wirex (Dependency injection)
│ ├── injector.go
│ ├── wire.go
│ └── wire_gen.go
├── test (Unit test)
│ ├── menu_test.go
│ ├── role_test.go
│ ├── test.go
│ └── user_test.go
├── Dockerfile
├── Makefile
├── README.md
├── go.mod
├── go.sum
└── main.go (Entry)
Community
最近版本更新:(数据更新于 1970-01-01 00:00:00)
2023-11-07 23:00:38 v10.0.1
2023-11-06 18:14:17 v10.0.0
2021-10-25 17:10:20 v8.1.0
2021-08-16 14:14:04 v8.0.1
2021-08-02 21:28:03 v8.0.0
2021-03-28 19:31:25 v7.0.1
2020-08-31 02:06:34 v7.0.0
2020-08-31 01:43:49 v6.4.4
2020-07-02 15:08:31 v6.4.3
2020-06-24 12:13:18 v6.4.2
主题(topics):
admin, gin-admin, gin-casbin, go-admin, go-rbac, gorm, gormv2, rbac
LyricTian/gin-admin同语言 Go最近更新仓库
2024-12-22 07:52:58 navidrome/navidrome
2024-12-21 20:15:12 SagerNet/sing-box
2024-12-21 03:25:54 SpecterOps/BloodHound
2024-12-19 23:11:24 shadow1ng/fscan
2024-12-19 21:50:56 minio/minio
2024-12-19 10:04:39 istio/istio