{"id":19796332,"url":"https://github.com/gwuah/accounts","last_synced_at":"2025-05-01T03:30:53.681Z","repository":{"id":257195340,"uuid":"852688364","full_name":"gwuah/accounts","owner":"gwuah","description":"core banking service","archived":false,"fork":false,"pushed_at":"2024-09-17T15:14:42.000Z","size":39,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T08:12:13.541Z","etag":null,"topics":[],"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/gwuah.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":"2024-09-05T08:44:18.000Z","updated_at":"2025-03-29T13:09:26.000Z","dependencies_parsed_at":"2024-09-15T08:51:14.271Z","dependency_job_id":"8ac0dfb2-17df-4ff7-8cdb-2d6d71b57e1f","html_url":"https://github.com/gwuah/accounts","commit_stats":null,"previous_names":["gwuah/accounts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwuah%2Faccounts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwuah%2Faccounts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwuah%2Faccounts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwuah%2Faccounts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gwuah","download_url":"https://codeload.github.com/gwuah/accounts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251817886,"owners_count":21648826,"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":[],"created_at":"2024-11-12T07:19:20.803Z","updated_at":"2025-05-01T03:30:53.453Z","avatar_url":"https://github.com/gwuah.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# accounts\ncore banking service \n\n# features\n- accounts\n- add money to account\n- transfer money between accounts\n\n# considerations \n- Disable updates \u0026 deletes on transaction_lines table\n- Every transaction results in a debit and credit\n- We store lowest form of values (cents)\n- We perform balance checks before transacting between accounts\n- Deposits debit genesis account, whose balance represents total risk\n- We assume currency USD with 2 decimal places of precision\n- We use transaction references to prevent duplicate transactions (idempotency key)\n\n# improvements\n- async processing of transactions\n- support for multiple currencies\n- robust user authn \u0026 authz\n\n# setup\n#### using docker (easier)\n1. In the root of the project, run `docker compose up`\n2. This should boot up a local postgresql instance \u0026 an instance of the accounts service.\n3. Accounts service should be running on port 8080.\n\n#### barebones (doable)\n1. Ensure you have a postgres db setup with the right dbname, user, password and sslmode.\n2. Modify the Makefile in the project root, and set your `DB_URL` and `PORT`\n3. To run, `make run`\n4. To build `make build`\n5. To test `make test`\n\n\n# interactions\n```\ncurl --location 'localhost:8080/users' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"email\": \"1@gmail.com\"\n}'\n\ncurl --location 'localhost:8080/accounts' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"user_id\": 5\n}'\n\ncurl --location 'localhost:8080/transactions' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"to\": \"985270462\",\n    \"type\": \"deposit\",\n    \"amount\": 100,\n    \"reference\": \"ok\"\n}'\n\ncurl --location 'localhost:8080/transactions' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"from\": \"810093581\",\n    \"to\": \"985270462\",\n    \"type\": \"transfer\",\n    \"amount\": 100,\n    \"reference\": \"lekkero\"\n}'\n\ncurl --location 'localhost:8080/accounts/715733003'\n```\n\n# notes\nThis is an improvement on [cashapp](https://github.com/gwuah/cashapp), which I wrote 4 years ago. Code is much cleaner to follow \u0026 easier to extend. It also has quite good test coverage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwuah%2Faccounts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgwuah%2Faccounts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwuah%2Faccounts/lists"}