{"id":15314833,"url":"https://github.com/hrithiqball/go-gorilla","last_synced_at":"2026-01-27T21:40:04.745Z","repository":{"id":254514125,"uuid":"846772758","full_name":"hrithiqball/go-gorilla","owner":"hrithiqball","description":"rest api using gorilla and gorm","archived":false,"fork":false,"pushed_at":"2024-09-08T17:28:31.000Z","size":15686,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T18:56:45.746Z","etag":null,"topics":["dependency-injection","docker","gorilla-mux","gorm","postgresql","rate-limiting","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrithiqball.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-08-23T23:35:49.000Z","updated_at":"2024-09-08T17:28:33.000Z","dependencies_parsed_at":"2024-08-29T18:42:34.673Z","dependency_job_id":"d5037298-2ddf-4dc3-bd06-e9e62839fb2f","html_url":"https://github.com/hrithiqball/go-gorilla","commit_stats":null,"previous_names":["hrithiqball/go-gorilla"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hrithiqball/go-gorilla","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrithiqball%2Fgo-gorilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrithiqball%2Fgo-gorilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrithiqball%2Fgo-gorilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrithiqball%2Fgo-gorilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrithiqball","download_url":"https://codeload.github.com/hrithiqball/go-gorilla/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrithiqball%2Fgo-gorilla/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28823567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"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":["dependency-injection","docker","gorilla-mux","gorm","postgresql","rate-limiting","rest-api"],"created_at":"2024-10-01T08:47:21.081Z","updated_at":"2026-01-27T21:40:04.720Z","avatar_url":"https://github.com/hrithiqball.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"display: flex;align-items: center; justify-content: center; margin-top: 20px\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Go-00ADD8?style=for-the-badge\u0026logo=go\u0026logoColor=white\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Shell_Script-121011?style=for-the-badge\u0026logo=gnu-bash\u0026logoColor=white\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/JWT-000000?style=for-the-badge\u0026logo=JSON%20web%20tokens\u0026logoColor=white\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Docker-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white\" /\u003e\n\u003c/div\u003e\n\n## GO API 🦫\n\nThis project is to create a rest api using go for local my project\n\n#### Basic Command\n\n```bash\n# create a new go module\ngo mod init local_my_api\n\n# to install new package\ngo get -u github.com/gorilla/mux\n\n# to list all the dependency\ngo mod vendor\n\n# to install dependency\ngo mod tidy\n\n# to build\ngo build -o local_my_api cmd/main.go\n```\n\n### Project Structure\n\nThis project uses go module and dependency injection pattern for the project structure. Implcitly define interface and struct is a must for the project structure.\n\n#### Folder 📂\n\n- `cmd` - for initial entry point and for building the project\n- `internal` - for all the internal package and logic\n- `pkg` - for all the external package and logic\n- `testing` - for all the testing purpose\n\n#### Routing 🪧\n\n- define all the routes in the `internal/routes` folder and combine them before accessing the server for separation of concern\n- data flow from `handler` -\u003e `service` -\u003e `repository`\n\n##### handler 📨\n\n- to handle the request and response\n- processing the request and sanitise the input\n- validate the input for request received\n\n##### service 🔩\n\n- to handle the business logic\n- handle the data action e.g. transaction, event, CRUD\n- db access starts from here\n\n##### repositoriy 💽\n\n- to access db\n- to preload the data\n\n##### middleware 🧱\n\n- to handle the middleware for the request\n- to handle the authentication and authorisation\n- to intercept the request and response\n\n#### model 📦\n\n- to define the struct for the data\n- to define the interface for the struct\n\n## Development 🛠️\n\nRecommended to use `air` for live-reloading (rebuild all for each changes) and `go run` for running the server without building the project `go run cmd/main.go`\n\n[Air Repository](https://github.com/air-verse/air)\n\n## Migrations 🪽\n\nMigrations by go lang is shit. Implemented custom bin sh for migrations purpose\n\n1. Run `chmod +x go_migrate.sh`\n2. Run `./go_migrate --migration_name_by_snake`\n3. File name is auto copied to clipboard (install xclip/xsel) (debian: `sudo apt-get install xclip`). Should output like this\n\n```bash\n➜ ./go_migrate.sh --create_product_table\nMigration file created: internal/db/migrations/20240825014020_create_product_table.go\nFile name copied to clipboard using xclip.\n```\n\n4. Paste the ID in migrationList array in file `internal/db/migrations.go`\n5. Edit the migration file created\n\n## Deployment 🐳\n\nThis project uses Docker to deploy. To disable web app, comment out in yml file\n\n#### For building local and deploy local\n\n1. Create .env.local with this format for db = `'user=postgres password=postgres dbname=local_my host=db port=5432 sslmode=disable'`\n2. If password is changed, change in `docker-compose.yml` as well in user and password\n3. Build vite app image (`./build.sh`) and ensure the `local/vite:tag` is the same in docker compose\n4. Bump version in `version.txt` and run `./build.sh`\n5. Ensure the docker compose version is match in `local/go:tag`\n6. Run `docker-compose -f docker-compose.local.yml up -d`\n\n#### For updating production version\n\n##### build image\n\n1. Bump version in `version.txt` and run `./build.sh`\n2. Ensure the docker compose version is match in `ghcr.io/hrithiqball/go:tag`\n3. Git push to main branch\n\n##### run image\n\n1. Ensure the `ghcr.io/hrithiqball/go:tag` and `ghcr.io/hrithiqball/vite:tag` is the same in docker compose\n2. Run `docker-compose -f docker-compose.prod.yml up -d`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrithiqball%2Fgo-gorilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrithiqball%2Fgo-gorilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrithiqball%2Fgo-gorilla/lists"}