{"id":15096032,"url":"https://github.com/ruyjfs/example-golang","last_synced_at":"2026-03-07T01:35:38.906Z","repository":{"id":57558939,"uuid":"318016861","full_name":"ruyjfs/example-golang","owner":"ruyjfs","description":"Golang, Gin Framework, GQLGen GraphQL, Resful, Authentitacion with JWT and much more.","archived":false,"fork":false,"pushed_at":"2020-12-06T23:22:21.000Z","size":16651,"stargazers_count":20,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-08T23:19:49.996Z","etag":null,"topics":["gin-framework","gin-gonic","golang","gorm","gorm-migrate","gorm-migration","gorm-model","gorm-orm","gorm-sample","gqlgen","graphql","graphql-api","graphql-go","graphql-golang","graphql-server"],"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/ruyjfs.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":"2020-12-02T23:14:44.000Z","updated_at":"2024-08-10T06:08:28.000Z","dependencies_parsed_at":"2022-09-18T04:21:39.641Z","dependency_job_id":null,"html_url":"https://github.com/ruyjfs/example-golang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ruyjfs/example-golang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruyjfs%2Fexample-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruyjfs%2Fexample-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruyjfs%2Fexample-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruyjfs%2Fexample-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruyjfs","download_url":"https://codeload.github.com/ruyjfs/example-golang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruyjfs%2Fexample-golang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30205222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["gin-framework","gin-gonic","golang","gorm","gorm-migrate","gorm-migration","gorm-model","gorm-orm","gorm-sample","gqlgen","graphql","graphql-api","graphql-go","graphql-golang","graphql-server"],"created_at":"2024-09-25T15:45:00.894Z","updated_at":"2026-03-07T01:35:38.865Z","avatar_url":"https://github.com/ruyjfs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example Golang\n\nExample made with Golang, Gin Framework, GraphQL, Resful, Authenticate with JWT and much more.\n\nA example of bank transaction, made with GOlang, Gin Framework, Restful and GraphQL.\n\n- [Endpoints](#Endpoints)\n- [Insomnia](#Insomnia)\n- [Get Started](#Get-Started)\n- [Get Started - without docker](##Get-Started-without-docker)\n- [Run Debug with VScode and DB in docker](##Run-Debugg)\n- [Unity Test and Test Integration](##Unity-Test-and-Test-Integration)\n- [Step By Step](#Step-By-Step)\n- [Commands](#Commands)\n- [Technologies](#Technologies)\n- [References](#References)\n\n## Endpoints\n\n| Endpoint   | Method | Action  |\n| ---------- | ------ | ------- |\n| /graphql   | POST   |         |\n| /graphiql  | GET    |         |\n| /users     | GET    | Index   |\n| /users     | POST   | Store   |\n| /users     | PATCH  | Update  |\n| /users/:id | DELETE | Destroy |\n| /users/:id | GET    | Show    |\n\n## Insomnia\n\nIf you use Insomnia, just import a [insomnia-v4.yaml](insomnia-v4.yaml)\n\n## Get Started\n\nJust one command\n\n```bash\ndocker-compose up --build\n```\n\n\u003e Open on you best browser: http://localhost:8085 \u003cbr /\u003e\n\u003e GraphQL Playground: http://localhost:8085/gaphiql\u003cbr /\u003e\n\u003e To see a database open adminer on: http://localhost:8086 \u003cbr /\u003e\n\u003e Configurations for connect on database see: [/docker/local.env](/docker/local.env)\n\u003e IMPORTANT! If you not have a docker see: [Get Started - without docker](#Get-Stared-without-docker)\n\n## Structure\n\n```\n├── config - (configuration)\n├── controllers (RESTfull methods)\n├── core (Base methos for controllers, models and services)\n├── database - (database configuration, migrate and seed data)\n├── graphql\n│   ├── generated            - A package that only contains the generated runtime\n│   │   └── generated.go\n│   ├── model                - A package for all your graph models, generated or otherwise\n│   │   └── models_gen.go\n│   ├── resolver.go          - The root graph resolver type. This file wont get regenerated\n│   ├── schema.graphqls      - Some schema. You can split the schema into as many graphql files as you like\n│   └── schema.resolvers.go  - the resolver implementation for schema.graphql\n├── models (ORM models based on Database tables)\n├── routes (files with routes)\n├── services (with business rules and intermediate a database)controlling the generated code.\n├── go.mod\n├── go.sum\n├── gqlgen.yml               - The gqlgen config file, knobs for\n└── main.go                  - The entry point to your app. Customize it however you see fit\n```\n\n## Commands\n\nEnter on docker container to exec any command.\n\n```bash\ndocker exec -it labbankgo-api /bin/bash\n```\n\nTo generate graphql files.\n\n```bash\ngqlgen generate\n```\n\n\u003e On docker\n\n```bash\n~/go/bin/gqlgen generate\n```\n\n\u003e Out of docker\n\n#### Get Started without docker\n\n\u003e A Database PostgreSQL is needed, configurations for it in docker/local.env\n\n```bash\ngin --port=8080 #or ~/go/bin/gin --port=8080\n```\n\n## Run Debugg\n\n\u003e With VScode and SGBD on Docker\n\n```bash\ndocker-compose -f docker-compose-db.yml up\n```\n\n\u003e Open your debug on VScode and run \"Launch file\"\n\n## Unity Test and Test Integration\n\n```bash\ngo test -v ./src/tests/\n```\n\nWith code coverage\n\n```bash\ngo test -cover -coverprofile=c.out ./src/tests/\ngo tool cover -html=c.out -o coverage.html\n```\n\n## Step By Step\n\nAll steps necessary to make this example project.\n\n### Create a mod init\n\nAll libs in Golang have a module name.\nThis is for a package manage for Golang, like a npm/yarm for nodeJS, gradlew/mavem for Java, compose for PHP, mix for Elixir and many more.\n\n```bash\ngo mod init github.com/ruyjfs/example-golang\n```\n\n\u003e See: go.mod\n\n### Create a file main.go - The Hello World\n\n```bash\n echo '' \u003e\u003e main.go\n```\n\n```go\npackage main\n\nimport (\n\t\"log\"\n)\n\nfunc main() {\n\tlog.Printf(\"Hello World!\")\n}\n```\n\nRun to see you first hello world\n\n```bash\ngo run main.go\n```\n\n### Install Gin Framework\n\n```bash\ngo get github.com/codegangsta/gin\n```\n\nUpdate a file `main.go` with this example code\n\n```bash\npackage main\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\nfunc setupRouter() *gin.Engine {\n\tr := gin.Default()\n\n\tr.GET(\"/:name\", func(c *gin.Context) {\n\t\tname := c.Params.ByName(\"name\")\n\t\tc.String(http.StatusOK, \"Hello World\", name)\n\t})\n\n\treturn r\n}\n\nfunc main() {\n\tr := setupRouter()\n\tr.Run(\":8080\")\n}\n```\n\n### Install GraphQL\n\n```bash\ngo run github.com/99designs/gqlgen init\n```\n\nTo generate graphql files.\n\n```bash\ngqlgen generate\n```\n\n\u003e On docker\n\n```bash\n~/go/bin/gqlgen generate\n```\n\nInstall GORM\n\n```bash\ngo get -u gorm.io/gorm \u0026\u0026 \\\ngo get -u gorm.io/driver/postgres\n```\n\nStart project with Hot Reload\n\n```bash\n~/go/bin/gin\n```\n\nDefault start project\n\n```bash\ngo run main.go\n```\n\n\u003e Open on you best browser: http://localhost:8085\n\n## Run Debugg\n\n\u003e With VScode and SGBD on Docker\n\n```bash\ndocker-compose -f docker-compose-db.yml up\n```\n\n## Unity Test and Test Integration\n\n```bash\ngo test -v ./src/tests/\n```\n\nWith code coverage\n\n```bash\ngo test -cover -coverprofile=c.out ./src/tests/\ngo tool cover -html=c.out -o coverage.html\n```\n\n## Technologies:\n\n- [Golang (Language)](https://golang.org)\n- [GORM (ORM)](https://gorm.io/docs/index.html)\n- [Gqlgen (GraphQL)](https://gqlgen.com)\n- [PostgreSQL (SGBD)](https://www.postgresql.org/docs/online-resources/)\n- [Docker Compose (Local Environment)](https://docs.docker.com/compose/compose-file/)\n\n## References\n\n- [Effective GO](https://golang.org/doc/effective_go.html)\n- [JsonAPI (Restful API Specification)](https://jsonapi.org)\n- [Style Guide - GOlang Code Review](https://github.com/golang/go/wiki/CodeReviewComments)\n- [Style Guide - Google](https://google.github.io/styleguide/)\n- [Style Guide - Uber GO](https://github.com/uber-go/guide/blob/master/style.md/)\n- [Style Guide - Source Graph](https://about.sourcegraph.com/handbook/engineering/languages/go/)\n- [How to GraphQL with GO](https://www.howtographql.com/graphql-go/0-introduction/)\n- [Examples with GO](https://gobyexample.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruyjfs%2Fexample-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruyjfs%2Fexample-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruyjfs%2Fexample-golang/lists"}