{"id":29878225,"url":"https://github.com/eric-guo/sponge-user_server-web-http","last_synced_at":"2025-11-03T16:48:23.622Z","repository":{"id":306743708,"uuid":"1026961659","full_name":"Eric-Guo/sponge-user_server-web-http","owner":"Eric-Guo","description":"Demo of sponge generated user_server, web, http only","archived":false,"fork":false,"pushed_at":"2025-07-27T10:17:43.000Z","size":154,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-27T11:36:55.509Z","etag":null,"topics":["ai-generated-code","go-sponge","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eric-Guo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-27T02:22:05.000Z","updated_at":"2025-07-27T10:17:46.000Z","dependencies_parsed_at":"2025-07-27T11:36:58.209Z","dependency_job_id":"825aa09b-fb6a-47b7-bff1-17f9137b7cd9","html_url":"https://github.com/Eric-Guo/sponge-user_server-web-http","commit_stats":null,"previous_names":["eric-guo/sponge-user_server-web-http"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Eric-Guo/sponge-user_server-web-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eric-Guo%2Fsponge-user_server-web-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eric-Guo%2Fsponge-user_server-web-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eric-Guo%2Fsponge-user_server-web-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eric-Guo%2Fsponge-user_server-web-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eric-Guo","download_url":"https://codeload.github.com/Eric-Guo/sponge-user_server-web-http/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eric-Guo%2Fsponge-user_server-web-http/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268003592,"owners_count":24179291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-generated-code","go-sponge","golang"],"created_at":"2025-07-31T07:01:28.398Z","updated_at":"2025-11-03T16:48:23.616Z","avatar_url":"https://github.com/Eric-Guo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Eric-Guo/sponge-user_server-web-http)\n# user_server (http, monolith)\n\n## Web 生成参数\n\n```bash\nsponge web http --module-name=testUserServer --server-name=userServer --project-name=testSponge --db-driver=mysql --db-dsn='root:@(127.0.0.1:3306)/thape_cybros_dev' --db-table=users --extended-api=true --embed=true --out=.\n```\n\n## 概述\n\n1. **服务名称与定位**  \n   - 是什么类型的服务？（如：用户管理微服务、订单处理API、数据同步任务等）\n   - 解决什么问题？（如：提供用户注册/登录能力、处理电商订单生命周期等）\n\n2. **核心功能**  \n   - 用1-3句话概括主要功能。\n\n3. **服务边界**（可选）  \n   - 如果是微服务，说明与其他服务的关系（如：依赖哪些服务/被哪些服务调用）。\n\n## 技术栈\n\n- 编程语言: go\n- Web框架: gin\n- 配置管理: viper\n- 日志: zap\n- ORM: gorm\n- 数据库: mysql\n- 缓存: go-redis\n- 监控: prometheus+grafana\n- 链路追踪: opentracing+jaeger\n- 其他: ...\n\n## 目录结构\n\n```text\n.\n├─ cmd                          # 应用程序入口目录\n│   └─ user_server                     # 服务名称\n│       ├─ initial              # 初始化逻辑(如配置加载、服务初始化等)\n│       └─ main.go              # 主程序入口文件\n├─ configs                      # 配置文件目录(yaml 格式配置模板)\n├─ deployments                  # 部署相关脚本(二进制、Docker、K8S 部署)\n├─ docs                         # 项目文档(API 文档、设计文档等)\n├─ internal                     # 内部实现代码(对外不可见)\n│   ├─ cache                    # 缓存相关实现(Redis 或本地内存缓存封装)\n│   ├─ config                   # 配置解析和结构体定义\n│   ├─ dao                      # 数据访问层(Database Access Object)\n│   ├─ ecode                    # 错误码定义\n│   ├─ handler                  # 业务逻辑处理层(类似 Controller)\n│   ├─ model                    # 数据模型/实体定义\n│   ├─ routers                  # 路由定义和中间件\n│   ├─ server                   # 服务启动\n│   └─ types                    # 请求/响应结构体定义\n├─ scripts                      # 实用脚本(如代码生成、构建、运行、部署等)\n├─ go.mod                       # Go 模块定义文件(声明依赖)\n├─ go.sum                       # Go 模块校验文件(自动生成)\n├─ Makefile                     # 项目构建自动化脚本\n└─ README.md                    # 项目说明文档\n```\n\n代码采用分层架构，完整调用链路如下：\n\n`cmd/user_server/main.go` → `internal/server/http.go` → `internal/routers/router.go` → `internal/handler` → `internal/dao` → `internal/model`\n\n其中 handler 层主要负责 API 处理，若需处理更复杂业务逻辑，建议在 handler 和 dao 之间额外添加业务逻辑层（如 `service`、`logic` 或 `biz` 等，自己定义）。\n\n## 快速开始\n\n### 1. 生成 openapi 文档\n\n```bash\nmake docs\n```\n\n注：仅当新增或修改 API 时需要执行该命令，API 未变更时无需重复执行。\n\n### 2. 编译和运行\n\n```bash\nmake run\n```\n\n### 3. 测试 API\n\n在浏览器访问 [http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html)，测试 HTTP API。\n\n## 开发指南\n\n点击查看详细的 [**开发指南**](https://go-sponge.com/zh/guide/web/based-on-sql.html)。\n\n## 部署\n\n- [裸机部署](https://go-sponge.com/zh/deployment/binary.html)\n- [Docker 部署](https://go-sponge.com/zh/deployment/docker.html)\n- [K8S 部署](https://go-sponge.com/zh/deployment/kubernetes.html)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feric-guo%2Fsponge-user_server-web-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feric-guo%2Fsponge-user_server-web-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feric-guo%2Fsponge-user_server-web-http/lists"}