{"id":19419845,"url":"https://github.com/gsabadini/go-clean-architecture","last_synced_at":"2025-04-13T07:49:04.499Z","repository":{"id":48500297,"uuid":"241217845","full_name":"GSabadini/go-clean-architecture","owner":"GSabadini","description":"Simple API for banking routines using a Clean Architecture in Golang :credit_card: :moneybag: :money_with_wings:","archived":false,"fork":false,"pushed_at":"2024-03-13T23:12:21.000Z","size":19752,"stargazers_count":720,"open_issues_count":3,"forks_count":96,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-13T07:48:46.417Z","etag":null,"topics":["api","architecture","banking","clean-architecture","cleanarchitecture","go","go-clean-architecture","golang","golang-cleanarchitecture","golang-clear-arch","hexagonal-architecture","onion-architecture","payments"],"latest_commit_sha":null,"homepage":"","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/GSabadini.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}},"created_at":"2020-02-17T22:06:40.000Z","updated_at":"2025-04-06T21:35:09.000Z","dependencies_parsed_at":"2024-11-10T13:19:59.572Z","dependency_job_id":"480b54e4-fd3f-429d-a681-1ff01db8aa96","html_url":"https://github.com/GSabadini/go-clean-architecture","commit_stats":null,"previous_names":["gsabadini/go-clean-architecture","gsabadini/go-bank-transfer"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSabadini%2Fgo-clean-architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSabadini%2Fgo-clean-architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSabadini%2Fgo-clean-architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSabadini%2Fgo-clean-architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GSabadini","download_url":"https://codeload.github.com/GSabadini/go-clean-architecture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681494,"owners_count":21144700,"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":["api","architecture","banking","clean-architecture","cleanarchitecture","go","go-clean-architecture","golang","golang-cleanarchitecture","golang-clear-arch","hexagonal-architecture","onion-architecture","payments"],"created_at":"2024-11-10T13:19:18.065Z","updated_at":"2025-04-13T07:49:04.477Z","avatar_url":"https://github.com/GSabadini.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eWelcome to Go Clean Architecture\u003c/h1\u003e\n\u003cp\u003e\n  \u003cimg alt=\"Version\" src=\"https://img.shields.io/badge/version-1.11.0-blue.svg?cacheSeconds=2592000\" /\u003e\n  \u003ca href=\"https://goreportcard.com/badge/github.com/GSabadini/go-clean-architecture\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Build\" src=\"https://goreportcard.com/badge/github.com/GSabadini/go-clean-architecture\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#\" target=\"_blank\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/github/GSabadini/go-clean-architecture\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Build\" src=\"https://app.travis-ci.com/GSabadini/go-clean-architecture.svg?branch=master\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/GSabadini/go-clean-architecture/actions\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/GSabadini/go-clean-architecture/workflows/test/badge.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/GSabadini/go-clean-architecture\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/GSabadini/go-clean-architecture/graph/badge.svg?token=GAbOSycMO4\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n- The Go Clean Architecture is a user-friendly solution designed for a range of banking tasks, including account creation, account listing, checking the balance of specific accounts, facilitating transfers between accounts, and compiling transfer records.\n\n## Architecture\n-  This represents an endeavor to implement a clean architecture. In the event that you're not yet familiar with it, I'd like to provide you with a [reference](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html).\n\n![Clean Architecture](clean.png)\n\n## Example create account use case\n\n![Clean Architecture](create_account.png)\n\n## Requirements/dependencies\n- Docker\n- Docker-compose\n\n## Getting Started\n\n- Environment variables\n\n```sh\nmake init\n```\n\n- Starting API in development mode\n\n```sh\nmake up\n```\n\n- Run tests in container\n\n```sh\nmake test\n```\n\n- Run tests local (it is necessary to have golang installed)\n\n```sh\nmake test-local\n```\n\n- Run coverage report\n\n```sh\nmake test-report\n```\n```sh\nmake test-report-func\n```\n\n- View logs\n\n```sh\nmake logs\n```\n\n## API Request\n\n| Endpoint        | HTTP Method           | Description       |\n| --------------- | :---------------------: | :-----------------: |\n| `/v1/accounts` | `POST`                | `Create accounts` |\n| `/v1/accounts` | `GET`                 | `List accounts`   |\n| `/v1/accounts/{{account_id}}/balance`   | `GET`                |    `Find balance account` |\n| `/v1/transfers`| `POST`                | `Create transfer` |\n| `/v1/transfers`| `GET`                 | `List transfers`  |\n| `/v1/health`| `GET`                 | `Health check`  |\n\n## Test endpoints API using curl\n\n- #### Creating new account\n\n`Request`\n```bash\ncurl -i --request POST 'http://localhost:3001/v1/accounts' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"name\": \"Test\",\n    \"cpf\": \"070.910.584-24\",\n    \"balance\": 100\n}'\n```\n\n`Response`\n```json\n{\n    \"id\":\"5cf59c6c-0047-4b13-a118-65878313e329\",\n    \"name\":\"Test\",\n    \"cpf\":\"070.910.584-24\",\n    \"balance\":1,\n    \"created_at\":\"2020-11-02T14:50:46Z\"\n}\n```\n- #### Listing accounts\n\n`Request`\n```bash\ncurl -i --request GET 'http://localhost:3001/v1/accounts'\n```\n\n`Response`\n```json\n[\n    {\n        \"id\": \"5cf59c6c-0047-4b13-a118-65878313e329\",\n        \"name\": \"Test\",\n        \"cpf\": \"070.910.584-24\",\n        \"balance\": 1,\n        \"created_at\": \"2020-11-02T14:50:46Z\"\n    }\n]\n```\n\n- #### Fetching account balance\n\n`Request`\n```bash\ncurl -i --request GET 'http://localhost:3001/v1/accounts/{{account_id}}/balance'\n```\n\n`Response`\n```json\n{\n    \"balance\": 1\n}\n```\n\n- #### Creating new transfer\n\n`Request`\n```bash\ncurl -i --request POST 'http://localhost:3001/v1/transfers' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n\t\"account_origin_id\": \"{{account_id}}\",\n\t\"account_destination_id\": \"{{account_id}}\",\n\t\"amount\": 100\n}'\n```\n\n`Response`\n```json\n{\n    \"id\": \"b51cd6c7-a55c-491e-9140-91903fe66fa9\",\n    \"account_origin_id\": \"{{account_id}}\",\n    \"account_destination_id\": \"{{account_id}}\",\n    \"amount\": 1,\n    \"created_at\": \"2020-11-02T14:57:35Z\"\n}\n```\n\n- #### Listing transfers\n\n`Request`\n```bash\ncurl -i --request GET 'http://localhost:3001/v1/transfers'\n```\n\n`Response`\n```json\n[\n    {\n        \"id\": \"b51cd6c7-a55c-491e-9140-91903fe66fa9\",\n        \"account_origin_id\": \"{{account_id}}\",\n        \"account_destination_id\": \"{{account_id}}\",\n        \"amount\": 1,\n        \"created_at\": \"2020-11-02T14:57:35Z\"\n    }\n]\n```\n\n## Git workflow\n- Gitflow\n\n## Code status\n- Development\n\n## Author\n- Gabriel Sabadini Facina - [GSabadini](https://github.com/GSabadini)\n\n## License\nCopyright © 2020 [GSabadini](https://github.com/GSabadini).\nThis project is [MIT](LICENSE) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsabadini%2Fgo-clean-architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgsabadini%2Fgo-clean-architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsabadini%2Fgo-clean-architecture/lists"}