Skip to content

Latest commit

 

History

History
176 lines (128 loc) · 4.37 KB

File metadata and controls

176 lines (128 loc) · 4.37 KB

TD27 Admin

基于Gin+Vue3前后端分离的Golang快速开发框架

English | 中文

平台简介

  • 前端技术栈 TypeScript、Vue3、Element-Plus、Vite、Pinia
  • 后端技术栈 Golang、Gin、Gorm、MySQL、Redis、Casbin

内置功能

  • 用户管理:提供系统账号的完整 CRUD 与生命周期管理,包括角色绑定和状态切换。

  • 角色管理:权限实体,用于将角色映射到菜单和 API 接口。

  • 菜单管理:基于角色的动态路由与菜单生成。

  • 接口管理:对后端 API 路由进行角色级的访问控制。

  • 操作日志:记录用户操作与请求链路,便于审计与追踪。

  • 定时任务:支持通过 YAML 配置或前端界面进行类 Cron 的任务管理。

  • 文件管理:实现后台文件存储,提供上传、读取与删除接口。

  • 字典管理:支持嵌套字典定义,用于统一数据映射与前端渲染。

运行

默认账号密码

admin/123456

克隆项目 git clone https://github.com/pddzl/td27-admin.git

前端

# 配置
1. 一键安装 .vscode 目录中推荐的插件
2. node 版本 18+
3. pnpm 版本 8.x

# 进入项目目录
cd web

# 安装依赖
pnpm i

# 启动服务
pnpm dev

# 预览预发布环境
pnpm preview:stage

# 预览正式环境
pnpm preview:prod

# 构建预发布环境
pnpm build:stage

# 构建正式环境
pnpm build:prod

# 代码格式化
pnpm lint

后端

# 配置
1. Go >= 1.25

# 进入server文件夹
cd server

# 使用 go mod 并安装go依赖包
go generate

# 编译 
go build -o server cmd/server/main.go

# 运行二进制
./server

目录结构

├── cmd                      # Main application entry points (one folder per binary)
│   └── server               # Main HTTP server entry (main.go)
│
├── configs                  # Configuration files (YAML/JSON), config templates
│
├── docs                     # API docs, Swagger files, architecture docs
│
├── internal                 # Private application code (not for import by other modules)
│   ├── api                  # Request handlers (Gin handlers / controllers)
│   ├── core                 # Core startup logic (config load, logger, DB, server setup)
│   ├── global               # Global variables (DB, Redis, Config, Logger, etc.)
│   ├── initialize           # Init functions (router setup, config init, cron init)
│   ├── middleware           # Gin middleware
│   ├── model                # Data models: entity, request, response, VO, DTO
│   ├── pkg                  # Shared utilities (tools, common helpers, not business logic)
│   ├── router               # Router groups & route registration
│   └── service              # Business logic & database operations (service layer)
│
├── log                      # Application logs
│
├── resource                 # Static resources (images, attachments, templates)
│   └── upload               # File upload target directory
│
└── scripts                  # Shell scripts (build, deploy, maintenance)

如果选择手动部署,需要创建数据库 td27 并导入初始化数据。sql文件位置:./docker-compose/mysql/init/init.sql

swagger

cd server
swag init -g cmd/server/main.go -o docs --parseDependency --parseInternal

浏览

http://localhost:8888/swagger/index.html

一键安装

Docker Compose 版本需要 V2

git clone https://github.com/pddzl/td27-admin
cd td27-admin
docker-compose -f docker-compose/docker-compose.yml build
docker-compose -f docker-compose/docker-compose.yml up -d

浏览器打开 http://ip:8500

项目预览图

致谢

📄 License

MIT

Copyright (c) 2022-present pddzl