{"id":13713918,"url":"https://github.com/bencodesall/go-service-mvp","last_synced_at":"2025-05-07T00:34:08.789Z","repository":{"id":57657299,"uuid":"379700079","full_name":"bencodesall/go-service-mvp","owner":"bencodesall","description":"An exploration of REST-based web application as a service in Golang. Uses the patterns and architecture presented in ArdanLabs Service 2.0 training (which I must say is definitely worth it!)","archived":false,"fork":false,"pushed_at":"2021-09-05T15:33:30.000Z","size":2856,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-14T01:32:57.838Z","etag":null,"topics":["architecture","engineering","framework","go","golang","rest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bencodesall.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}},"created_at":"2021-06-23T18:46:45.000Z","updated_at":"2024-03-19T19:45:55.000Z","dependencies_parsed_at":"2022-08-26T04:11:31.132Z","dependency_job_id":null,"html_url":"https://github.com/bencodesall/go-service-mvp","commit_stats":null,"previous_names":["bencodesall/ardanlabs-service-2.0"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencodesall%2Fgo-service-mvp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencodesall%2Fgo-service-mvp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencodesall%2Fgo-service-mvp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencodesall%2Fgo-service-mvp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bencodesall","download_url":"https://codeload.github.com/bencodesall/go-service-mvp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252792950,"owners_count":21805051,"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","engineering","framework","go","golang","rest"],"created_at":"2024-08-02T23:01:47.606Z","updated_at":"2025-05-07T00:34:08.283Z","avatar_url":"https://github.com/bencodesall.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# go-service-mvp\n\nStatus : WiP\n\n***NOTE: Currently this README is in a VERY ROUGH state. DO NOT REFERENCE IT ;)***\n\n## Projects Setup\n\n### Master Policies\n\n1. Use precision-based semantics\n2. Make things easy to **understand**, not easy to **do**\n\n        log.Println(\"main: error: \", err)\n        os.Exit(1)\n   vs\n\n        log.Faltalln(v ...interface{})\n\n### Packaging and Package-oriented Design\n\nRules:\n\n- Where possible, packages should be as independent as possible.\n- Reduce horizontal dependencies within a package\n- Dependencies may flow down but not up (alphabetically) the layers\n\n### Layered Approach to Architecture\n\nBill Kennedy espouses a 5 layer approach to application architecture that define macro-level engineering decisions around packaging structure. These layers are represented in the directory structure as follows:\n\n- **app** - All code representing \"application level\". Binary and presentation concerns. Requests, response, cli tooling, UI/UX related to the functioning of the application\n- **business** - Solving all business rules. Databases, external systems, business layer data modeling\n- **foundation** - Non-business oriented code. Foundational code that could be reusable. Code that could potentially be moved out into a team/org custom \"standard library\" (sometimes referred to as a \"kit\" repo)\n\n### Layer Policy (Engineering Constraint)\n\n### Middleware \"Onion\"\n\n#### Onion \"Layers\"\n\n1. Readiness\n2. Auth\n3. Panic\n4. Metrics\n5. Errors\n6. Logging\n\n**Supporting \"wrap\" func**\n\nThis function takes a set of \"midlewares\" (functions) and returns them layered from right to left.\n\n```go\nfunc wrapMiddleware(mw []Middleware, handler Handler) Handler {\n\tfor i := len(mw) - 1; i \u003e= 0; i-- {\n\t\th := mw[i]\n\t\tif h != nil {\n\t\t\thandler = h(handler)\n\t\t}\n\t}\n\treturn handler\n}\n```\n\n#### Logging\n\nLogging is not an insurance policy. Logging is a engineering decision that should be precise.\n\n- Avoid \"logging levels\" and focus on correct signal to noise ratios\n- Consider the allocation, GC, and other costs of logging\n- Write logs to standard out, and do not use the singleton pattern. Pass an instance down from main.\n\n#### Configuration\n\n- Where possible, use sane defaults allowing overrides where necessary.\n- Only the `main` package is allowed to talk to configuration system. Use Config structs and/or parameters.\n- All config options need to have flags available at the command line.\n- Used config options need to be shown on startup to validate overrides.\n- Command-line flags must be implemented for overrides. \n- Command-line should include a `--help` flag to show the options.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencodesall%2Fgo-service-mvp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbencodesall%2Fgo-service-mvp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencodesall%2Fgo-service-mvp/lists"}