This project is composed of several major modules, each with its own entrypoint and deployment/operation method:
Makefile (build, test, migration, server, Docker, etc.)terraform/aws/ for infrastructure as code)web/ directory)vercel.json and frontend config)本项目由多个主要模块组成,每个模块有独立的入口和运维方式:
Makefile 统一管理(构建、测试、迁移、服务、Docker 等)terraform/aws/,基础设施即代码)web/ 目录)vercel.json 和前端配置)This project is composed of several major modules, each with its own entrypoint and deployment/operation method:
Makefile (build, test, migration, server, Docker, etc.)terraform/aws/ for infrastructure as code)web/ directory)vercel.json and frontend config)A full-stack Content Management System (CMS) built with Go (Gin, GORM, Casbin) for the backend and Vue 3 (Vite, TailwindCSS) for the frontend. Features robust RBAC (role-based access control), JWT authentication, and a modern, responsive UI. Project structure is inspired by nunu-go.
Note: All backend operations (build, test, migration, server start, etc.) should be run via the provided Makefile for consistency and reproducibility.
Backend
Frontend
.
├── api/ # API DTOs
├── cmd/ # Entrypoints (server, migration, task)
├── config/ # Config files (local.yml, prod.yml, model.conf)
├── internal/ # Main backend logic
│ ├── handler/ # HTTP handlers
│ ├── middleware/ # JWT, RBAC, CORS
│ ├── model/ # GORM models
│ ├── repository/ # Data access
│ ├── router/ # Routing
│ ├── service/ # Business logic
│ └── server/ # Server startup
├── pkg/ # Utilities (casbin, jwt, log, etc)
└── web/ # Frontend (Vue3 app)
└── src/
├── api.ts
├── components/
└── pages/
git clone https://github.com/plh97/golang-tutorial.git
cd golang-tutorial
go mod download
config/local.ymlmake migration
make server
Server: http://localhost:8291cd web
pnpm install
pnpm dev
Frontend: http://localhost:8000Business Layer (MySQL):
Access Layer (Casbin):
p, role_key, api_path, methodFlow:
Request → JWT Middleware → RBAC Middleware (Casbin) → Handler
Permission Update:
UI → Update role_permissions (GORM) → Sync casbin_rule (Casbin)
Auth
User
Role
Permission
The project uses a Makefile as the main entrypoint for backend operations. Common targets:
make build # Build the backend binarymake test # Run backend tests with coveragemake migration # Run database migrationsmake server # Start the backend servermake docker # Build and run the backend in Dockermake swag # Generate Swagger docsWire dependencies
cd cmd/server/wire
wire
Run tests
make test
Build
make build
# Frontend
cd web && pnpm build
MIT License
基于 Go (Gin, GORM, Casbin) 后端和 Vue3 (Vite, TailwindCSS) 前端的全栈内容管理系统。支持 RBAC 权限、JWT 登录、现代响应式 UI。项目结构参考 nunu-go。
注意: 所有后端操作(构建、测试、迁移、启动等)请通过项目根目录的 Makefile 执行,确保一致性和可复现性。
后端
前端
.
├── api/ # API 定义和 DTO
├── cmd/ # 启动入口(server, migration, task)
├── config/ # 配置文件(local.yml, prod.yml, model.conf)
├── internal/ # 后端主逻辑
│ ├── handler/ # HTTP 处理器
│ ├── middleware/ # JWT、RBAC、CORS
│ ├── model/ # GORM 模型
│ ├── repository/ # 数据访问
│ ├── router/ # 路由
│ ├── service/ # 业务逻辑
│ └── server/ # 启动
├── pkg/ # 工具包(casbin, jwt, log 等)
└── web/ # 前端(Vue3 应用)
└── src/
├── api.ts
├── components/
└── pages/
git clone https://github.com/plh97/golang-tutorial.git
cd golang-tutorial
go mod download
config/local.ymlmake migration
make server
地址: http://localhost:8291cd web
pnpm install
pnpm dev
地址: http://localhost:8000业务层(MySQL)
访问层(Casbin)
p, role_key, api_path, method流程:
请求 → JWT 中间件 → RBAC 中间件(Casbin)→ 处理器
权限更新:
UI → 更新 role_permissions(GORM)→ 同步 casbin_rule(Casbin)
认证
用户
角色
权限
本项目后端操作统一通过 Makefile 入口。常用命令:
make build # 构建后端二进制make test # 运行后端测试并生成覆盖率make migration # 执行数据库迁移make server # 启动后端服务make docker # Docker 构建和运行make swag # 生成 Swagger 文档生成 Wire 依赖
cd cmd/server/wire
wire
运行测试
make test
构建
make build
# 前端
cd web && pnpm build
MIT License
undefined