{"id":15096104,"url":"https://github.com/illud/gohex","last_synced_at":"2026-04-18T11:01:28.029Z","repository":{"id":184898300,"uuid":"672647777","full_name":"illud/gohex","owner":"illud","description":"Go Hexagon architecture CLI","archived":false,"fork":false,"pushed_at":"2025-07-12T22:04:52.000Z","size":154,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-13T00:14:54.527Z","etag":null,"topics":["bcrypt","cli","gin-gonic","go","golang","hexagonal-architecture","hexagonal-architecture-vertical-slicing","jwt"],"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/illud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-30T19:37:53.000Z","updated_at":"2025-07-12T22:04:57.000Z","dependencies_parsed_at":"2023-08-19T00:25:11.003Z","dependency_job_id":"11b558bd-b5e0-4473-8236-5937046a2577","html_url":"https://github.com/illud/gohex","commit_stats":{"total_commits":28,"total_committers":3,"mean_commits":9.333333333333334,"dds":0.4642857142857143,"last_synced_commit":"11366ee69b4b22bfdb9155aadf4a76c7429bce88"},"previous_names":["saturnavt/gohex","illud/gohex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/illud/gohex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illud%2Fgohex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illud%2Fgohex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illud%2Fgohex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illud%2Fgohex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/illud","download_url":"https://codeload.github.com/illud/gohex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illud%2Fgohex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31966217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bcrypt","cli","gin-gonic","go","golang","hexagonal-architecture","hexagonal-architecture-vertical-slicing","jwt"],"created_at":"2024-09-25T15:45:31.417Z","updated_at":"2026-04-18T11:01:28.019Z","avatar_url":"https://github.com/illud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gohex\n\n[![Test Status](https://github.com/illud/gohex/actions/workflows/go.yml/badge.svg)](https://github.com/illud/gohex/actions/workflows/go.yml/badge.svg)\n[![GoDoc](https://pkg.go.dev/badge/github.com/illud/gohex?status.svg)](https://pkg.go.dev/github.com/illud/gohex?tab=doc)\n[![Go Report Card](https://goreportcard.com/badge/github.com/illud/gohex)](https://goreportcard.com/report/github.com/illud/gohex)\n## Create project with Hexagonal Architecture folder structure inluding recommended way with Vertical Slicing\n\n\\\nGohex is a cli tool to create Hexagonal Architecture + Vertical Slicing app for you including gin-gonic, bcrypt and jwt.\n\n- Creates Hexagonal Architecture + Vertical Slicing project for you.\n\n\n## Features\n- Hexagonal Architecture + Vertical Slicing Folder Structure (https://en.wikipedia.org/wiki/Hexagonal_architecture_(software))\n- Gin Gonic (https://github.com/gin-gonic/gin)\n- [Swagger](#swagger) (https://github.com/swaggo/gin-swagger)\n- Jwt (https://github.com/dgrijalva/jwt-go)\n- Bcrypt (https://golang.org/x/crypto/bcrypt)\n- Auto add swagger for your endpoint\n- [Modules](#modules) - Auto generate module with crud flow\n- [Endpoint](#endpoint) - Auto add new endpoint(POST, GET, PUT, DELETE)\n- [Database Service](#database-service) - Auto generate db service client \n  - Mysql\n  - Gorm\n- Example tasks api\n- [Testing](#testing)  (Auto generate e2e test example when creating a new modules)\n\n## Installation\n\nGohex requires [Go](https://golang.org/) v1.17 or later to run.\n\nInstall the dependencies.\n\n```sh\ngo get github.com/illud/gohex\n```\nOr\n\n```sh\ngo install github.com/illud/gohex@latest\n```\n## How to use\n\nIn your terminal type to see all avaible commands:\n\n```sh\ngohex\n```\n\nTo create a new gin-gonic with Hexagonal Architecture + Vertical Slicing project(This includes a crud example with the name of Tasks):\n\n```\n▶  New Project\n  Module\n  Endpoint\n  DB Service\n\nEnter Project Name: yourprojectname\n```\n\n## Modules\n\nTo create a new module with crud flow:\nplease use snake_case when the module name consist of two or more words\n```\n  New Project\n▶  Module\n  Endpoint\n  DB Service\n\nEnter Module Name: your_module_name\n```\n\n## Endpoint\nTo add a new endpoint to your module:\n\n```\n  New Project\n  Module\n▶  Endpoint\n  DB Service\n```\n\nPick your module:\n```\n  example_module\n  example_module_two\n▶  current_module\n```\n\nPick your method:\n```\n  POST\n▶  GET\n  PUT\n  DELETE\n```\n\n## Database service\nTo create a new db service client with Mysql, Gorm or Prisma:\n\n```\n  New Project\n  Module\n  Endpoint\n▶  DB Service\n```\n\nMysql - to learn more visit (https://github.com/go-sql-driver/mysql)\n```\nEnter DB(mysql, gorm) Name: mysql\n```\n\nGorm - to learn more visit (https://github.com/jinzhu/gorm)\n```\nEnter DB(mysql, gorm) Name: gorm\n```\n\n## This will generate a database connection in data/db.go\n\n\u003cbr/\u003e\n\n### For Mysql and Gorm import the service in your repository like for example:\n\n```go\ndb \"yourProjectName/data\"\n```\n\nExample for Mysql:\n```go\n// Insert new tasks\nres, err := db.Client().Exec(\"INSERT INTO tasks VALUES(DEFAULT, 'Title', 'Desc')\")\nif err != nil {\n  fmt.Println(\"ERROR: \", err)\n}\nfmt.Println(res)\n```\nTo learn more visit (https://github.com/go-sql-driver/mysql)\n\n\nExample for Gorm:\n```go\n// Insert new tasks\nerr := db.Client().Save(\u0026tasksEntity.Task{\n  Title:       \"TEST\",\n  Description: \"This is a description\",\n})\n\nif err != nil {\n  fmt.Println(err)\n}\n```\nTo learn more visit (https://github.com/jinzhu/gorm)\n\n# Swagger\n\nBuild your application and after that, go to http://localhost:5000/swagger/index.html , you to see your Swagger UI.\n\nWhen you create a new module swagger will be added automatically then you only need to modified what you need, but remember each time you modified swagger use the next command \n\n```shell\nswag init --parseDependency github.com/volatiletech/null/v8\n```\nTo learn more visit (https://github.com/swaggo/gin-swagger)\n\n\u003cbr/\u003e\n\n# Testing\n\nTo run tests use\n```go\ngo test -v ./...\n```\nTo get coverage\n```go\ngo test -v -cover --coverprofile=coverage.out  -coverpkg=./... ./...\n```\nTo view test coverage on your browser\n```go\ngo tool cover -html=coverage.out\n```\nTotal coverage\n\nWindows\n```go\ngo tool cover -func=coverage.out | findstr total:\n```\nLinux\n```go\ngo tool cover -func=coverage.out | grep total:\n```\n\nFolder Structure:\n\n```\n│   .env\n│   .gitignore\n│   go.mod\n│   go.sum\n│   main.go\n│   README\n│   tracker.json\n│\n├───adapters\n│   ├───bcrypt\n│   │       bcrypt.go\n│   │\n│   ├───database\n│   │       db.go\n│   │\n│   └───jwt\n│           jwt.go\n│\n├───app\n│   └───tasks\n│       ├───aplication\n│       │       tasks.controller.go\n│       │\n│       ├───domain\n│       │   ├───models\n│       │   │       tasks.model.go\n│       │   │\n│       │   ├───repositories\n│       │   │       tasks.repository.go        \n│       │   │\n│       │   └───services\n│       │           tasks.service.go\n│       │\n│       └───infraestructure\n│                   tasks.db.go\n│\n├───docs\n│       docs.go\n│       swagger.json\n│       swagger.yaml\n│\n├───e2e\n│   └───tasks\n│           gettasks_test.go\n│\n├───env\n│       env.go\n│\n├───helpers\n│       errors.go\n│\n└───router\n        router.go\n```\n\n## Todo\n\n## License\n\nMIT\n\nGohex is [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fillud%2Fgohex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fillud%2Fgohex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fillud%2Fgohex/lists"}