[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5055":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":19,"lastSyncTime":36,"discoverSource":37},5055,"go-clean-arch","bxcodec\u002Fgo-clean-arch","bxcodec","Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture","",null,"Go",10113,1306,137,26,0,6,29,2,75.25,"MIT License",false,"master",[25,26,27,28,29,30,31,32],"architecture","article","clean-architecture","database","go","golang","mysql","sql","2026-06-12 04:00:24","# go-clean-arch\n\n## Changelog\n\n- **v1**: checkout to the [v1 branch](https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch\u002Ftree\u002Fv1) \u003Cbr>\n  Proposed on 2017, archived to v1 branch on 2018 \u003Cbr>\n  Desc: Initial proposal by me. The story can be read here: https:\u002F\u002Fmedium.com\u002F@imantumorang\u002Fgolang-clean-archithecture-efd6d7c43047\n\n- **v2**: checkout to the [v2 branch](https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch\u002Ftree\u002Fv2) \u003Cbr>\n  Proposed on 2018, archived to v2 branch on 2020 \u003Cbr>\n  Desc: Improvement from v1. The story can be read here: https:\u002F\u002Fmedium.com\u002F@imantumorang\u002Ftrying-clean-architecture-on-golang-2-44d615bf8fdf\n\n- **v3**: checkout to the [v3 branch](https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch\u002Ftree\u002Fv3) \u003Cbr>\n  Proposed on 2019, merged to master on 2020. \u003Cbr>\n  Desc: Introducing Domain package, the details can be seen on this PR [#21](https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch\u002Fpull\u002F21)\n\n- **v4**: master branch\n  Proposed on 2024, merged to master on 2024. \u003Cbr>\n  Desc:\n\n  - Declare Interfaces to the consuming side,\n  - Introduce `internal` package\n  - Introduce `Service-focused` package.\n\n  Details can be seen in this PR [#88](https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch\u002Fpull\u002F88).\u003Cbr>\n\n> ### Author's Note\n>\n> You may notice it diverges from the structures seen in previous versions. I encourage you to explore the branches for each version to select the structure that appeals to you the most. In my recent projects, the code structure has progressed to version 4. However, I do not strictly advocate for one version over another. You may encounter alternative examples on the internet that align more closely with your preferences. Rest assured, the foundational concept will remain consistent or at least bear resemblance. The differences are primarily in the arrangement of directories or the integration of advanced tools directly into the setup.\n\n## Description\n\nThis is an example of implementation of Clean Architecture in Go (Golang) projects.\n\nRule of Clean Architecture by Uncle Bob\n\n- Independent of Frameworks. The architecture does not depend on the existence of some library of feature laden software. This allows you to use such frameworks as tools, rather than having to cram your system into their limited constraints.\n- Testable. The business rules can be tested without the UI, Database, Web Server, or any other external element.\n- Independent of UI. The UI can change easily, without changing the rest of the system. A Web UI could be replaced with a console UI, for example, without changing the business rules.\n- Independent of Database. You can swap out Oracle or SQL Server, for Mongo, BigTable, CouchDB, or something else. Your business rules are not bound to the database.\n- Independent of any external agency. In fact your business rules simply don’t know anything at all about the outside world.\n\nMore at https:\u002F\u002F8thlight.com\u002Fblog\u002Funcle-bob\u002F2012\u002F08\u002F13\u002Fthe-clean-architecture.html\n\nThis project has 4 Domain layer :\n\n- Models Layer\n- Repository Layer\n- Usecase Layer\n- Delivery Layer\n\n#### The diagram:\n\n![golang clean architecture](https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch\u002Fraw\u002Fmaster\u002Fclean-arch.png)\n\nThe original explanation about this project's structure can read from this medium's post : https:\u002F\u002Fmedium.com\u002F@imantumorang\u002Fgolang-clean-archithecture-efd6d7c43047.\nIt may be different already, but the concept still the same in application level, also you can see the change log from v1 to current version in Master.\n\n### How To Run This Project\n\n> Make Sure you have run the article.sql in your mysql\n\nSince the project is already use Go Module, I recommend to put the source code in any folder but GOPATH.\n\n#### Run the Testing\n\n```bash\n$ make tests\n```\n\n#### Run the Applications\n\nHere is the steps to run it with `docker-compose`\n\n```bash\n#move to directory\n$ cd workspace\n\n# Clone into your workspace\n$ git clone https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch.git\n\n#move to project\n$ cd go-clean-arch\n\n# copy the example.env to .env\n$ cp example.env .env\n\n# Run the application\n$ make up\n\n# The hot reload will running\n\n# Execute the call in another terminal\n$ curl localhost:9090\u002Farticles\n```\n\n### Tools Used:\n\nIn this project, I use some tools listed below. But you can use any similar library that have the same purposes. But, well, different library will have different implementation type. Just be creative and use anything that you really need.\n\n- All libraries listed in [`go.mod`](https:\u002F\u002Fgithub.com\u002Fbxcodec\u002Fgo-clean-arch\u002Fblob\u002Fmaster\u002Fgo.mod)\n- [\"github.com\u002Fvektra\u002Fmockery\".](https:\u002F\u002Fgithub.com\u002Fvektra\u002Fmockery) To Generate Mocks for testing needs.\n","该项目是一个基于 Uncle Bob 的 Clean Architecture 理论实现的 Go 语言项目模板。它通过定义清晰的层次结构（包括模型层、仓库层、用例层和交付层），确保业务逻辑独立于框架、UI 和数据库，从而提高了系统的可测试性和可维护性。此外，该项目支持多种数据库（如 MySQL）并遵循 MIT 许可证。适用于需要构建解耦且易于扩展的企业级应用或微服务架构场景。","2026-06-11 03:02:17","top_language"]