{"id":13806990,"url":"https://github.com/tompston/gomakeme","last_synced_at":"2025-04-14T23:33:59.582Z","repository":{"id":57649820,"uuid":"425943779","full_name":"tompston/gomakeme","owner":"tompston","description":"Generate boilerplate + endpoints for Fiber or Gin REST APIs.","archived":false,"fork":false,"pushed_at":"2022-02-21T19:59:57.000Z","size":2179,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T11:39:23.308Z","etag":null,"topics":["api","boilerplate","go","go-fiber","go-gin","rest","rest-api"],"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/tompston.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-11-08T18:06:38.000Z","updated_at":"2024-02-29T18:41:15.000Z","dependencies_parsed_at":"2022-09-05T03:00:36.801Z","dependency_job_id":null,"html_url":"https://github.com/tompston/gomakeme","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompston%2Fgomakeme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompston%2Fgomakeme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompston%2Fgomakeme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompston%2Fgomakeme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tompston","download_url":"https://codeload.github.com/tompston/gomakeme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248980111,"owners_count":21193103,"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","boilerplate","go","go-fiber","go-gin","rest","rest-api"],"created_at":"2024-08-04T01:01:19.052Z","updated_at":"2025-04-14T23:33:59.553Z","avatar_url":"https://github.com/tompston.png","language":"Go","readme":"# gomakeme\r\n\r\nGenerate boilerplate + endpoints for Fiber or Gin REST APIs.\r\n\r\n#### Table of contents\r\n\r\n- [Install](#install)\r\n- [Generate the REST API](#generate-the-rest-api)\r\n- [Explanation](#explanation)\r\n- [Config file](#config-file)\r\n- [Notes](#notes)\r\n\r\n## Install\r\n\r\n```bash\r\n# go version \u003e= 1.17\r\ngo install github.com/tompston/gomakeme@latest\r\n\r\n# go version \u003c 1.17\r\ngo get github.com/tompston/gomakeme\r\n\r\n# or clone the repo and run go run main.go\r\ngit clone https://github.com/tompston/gomakeme.git\r\n```\r\n\r\n## Generate the REST API\r\n\r\n1. Create the `gomakeme.yml` config file, copy example settings from this repo and update values\r\n2. run `gomakeme` in the directory which holds the yaml config\r\n3. cd into the created project and run\r\n\r\n```bash\r\ngo mod tidy\r\ngo mod download\r\ngofmt -s -w .\r\ngo run main.go\r\n# + change the .env vars\r\n```\r\n\r\n\u003ch3 align=\"center\"\u003e\r\n    Once generated, only the \"router/project_modules.go\" file will be updated on the next gomakeme runs. All of the other files won't be touched\r\n\u003c/h3\u003e\r\n\r\n## Explanation\r\n\r\nIt seems like one of the boring / repetitive parts of writing basic REST APIs is the boilerpate for the endpoints.\r\n\r\nWant to add a new table to the database and create endpoints for it? Before starting to do so, you need to write the new routes and controllers that deal with the common CRUD opetations.\r\n\r\nWant to add another table? Repat the same process again, but change only the name to the new table.\r\n\r\nSo this stuff is boring and repetative. That's why you can automate it.\r\n\r\n## Config file\r\n\r\n**Commented out lines + modules lines are optional**  \r\n**All of the other lines are mandatory!**\r\n\r\nCurrently there are three main options for the project that you could generate:\r\n\r\n1. Minimal server with no endpoints\r\n2. Server that uses modules\r\n3. Server that uses modules + additional boilerplate for SQLC\r\n\r\n_\\* examples of all options can be found inside examples dir_\r\n\r\nThe option you choose is based on the `gomakeme.yml` config file. If there are modules specified in the config file, they will be added to the project.\r\n\r\nFor example, if your config file has some defined modules, like\r\n\r\n```yml\r\nmodules: [User, Task]\r\n```\r\n\r\nThe `user_module` will be created in the `modules` directory.\r\n\r\n#### sqlc: true\r\n\r\nIf true, then sqlc config files and sql files for modules will also be generated inside `/db` dir. The sql files that would be used by sqlc would include\r\n\r\n- table with the name of the module + 3 frequently used columns (id, created_at, updated_at)\r\n- 5 CRUD queries with placeholder values\r\n\r\nAdditionaly a functions.sql file will be created that will hold a function that will be triggered once the db row is updated.\r\n\r\nNo migration tools included, SQLC documentation lists some possible [options](https://docs.sqlc.dev/en/latest/howto/ddl.html?highlight=migr#handling-sql-migrations) that could be used, so check them out and pick one that you like the most.\r\n\r\n#### include_db_snippet: true\r\n\r\nIf true, includes a snippet inside the controllers that can create a connection to the database\r\n\r\n#### Adding new modules\r\n\r\nOn each run the program checks if the module specified in the config file exists in the `project_name/modules/` dir. If a new module is added in the modules array, it will be added to the generated server.\r\n\r\n### Module\r\n\r\nA single module will hold 5 basic CRUD endpoints that will be automatically available to the server. The generated controllers are held in seperate files, where the name of the file indicates what type of http request is associated with it. The controllers can also hold common functions, such as\r\n\r\n- validation of url params, if there are any\r\n- validation and custom error messages for the sent payloads\r\n- database connection ( if set to true in the config file )\r\n\r\nOnce the directory for the `user_module` is created, it won't be updated if you run the `gomakeme` again, so you can edit them.\r\n\r\n## Notes\r\n\r\n- Taking a bit of inspiration from Nest.js, we bundle router + controllers into one package.\r\n- There are probably bugs. Somewhere\r\n\r\n\u003c!--\r\n\r\n# wsl\r\nexport PATH=$PATH:/usr/local/go/bin\r\n\r\nGOOS=linux go build -o main .\r\nGOOS=linux go build -o ./gomakeme\r\nGOOS=linux go build -o ./gomakeme_linux\r\nGOOS=linux GOARCH=amd64 go build -o ./gomakeme_linux_amd64\r\nGOOS=windows go build -o ./bin/gomakeme_win\r\n\r\n-- publishing\r\nhttps://go.dev/doc/modules/publishing\r\n\r\ngo mod tidy\r\ngit add .\r\ngit commit -m \"v0.0.6\"\r\ngit tag v0.0.6\r\ngit push origin v0.0.6\r\nGOPROXY=proxy.golang.org go list -m github.com/tompston/gomakeme@v0.0.6\r\n\r\n\r\n{{- if ( eq .ProjectInfo.Framework \"fiber\") }}\r\n// Content\r\n{{- end }}\r\n\r\n{{- if ( eq .ProjectInfo.Framework \"gin\") }}\r\n// Content\r\n{{- end }}\r\n\r\n\r\n- Breaking Changes from 0.0.4 -\u003e 0.0.5 !\r\n- Now has support for 2 go frameworks -\u003e Gin and Fiber\r\n- refactored predefined responses to be a single function \r\n- Removed functions that return API messages\r\n\r\n--\u003e","funding_links":[],"categories":["🛠️ Tools"],"sub_categories":["🌱 Third Party"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftompston%2Fgomakeme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftompston%2Fgomakeme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftompston%2Fgomakeme/lists"}