{"id":26948811,"url":"https://github.com/mickamy/gon","last_synced_at":"2025-04-02T21:35:34.780Z","repository":{"id":285343022,"uuid":"957770941","full_name":"mickamy/gon","owner":"mickamy","description":"Scaffold models, usecases, and handlers for Go apps with an opinionated directory layout.","archived":false,"fork":false,"pushed_at":"2025-03-31T07:14:47.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T07:28:44.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mickamy.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":"2025-03-31T05:17:56.000Z","updated_at":"2025-03-31T07:14:50.000Z","dependencies_parsed_at":"2025-03-31T07:39:04.289Z","dependency_job_id":null,"html_url":"https://github.com/mickamy/gon","commit_stats":null,"previous_names":["mickamy/gon"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fgon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fgon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fgon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickamy%2Fgon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mickamy","download_url":"https://codeload.github.com/mickamy/gon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246612484,"owners_count":20805353,"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":"2025-04-02T21:35:34.217Z","updated_at":"2025-04-02T21:35:34.769Z","avatar_url":"https://github.com/mickamy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gon\n\n\u003e Scaffold models, usecases, and handlers for Go apps with an opinionated directory layout — just like Rails, but for Go.\n\n---\n\n## ✨ Rails-like Developer Experience\n\nInspired by the Rails philosophy of *convention over configuration*, `gon` lets you scaffold everything you need for a domain entity — model, repository, usecase, and handler — with a single command.\n\n```bash\ngon g scaffold User name:string email:string\n```\n\nThis generates fully structured code under `internal/domain/user/`, just like `rails g scaffold` — but in idiomatic Go.\n\n---\n\n## ✨ Features\n\n- Rails-style generators for Go projects\n- Generate boilerplate code for Clean Architecture\n- Support for models, repositories, usecases, and handlers\n- Enforces consistent directory structure\n- Lightweight and fast CLI\n\n---\n\n## 🚀 Installation\n\n### Go 1.17 or later\n\n```bash\ngo install github.com/mickamy/gon@latest\n```\n\nMake sure `$GOPATH/bin` is in your `$PATH`.\n\n### Go 1.24 or later (with `go get -tool`)\n\n```bash\ngo get -tool github.com/mickamy/gon\n```\n\nThis installs `gon` to `$GOTOOLDIR/bin` (usually `$HOME/go/bin`).\n\n---\n\n## 📦 Initial Setup\n\n### Step 1: Create configuration file\n\n```bash\ngon init\n```\n\nThis creates a `gon.yaml` file with default settings. You can tweak output paths, package names, and template locations.\n\n### Step 2: Install templates and dependencies\n\n```bash\ngon install\n```\n\nThis command generates the database file and prepares templates required for scaffolding, including:\n\n- Embedded templates for model, repository, usecase, handler\n- Includes lightweight test helpers like `httptestutil/request.go`, generated during install for better testing experience.\n\n\u003e 💡 Make sure to run this before using `gon g` or `gon d`.\n\n---\n\n## 🧪 Usage\n\n### Generate a domain model\n\n```bash\ngon generate model User name:string email:string\n# or simply\ngon g model User name:string email:string\n```\n\n### Generate a usecase\n\n```bash\ngon g usecase CreateUser\n```\n\n### Generate a handler\n\n```bash\ngon g handler User list create\n```\n\n### Scaffold everything\n\n```bash\ngon g scaffold User name:string email:string\n```\n\nThis generates model, repository, usecase, handler, and fixture in one shot.\n\n### Destroy everything\n\n```bash\ngon d scaffold User\n```\n\nThis deletes generated files for the given domain entity.\n\n---\n\n## 📁 Output Structure\n\n```text\ninternal/\n└── domain/\n    └── user/\n        └── fixture/\n        │   └── user_fixture.go\n        ├── model/\n        │   └── user_model.go\n        ├── usecase/\n        │   ├── create_user_use_case.go\n        │   ├── get_user_use_case.go\n        │   ├── list_user_use_case.go\n        │   ├── update_user_use_case.go\n        │   └── delete_user_use_case.go\n        ├── repository/\n        │   └── user_repository.go\n        └── handler/\n            └── user_handler.go\ntest/\n└── httptestutil/\n    └── request.go\n```\n\n\u003e Each subdirectory under `domain/{name}` is a separate package.\n\n---\n\n## 🧪 Testing \u0026 Fixtures\n\nWhen generating code, `gon` also prepares test helpers to improve DX:\n\n- `httptestutil.RequestBuilder` to build and test Echo requests\n- Zero-value based fixtures with `TODO` comments for easy customization\n\n```go\npackage fixture\n\nfunc User(setter func(*model.User)) model.User {\n  m := model.User{\n    // TODO: fill in default values\n  }\n  if setter != nil {\n    setter(\u0026m)\n  }\n  return m\n}\n```\n\n---\n\n## 🛠 Template Driven\n\nTemplates are embedded using Go 1.16+ `embed` package. You can customize them by copying from the embedded defaults\nduring `gon install`.\n\n---\n\n## 📚 Example Project\n\nYou can find a working example project using `gon` under the [`example/`](./example) directory.\n\nThis example demonstrates how the generated code looks and how to structure your application using `gon`'s opinionated layout. It’s a great starting point to explore and adapt into your own Go project.\n\n---\n\n## 📄 License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickamy%2Fgon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmickamy%2Fgon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickamy%2Fgon/lists"}