{"id":14956775,"url":"https://github.com/zhashkevych/go-clean-architecture","last_synced_at":"2025-04-04T14:07:52.214Z","repository":{"id":38486791,"uuid":"213705506","full_name":"zhashkevych/go-clean-architecture","owner":"zhashkevych","description":"👨‍💻 REST API example, built by following Uncle Bob’s clean architecture principles","archived":false,"fork":false,"pushed_at":"2023-03-07T03:40:43.000Z","size":73,"stargazers_count":707,"open_issues_count":5,"forks_count":101,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-28T13:08:27.587Z","etag":null,"topics":["architecture","clean-architecture","clean-code","docker","docker-compose","go","golang","golang-api","golang-api-examples","jwt","mongo","mongodb","rest-api"],"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/zhashkevych.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":"2019-10-08T17:16:11.000Z","updated_at":"2025-03-28T12:18:22.000Z","dependencies_parsed_at":"2024-06-18T20:10:36.028Z","dependency_job_id":"7fb056f9-eed4-471b-b407-945b15beafe9","html_url":"https://github.com/zhashkevych/go-clean-architecture","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhashkevych%2Fgo-clean-architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhashkevych%2Fgo-clean-architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhashkevych%2Fgo-clean-architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhashkevych%2Fgo-clean-architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhashkevych","download_url":"https://codeload.github.com/zhashkevych/go-clean-architecture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190250,"owners_count":20898702,"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","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":["architecture","clean-architecture","clean-code","docker","docker-compose","go","golang","golang-api","golang-api-examples","jwt","mongo","mongodb","rest-api"],"created_at":"2024-09-24T13:13:30.109Z","updated_at":"2025-04-04T14:07:52.185Z","avatar_url":"https://github.com/zhashkevych.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Clean Architecture\nExample that shows core principles of the Clean Architecture in Golang projects.\n\n## \u003ca href=\"https://www.zhashkevych.com/clean-architecture\"\u003eBlog Post\u003c/a\u003e\n\n## Rules of Clean Architecture by Uncle Bob:\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- Idependent of any external agency. In fact your business rules simply don’t know anything at all about the outside world. \n\nMore on topic can be found \u003ca href=\"https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html\"\u003ehere\u003c/a\u003e.\n\n### Project Description\u0026Structure:\nREST API with custom JWT-based authentication system. Core functionality is about creating and managing bookmarks (Simple clone of \u003ca href=\"https://app.getpocket.com/\"\u003ePocket\u003c/a\u003e).\n\n#### Structure:\n4 Domain layers:\n\n- Models layer\n- Repository layer\n- UseCase layer\n- Delivery layer\n\n## API:\n\n### POST /auth/sign-up\n\nCreates new user \n\n##### Example Input: \n```\n{\n\t\"username\": \"UncleBob\",\n\t\"password\": \"cleanArch\"\n} \n```\n\n\n### POST /auth/sign-in\n\nRequest to get JWT Token based on user credentials\n\n##### Example Input: \n```\n{\n\t\"username\": \"UncleBob\",\n\t\"password\": \"cleanArch\"\n} \n```\n\n##### Example Response: \n```\n{\n\t\"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzEwMzgyMjQuNzQ0MzI0MiwidXNlciI6eyJJRCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsIlVzZXJuYW1lIjoiemhhc2hrZXZ5Y2giLCJQYXNzd29yZCI6IjQyODYwMTc5ZmFiMTQ2YzZiZDAyNjlkMDViZTM0ZWNmYmY5Zjk3YjUifX0.3dsyKJQ-HZJxdvBMui0Mzgw6yb6If9aB8imGhxMOjsk\"\n} \n```\n\n### POST /api/bookmarks\n\nCreates new bookmark\n\n##### Example Input: \n```\n{\n\t\"url\": \"https://github.com/zhashkevych/go-clean-architecture\",\n\t\"title\": \"Go Clean Architecture example\"\n} \n```\n\n### GET /api/bookmarks\n\nReturns all user bookmarks\n\n##### Example Response: \n```\n{\n\t\"bookmarks\": [\n            {\n                \"id\": \"5da2d8aae9b63715ddfae856\",\n                \"url\": \"https://github.com/zhashkevych/go-clean-architecture\",\n                \"title\": \"Go Clean Architecture example\"\n            }\n    ]\n} \n```\n\n### DELETE /api/bookmarks\n\nDeletes bookmark by ID:\n\n##### Example Input: \n```\n{\n\t\"id\": \"5da2d8aae9b63715ddfae856\"\n} \n```\n\n\n## Requirements\n- go 1.13\n- docker \u0026 docker-compose\n\n## Run Project\n\nUse ```make run``` to build and run docker containers with application itself and mongodb instance\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhashkevych%2Fgo-clean-architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhashkevych%2Fgo-clean-architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhashkevych%2Fgo-clean-architecture/lists"}