{"id":20349536,"url":"https://github.com/bitepeng/b0boot-go","last_synced_at":"2025-09-23T12:32:19.265Z","repository":{"id":128528507,"uuid":"567660937","full_name":"bitepeng/b0boot-go","owner":"bitepeng","description":"b0boot-go：基于Go语言的高性能、极简模块化、Web开发脚手架","archived":false,"fork":false,"pushed_at":"2022-11-18T09:37:36.000Z","size":1730,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T17:51:10.256Z","etag":null,"topics":["gin","golang","web"],"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/bitepeng.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}},"created_at":"2022-11-18T09:29:07.000Z","updated_at":"2024-07-16T10:36:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a7b8b42-e3e0-43ba-966c-0f6db0968977","html_url":"https://github.com/bitepeng/b0boot-go","commit_stats":null,"previous_names":["bitepeng/b0boot-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bitepeng/b0boot-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitepeng%2Fb0boot-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitepeng%2Fb0boot-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitepeng%2Fb0boot-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitepeng%2Fb0boot-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitepeng","download_url":"https://codeload.github.com/bitepeng/b0boot-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitepeng%2Fb0boot-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276575465,"owners_count":25666674,"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-09-23T02:00:09.130Z","response_time":73,"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":["gin","golang","web"],"created_at":"2024-11-14T22:26:21.408Z","updated_at":"2025-09-23T12:32:18.702Z","avatar_url":"https://github.com/bitepeng.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# B0GO\n\u003e b0go -- 极简Go模块化Web开发脚手架\n\n\n## 技术特性\n- 极致的微内核插件化应用架构\n- 模块应用的前后端代码物理隔离\n- 减少非必要代码包装和依赖\n- 提供应用引擎和模块注册网关\n- 统一配置、统一日志、中间件支持\n\n\n## 快速开始\n\n开发应用模块，如 app1 模块，一般步骤如下：\n- 模块目录：强烈建议使用约定的目录结构开发，事半功倍。\n- 入口文件：按框架结构开发本模块的main.go\n- 其他文件：也可以按golang规则开发其他go文件，按需开发ui界面\n- 注册应用：按“应用模块注册”将本模块注册到主入口\n- 启动应用：进入main目录，启动main.go\n\n### 1. 基本规则\n#### 1.1 建议目录结构\n```\n- apps              # 应用模块根目录\n    - app1          # 应用1根目录\n        - ui        # 应用1UI资源目录\n        - main.go   # 应用1主程序\n    - docs          # 应用2根目录\n        - ui        # 应用2UI资源目录\n        - main.go   # 应用2主程序\n    ...             # 其他应用\n- core              # 内核目录\n    - engine        # 引擎目录\n    - gateway       # 网关目录\n    - tools         # 自定义工具库\n- main              # 主程序目录\n    - config.ini    # 配置文件\n    - main.go       # 入口主程序\n...\n```\n#### 1.2 路由规则\n\n\u003cp\u003e内置DevDoc：http://127.0.0.1:8081/dev/doc\u003c/p\u003e\n\n```\n一、网页内容/由docs应用提供/Markdown自动解析\n- /\t\t\t\t\t\t\t=\u003e 首页 跳转到 /docs/index.html\n- /docs/%mdfile.html%\t  \t=\u003e markdown文档 /docs/%mdfile.md%\n- /docs_root/%static%\t  \t=\u003e 静态文件 /docs_root/%static%\n\n二、网关GateWay相关/开发文档\n- /dev/doc\t\t\t\t \t=\u003e api doc 文档页面\n- /dev/api\t\t\t\t \t=\u003e api json 后端接口\n\n三、具体应用相关路由\n- /app/%appid%\t\t\t \t=\u003e 具体应用首页\n- /app/%appid%/%act%\t   \t=\u003e 具体应用api json\n```\n路由规则定义在 \"core/gateway/main.go\" 中定义\n\n\n### 2. 具体模块开发\n\n\n#### apps/app1/main.go\n```go\npackage app\n\nimport (\n\t\"b0go/core/engine\"\n\t\"embed\"\n\t\"io/fs\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\n// 定义该应用配置项\ntype AppConfig struct {\n\tName string\n}\n\n// 定义应用全局变量\nvar (\n\tapp    *engine.AppConfig\n\tappId  = \"app1\"\n\tconfig = new(AppConfig)\n\n\t//go:embed ui/dist\n\tuiFS embed.FS\n)\n\n// init()在main.go中被调用\nfunc init() {\n\tuiDist, _ := fs.Sub(uiFS, \"ui/dist\")\n\tapp = \u0026engine.AppConfig{\n\t\tName:   appId,\n\t\tType:   engine.APP_APP,\n\t\tConfig: config,\n\t\tUIFS:   uiDist,\n\t\tRun:    run,\n\t}\n\tengine.AppInstall(app)\n}\n\nfunc run() {\n\tengine.GET(appId, \"/ping\", \"{}\", \"ping\", ping)\n\tengine.POST(appId, \"/ping\", \"{}\", \"ping\", ping)\n\n}\n\nfunc ping(c *gin.Context) {\n\tc.JSON(200, gin.H{\n\t\t\"message\": appId + \" pong \" + config.Name,\n\t})\n}\n\n```\n\n### 3. 应用模块注册\n#### main/config.ini\n```ini\n[gateway]\nListenAddr = \":8081\"\nLive = true\n\n[app1]\nName = \"b0go\"\n\n[docs]\nLive = true\n```\n注意：\n- 此配置文件至少要配置[gateway]节点，其他为注册应用的配置\n- 每个注册应用（main.go的import定义）都必须在此文件有一个节点，即使没有配置项\n\n#### main/main.go\n```go\npackage main\n\nimport (\n\t_ \"b0go/apps/app1\"      //注册app1\n\t_ \"b0go/apps/docs\"      //注册docs\n\n\t\"b0go/core/engine\"\n\t_ \"b0go/core/gateway\"   //默认必须注册\n)\n\nfunc main() {\n\tengine.Run(\"config.ini\")\n\tselect {}\n}\n```\n\n### 4. 启动或打包\n#### 启动项目\n```shell\ngo run main/main.go\n```\n访问 http://127.0.0.1:8081\n#### 打包项目\n```shell\ngo build main/main.go\n```\n部署到服务器上\n\n## 技术选型\n- golang\n- gin\n- gorm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitepeng%2Fb0boot-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitepeng%2Fb0boot-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitepeng%2Fb0boot-go/lists"}