{"id":25642169,"url":"https://github.com/idexter/dip-visa-app","last_synced_at":"2025-02-23T05:45:24.385Z","repository":{"id":67435911,"uuid":"243606081","full_name":"idexter/dip-visa-app","owner":"idexter","description":"Dependency Inversion Principle Example Application ","archived":false,"fork":false,"pushed_at":"2020-10-06T01:04:37.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T10:06:22.823Z","etag":null,"topics":["architecture","dip","layered-architecture"],"latest_commit_sha":null,"homepage":"https://en.wikipedia.org/wiki/Dependency_inversion_principle","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/idexter.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-27T20:05:12.000Z","updated_at":"2020-10-06T10:39:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9106f9c-61fc-40cb-8d0d-862af7001a87","html_url":"https://github.com/idexter/dip-visa-app","commit_stats":null,"previous_names":["dexterhd/dip-visa-app"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idexter%2Fdip-visa-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idexter%2Fdip-visa-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idexter%2Fdip-visa-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idexter%2Fdip-visa-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idexter","download_url":"https://codeload.github.com/idexter/dip-visa-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240275894,"owners_count":19775614,"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","dip","layered-architecture"],"created_at":"2025-02-23T05:45:23.671Z","updated_at":"2025-02-23T05:45:24.365Z","avatar_url":"https://github.com/idexter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dependency Inversion Principle Example Application\n\n![golangci-lint](https://github.com/idexter/dip-visa-app/workflows/golangci-lint/badge.svg)\n![build](https://github.com/idexter/dip-visa-app/workflows/build/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/idexter/dip-visa-app)](https://goreportcard.com/report/github.com/idexter/dip-visa-app)\n[![codecov](https://codecov.io/gh/idexter/dip-visa-app/branch/master/graph/badge.svg)](https://codecov.io/gh/idexter/dip-visa-app)\n\nThis application provides examples of DIP and how it helps to make application design better.\n\n## Repository Structure\n\nThere are 3 branches with a bit different source code but which implements the same application.\n\nThose branches are:\n- [classic-approach](https://github.com/idexter/dip-visa-app/tree/classic-approach)\n- [layers-separation](https://github.com/idexter/dip-visa-app/tree/layers-separation)\n- [dip-principle (master)](https://github.com/idexter/dip-visa-app/tree/master)\n\nEvery version has business-logic within `CheckConfirmation(applicationID int)` function/method.\nDon't focus on business-logic of this method. It's simple and made up from imagination. \nIt should not prevent you from understanding code structure, but if you are interested, I described an idea\nof application in the \"Business Logic\" section below.\n\n### classic-approach\n\nIn \"classic-approach\" an application implemented as a bunch of functions which calls each other\nto provide needed behaviour. There is no DI and no Layer Separation. Everything implemented\nwithin one package and high-level details depends on low-level modules.\n\n### layers-separation\n\nIn \"layers-separation\" branch low-level modules separated from high-level modules using packages.\nAt the same time high-level details also depends on low-level modules. There are 3 packages:\n- `visa` - This package implements our business logic (it depends on 2 packages below).\n- `report` - This package implements results storage.\n- `storage` - This package implements file storage.\n\n### dip-principle (master)\n\nIn \"dip-principle (master)\" we have final implementation of our application, but this time\nwe provide Dependency Injection, using Dependency Inversion Principle. So in this case\nhigh-level modules don't depend on low-level modules.\nThis implementation also shows how we can connect our business logic with CLI and Web interface,\nwithout changing logic itself. So it this case there are 2 binaries.\n\n## Business Logic\n\nWe are tourist, who wants to get VISA to go abroad. \nOur application provides \"Visa Application Service\".\nUsing this service we can check will be the VISA approved.\n\n- Visa Applications stored in `./data/applications.json`. It has some parameters.\n- Old VISAs are stored in `./data/visas.json`. We need them for service business logic.\n\n## Build\n\nRun `make lint` to check if code-style locally.\nRun `make build`. It will create 2 binaries inside project directory.\nRun `make clean` to remove build artifacts.\n\n- `dip-cli` - Command Line Interface Application\n- `dip-srv` - HTTP Server Application\n\n## Test\n\nRun `make test` within project directory.\n\n## Run\n\nFor CLI version:\n\n```bash\n$ ./dip-cli --id 1\n$ ./dip-cli --id 0\n```\n\nFor HTTP Server version:\n\n```bash\n$ ./dip-srv\n$ curl -v -X GET \"http://localhost:8080/?id=1\"\n$ curl -v -X GET \"http://localhost:8080/?id=3\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidexter%2Fdip-visa-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidexter%2Fdip-visa-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidexter%2Fdip-visa-app/lists"}