{"id":26235614,"url":"https://github.com/onexstack/miniblog","last_synced_at":"2025-10-11T01:03:49.695Z","repository":{"id":265390610,"uuid":"895894691","full_name":"onexstack/miniblog","owner":"onexstack","description":"微博客：小而美的高质量 Go 实战项目","archived":false,"fork":false,"pushed_at":"2025-06-06T14:19:54.000Z","size":2336,"stargazers_count":175,"open_issues_count":0,"forks_count":46,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-20T10:35:08.234Z","etag":null,"topics":["ai","cloudnative","docker","go","golang","kubernetes"],"latest_commit_sha":null,"homepage":"https://konglingfei.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onexstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-29T06:12:23.000Z","updated_at":"2025-09-18T06:01:20.000Z","dependencies_parsed_at":"2025-04-22T17:05:09.192Z","dependency_job_id":"c5d1556a-ee80-4e84-bc33-e92cf0bfa2f7","html_url":"https://github.com/onexstack/miniblog","commit_stats":null,"previous_names":["superproj/miniblog","onexstack/miniblog"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/onexstack/miniblog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fminiblog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fminiblog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fminiblog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fminiblog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onexstack","download_url":"https://codeload.github.com/onexstack/miniblog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fminiblog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005830,"owners_count":26083981,"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-10-10T02:00:06.843Z","response_time":62,"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","cloudnative","docker","go","golang","kubernetes"],"created_at":"2025-03-13T03:16:45.323Z","updated_at":"2025-10-11T01:03:49.687Z","avatar_url":"https://github.com/onexstack.png","language":"Go","readme":"# miniblog 项目\n\n## 项目介绍\n\n**小而美的 Go 实战项目，入门但不简单。**\n\nminiblog（微博客） 是一个 Go 语言入门项目，用来完成用户注册、博客创建等业务功能。miniblog 入门但不简单：\n\n- **入门：** 适用于刚学习完 Go 基础语法，零项目开发经验的 Go 开发者；\n- **不简单：** 本项目来自于一线企业的大型线上项目，项目本身是一个企业级的项目，学习完之后，完全可以用来作为企业级项目的开发脚手架。\n\nminiblog 实现了以下 2 类功能：\n- **用户管理：** 支持用户注册、用户登录、获取用户列表、获取用户详情、更新用户信息、修改用户密码等操作；\n- **博客管理：** 支持创建博客、获取博客列表、获取博客详情、更新博客内容、删除博客等操作。\n\n## 功能特点\n\n- 软件架构：采用简洁架构设计，确保项目结构清晰、易维护；\n- 高频 Go 包：使用了 Go 项目开发中常用的包，如 gorm、casbin、govalidator、jwt-go、gin、cobra、viper、pflag、zap、pprof、grpc、protobuf、uuid、grpc-gateway 等；\n- 目录结构：遵循 project-layout 规范，采用标准化的目录结构；\n- 认证与授权：实现了基于 JWT 的认证和基于 Casbin 的授权功能；\n- 日志与错误处理：设计了独立的日志包和错误码管理机制；\n- 构建与管理：使用高质量的 Makefile 对项目进行管理；\n- 代码质量：通过 golangci-lint 工具对代码进行静态检查，确保代码质量；\n- 测试覆盖：包含单元测试、性能测试、模糊测试和示例测试等多种测试案例；\n- 丰富的 Web 功能：支持请求 ID、优雅关停、中间件、跨域处理、异常恢复等功能；\n- 多种服务器类型：实现了 gRPC 服务器、HTTP 服务器和 HTTP 反向代理服务器；\n- 多种数据交换格式：支持 JSON 和 Protobuf 数据格式的交换；\n- 开发规范：遵循多种开发规范，包括代码规范、版本规范、接口规范、日志规范、错误规范以及提交规范等；\n- API 设计：接口设计遵循 RESTful API 规范，并提供 OpenAPI 3.0 和 Swagger 2.0 格式的 API 文档；\n- 部署难度低：实战项目可以快速部署。\n\n## 快速开始\n\n要求 Go 版本 \u003e= 1.23.4。安装命令如下：\n\n```bash\n$ git clone https://github.com/onexstack/miniblog.git # 克隆项目\n$ cd miniblog\n$ go work init . # 初始化 Go 工作区\n$ go work use .\n$ make build BINS=mb-apiserver # 编译源码\n$ _output/platforms/linux/amd64/mb-apiserver\n$ curl http://127.0.0.1:5555/healthz # 调用健康检查接口，测试是否安装成功（HTTPS 协议）\n{\"timestamp\":\"2024-12-26 23:50:29\"}\n$ go run examples/client/health/main.go # 测试健康检查接口（gRPC 协议）\n$ go run examples/client/user/main.go # 测试用户相关接口（gRPC 协议）\n$ go run examples/client/post/main.go # 测试博客相关接口（gRPC 协议）\n```\n\nmb-apiserver 支持内存数据库和 MySQL 数据库，默认使用内存数据库启动。如果你想切换为 MySQL 数据库请按以下方式准备一个 MySQL 数据库：\n- 您可以根据 [安装和配置 MariaDB 数据库](./docs/devel/zh-CN/mysql.md) 文档中的指引，安装并初始化一个 `miniblog` 数据库；\n- 如果您有自己的数据库，请使用 `configs/miniblog.sql` 中的 SQL 初始化 miniblog 依赖的数据库及表，并更新 `configs/mb-apiserver.yaml` 文件中 `mysql` 配置项中的 `host`、`username`、`password`、`database`。\n\n并修改 configs/mb-apiserver.yaml 文件中的 `enable-memory-store` 为 `false`。\n\n## Documentation\n\n[用户手册](./docs/guide/zh-CN/README.md)、[开发手册](./docs/devel/zh-CN/README.md)\n\n## Feedback\n\n如果您有任何反馈，请通过 `colin404@foxmail.com` 与我联系。\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonexstack%2Fminiblog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonexstack%2Fminiblog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonexstack%2Fminiblog/lists"}