{"id":16768048,"url":"https://github.com/tolgaozen/go-gotham","last_synced_at":"2025-03-21T23:33:51.304Z","repository":{"id":64306644,"uuid":"327615556","full_name":"tolgaOzen/go-gotham","owner":"tolgaOzen","description":"Golang RESTful API Boilerplate.","archived":false,"fork":false,"pushed_at":"2024-02-20T18:04:39.000Z","size":138,"stargazers_count":48,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T06:11:25.335Z","etag":null,"topics":["boilerplate","dependency-injection","dependency-injection-container","golang-api","golang-api-examples","golang-boilerplate","golang-framework","jwt-authentication","policies","service-pattern","singleton-pattern","solid-principles","strategy-pattern"],"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/tolgaOzen.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-07T13:10:38.000Z","updated_at":"2024-08-23T19:51:37.000Z","dependencies_parsed_at":"2024-06-20T05:43:28.660Z","dependency_job_id":"71276f3b-66fe-4a1d-86c2-7984fb802fd7","html_url":"https://github.com/tolgaOzen/go-gotham","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolgaOzen%2Fgo-gotham","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolgaOzen%2Fgo-gotham/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolgaOzen%2Fgo-gotham/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolgaOzen%2Fgo-gotham/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tolgaOzen","download_url":"https://codeload.github.com/tolgaOzen/go-gotham/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244885392,"owners_count":20526287,"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":["boilerplate","dependency-injection","dependency-injection-container","golang-api","golang-api-examples","golang-boilerplate","golang-framework","jwt-authentication","policies","service-pattern","singleton-pattern","solid-principles","strategy-pattern"],"created_at":"2024-10-13T06:10:39.647Z","updated_at":"2025-03-21T23:33:50.882Z","avatar_url":"https://github.com/tolgaOzen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![gotham](https://user-images.githubusercontent.com/39353278/103892416-99f6c880-50fc-11eb-8869-af197ca81fd1.png)\n\nI have designed go-gotham boilerplate adhering to SOLID principles for developers to help them create RESTful API. I take advantage of some other libraries however, I did not neglect to add my codes into it. The aim of this boilerplate is to provide developers a common functionality which will make writing APIs efficient, convenient and testable.\n\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://pkg.go.dev/github.com/Permify/policy-enforcer?tab=doc\" \ntarget=\"_blank\"\u003e\u003c/a\u003e\u003cimg src=\"https://img.shields.io/badge/Go-1.17+-00ADD8?style=for-the-badge\u0026logo=go\" alt=\"go version\" /\u003e\u0026nbsp;\u0026nbsp;\u003cimg src=\"https://img.shields.io/github/license/tolgaOzen/go-gotham?style=for-the-badge\" alt=\"license\" /\u003e\u0026nbsp;\u0026nbsp;\u003cimg src=\"https://img.shields.io/github/last-commit/tolgaOzen/go-gotham?style=for-the-badge\" alt=\"tweet\" /\u003e\u0026nbsp;\u0026nbsp\u003c/p\u003e\n\n\n## Check out the documentation of supporting projects \n\n- Di ( https://github.com/sarulabs/di )\n- Echo ( https://echo.labstack.com )\n- Gorm (https://gorm.io)\n- Ozzo-Validation (https://github.com/go-ozzo/ozzo-validation)\n- Echo Swagger (https://github.com/swaggo/echo-swagger)\n- GoCron (https://github.com/jasonlvhit/gocron)\n\n\n## Install\n\nYou can start using this repository by cloning it.\n\n```\ngit clone https://github.com/tolgaOzen/go-gotham\n```\n\n## Env\nchange with your database credentials\n\n```dotenv\n#DB\nDB_CONNECTION=mysql\nDB_USERNAME=admin\nDB_DATABASE=gotham\nDB_HOST=gotham-test\nDB_PORT=3306\nDB_PASSWORD=strong_password\n```\n\n## Flags\n\n- prevents re-creating container methods from definitions\n```\ngo run gotham -production\n```\n\n- run migrate methods of repositories before start\n```\ngo run gotham -migrate\n```\n\n- run seed methods of repositories before start\n```\ngo run gotham -seed\n```\n\n## FOLDER STRUCTURE\n\n```\n  /\n  |- app\n    |- container\n    |- defs\n    |- flags\n    |- provider\n    app.go\n  |- config\n  |- controllers\n  |- database\n    |- migrations\n    |- seeds\n  |- docs\n  |- helpers\n  |- infrastructures\n  |- mails\n  |- middlewares\n  |- models\n    |- scopes\n  |- policies\n  |- repositories\n    |- transactions\n  |- requests\n  |- routers\n  |- rules\n  |- services\n  |- utils\n  |- viewModels\n  |- views - (for mails)\n  main.go\n  .env\n```\n\n  ### App - DI Container\n  The container part is the part that all of our objects are injected through interfaces, as we specified in definitions.\n  \n  ### Controllers\n  Controllers are the handlers of all requests coming to the route.\n  The controller can implement interfaces to many services to meet the needs of the request. The controller must be unaware of the logic of the services.\n\n  ### Middlewares\n  Middlewares work before the request reaches the controller. These are the parts where you can perform authorization check, record requests, limit the number of requests etc. Middlewares can implement service interfaces. This way, they can check the data.\n\n  ### Policies\n  Policies folder consists of sections that check if the authorized user is eligible to perform this action.\n\n  ### Services\n  Services folder is where the business logic is based. It is responsible for processing the request from the controller. It takes data from the data layer (repositories) and works to meet what the controller expects.\n\n  ### Repositories\n  Repositories folder is the data access layer. All database queries made must be performed in the repositories.\n\n  ### Models\n  Models folder hosts all structs under models namespace, model is a struct reflecting our data object from / to database. models should only define data structs, no other functionalities should be included here.\n\n  ### ViewModels\n  ViewModels folder hosts all the structs under viewmodels namespace, viewmodels are model to be use as a response return of REST API call\n  \n## Author\n\n\u003e Tolga Özen\n\n\u003e mtolgaozen@gmail.com\n\n## License\n\nMIT License\n\nCopyright (c) 2021 Tolga Özen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\nSoftware.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftolgaozen%2Fgo-gotham","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftolgaozen%2Fgo-gotham","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftolgaozen%2Fgo-gotham/lists"}