MCPcopy Index your code
hub / github.com/binbinly/gin-chat

github.com/binbinly/gin-chat @v0.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.1 ↗ · + Follow
853 symbols 2,401 edges 181 files 549 documented · 64%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

友情提示

快速体验项目在线访问地址

项目api部署在Railway,每个月前500小时可正常访问

项目介绍

gin-chat 是一套仿微信ui的即时通讯全栈学习项目,项目UI出自 uni-app实战仿微信app开发

  • 主要功能点如下 功能点
  • 项目截图 image

📗 目录结构

后端技术

  • http框架使用 Gin
  • websocket使用 Websocket
  • 数据库组件 GORM mysql连接
  • redis组件 go-redis redis连接
  • 命令行工具 Cobra
  • 文档使用 Swagger 生成
  • 配置文件解析库 Viper
  • 使用 JWT 进行身份鉴权认证
  • 校验器使用 validator 也是 Gin 框架默认的校验器
  • 包管理工具 Go Modules
  • 使用 GolangCI-lint 进行代码检测
  • 使用 make 来管理 Go 工程

前端技术

代码入口

开发环境

工具 版本号 下载
golang 1.20 https://golang.org/dl/
nodejs 18.15 https://nodejs.org/zh-cn/download/
mysql 5.7 https://www.mysql.com/
redis 6.0 https://redis.io/download
nginx 1.19 http://nginx.org/en/download.html

项目部署

1,手动编译部署

TIPS: 需要本地安装 MySQL and Redis

# 下载安装
git clone https://github.com/binbinly/gin-chat

# 进入项目目录
cd gin-chat

# 编译
make build

# 修改 mysql redis 配置
cd build/configs

# 运行
make run

2.Docker部署

docker安装文档

cd gin-chat
# 1. build image: 
docker build -t chat:latest -f Dockerfile .
# 2. start: 
docker run --rm -it -p 9050:9050 -p 9060:9060 chat:latest server
# 启动时设置 --rm 选项,这样在容器退出时就能够自动清理容器内部的文件系统

3. Railway部署 (✅推荐)

Railway每月提供5美元和最多500小时的免费额度。 1. Deploy on Railway 2. 设置环境变量来重载程序运行的参数,set env PORT => 9050 前端打包后的代码部署在 github-page

常用命令

  • make help 查看帮助
  • make init 初始化数据结构,并填充数据库表情包数据
  • make build 编译项目
  • make run 运行项目
  • make test 运行测试用例
  • make clean 清除编译文件
  • make doc 生成接口文档
  • make lint 代码检查
  • make graph 生成交互式的可视化Go程序调用图
  • make docker 生成docker镜像,确保已安装docker

📝 接口文档

TIPS: 只有本地环境开启了文档 - chat接口文档

AI辅助

其他

Extension points exported contracts — how you extend this code

Client (Interface)
Client 定义 http client 接口 [2 implementers]
pkg/client/http/client.go
IService (Interface)
IService 服务接口定义 [1 implementers]
internal/service/service.go
MomentTimeline (Interface)
MomentTimeline 朋友圈时间线数据仓库 [1 implementers]
internal/repository/moment_timeline_repo.go
PromOpt (FuncType)
PromOpt 设置 PromOpts 选项
pkg/middleware/prom.go
Option (FuncType)
(no doc)
pkg/app/options.go
Option (FuncType)
(no doc)
pkg/config/options.go
UploadForm (Interface)
see: https://github.com/shenghui0779/gochat/blob/master/wx/http.go UploadForm is the interface for http upload [1 implementers]
pkg/client/http/upload.go
Chat (Interface)
Chat 聊天会话接口 [1 implementers]
internal/service/chat_service.go

Core symbols most depended-on inside this repo

Error
called by 102
pkg/app/response.go
Run
called by 53
pkg/app/app.go
Error
called by 50
internal/api/api.go
GetUserID
called by 43
internal/api/api.go
BindJSON
called by 27
internal/api/api.go
Success
called by 25
pkg/app/response.go
SuccessNil
called by 24
pkg/app/response.go
Get
called by 18
pkg/client/http/client.go

Shape

Method 364
Function 347
Struct 111
Interface 23
FuncType 6
Class 2

Languages

Go83%
TypeScript17%

Modules by API surface

web/src/utils/chat.js45 symbols
internal/service/group_service.go36 symbols
internal/service/user_service.go24 symbols
internal/service/friend_service.go24 symbols
internal/repository/user_repo.go20 symbols
internal/service/online_service.go17 symbols
internal/service/moment_service.go17 symbols
internal/repository/group_user_repo.go17 symbols
internal/service/chat_service.go15 symbols
internal/repository/friend_repo.go15 symbols
pkg/client/http/upload.go14 symbols
web/src/store/modules/user.js13 symbols

For agents

$ claude mcp add gin-chat \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page