mcpField
G
go-backend-clean-architecture

go-backend-clean-architecture

github.com/rebyteai-template开发17100 次安装19 周前更新
代码仓库

关于 go-backend-clean-architecture

go-backend-clean-architecture 是 Go 后端起始模板,采用 Clean Architecture,结合 Gin、MongoDB 和 JWT 身份验证,并支持 Docker,适合搭建后端项目。

主要功能

  1. 01基于 Clean Architecture 的 Go 后端
  2. 02Gin 框架
  3. 03MongoDB 集成
  4. 04JWT 身份验证
  5. 05Docker 支持

适用场景

  1. 01启动 Go 后端项目
  2. 02使用 Gin 和 MongoDB 构建 API
  3. 03配置基于 JWT 的身份验证
  4. 04使用 Docker 运行项目

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/rebyteai-template/rebyte-skills --skill go-backend-clean-architecture

安装后在 Claude Code 中输入/go-backend-clean-architecture确认已加载。

详细介绍

Go Clean Architecture

一个采用 Gin、MongoDB、JWT 身份验证并支持 Docker 的 Go 后端,遵循 Clean Architecture 原则。

技术栈

  • 框架:Gin
  • 语言:Go
  • 数据库:MongoDB
  • 身份验证:JWT
  • 架构:Clean Architecture

前置条件

  • Go 1.21+
  • MongoDB
  • Docker(可选)

设置

1. 克隆模板
git clone --depth 1 https://github.com/amitshekhariitbhu/go-backend-clean-architecture.git .

如果目录不为空:

git clone --depth 1 https://github.com/amitshekhariitbhu/go-backend-clean-architecture.git _temp_template
mv _temp_template/* _temp_template/.* . 2>/dev/null || true
rm -rf _temp_template
2. 移除 Git 历史记录(可选)
rm -rf .git
git init
3. 安装依赖
go mod download
4. 设置环境

配置 MongoDB 连接和 JWT 密钥。

构建

go build -o app ./cmd/main.go

开发

go run ./cmd/main.go

评论

支持 Markdown