{"id":30504411,"url":"https://github.com/peterxcli/basic-auth-gin","last_synced_at":"2025-08-25T14:03:43.413Z","repository":{"id":118483500,"uuid":"609773187","full_name":"peterxcli/basic-auth-gin","owner":"peterxcli","description":"Basic-auth-gin v1 🚀 is a swift RESTful API framework built atop the Gin Framework 🌐 and MongoDB 🗄️. It boasts JWT authentication middleware 🔐, Google OAuth API, SendGrid email API 📧, and SSL support 🔒. Designed for ease of use with environment variable support 🌍, it can be quickly installed and tested using make commands ⚙️.","archived":false,"fork":false,"pushed_at":"2023-07-11T20:32:11.000Z","size":115,"stargazers_count":12,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T14:02:18.175Z","etag":null,"topics":["gin","gin-gonic","go","golang","jwt","learn","mongodb","oauth","oauth2","restful-api","ssl"],"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/peterxcli.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":"2023-03-05T07:28:30.000Z","updated_at":"2025-05-05T18:05:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"58650990-81e5-44b1-9fab-976ca45e99f7","html_url":"https://github.com/peterxcli/basic-auth-gin","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/peterxcli/basic-auth-gin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterxcli%2Fbasic-auth-gin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterxcli%2Fbasic-auth-gin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterxcli%2Fbasic-auth-gin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterxcli%2Fbasic-auth-gin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterxcli","download_url":"https://codeload.github.com/peterxcli/basic-auth-gin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterxcli%2Fbasic-auth-gin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272077690,"owners_count":24869288,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"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":["gin","gin-gonic","go","golang","jwt","learn","mongodb","oauth","oauth2","restful-api","ssl"],"created_at":"2025-08-25T14:01:51.954Z","updated_at":"2025-08-25T14:03:43.378Z","avatar_url":"https://github.com/peterxcli.png","language":"Go","readme":"![alt tag](https://upload.wikimedia.org/wikipedia/commons/2/23/Golang.png)\n\n[![License](https://img.shields.io/github/license/peterxcli/basic-auth-gin)](https://github.com/peterxcli/basic-auth-gin/blob/master/LICENSE) \n\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/peterxcli/basic-auth-gin)](https://github.com/peterxcli/basic-auth-gin/releases) \n\n[![Go Version](https://img.shields.io/github/go-mod/go-version/peterxcli/basic-auth-gin)](https://github.com/peterxcli/basic-auth-gin/blob/master/go.mod) \n\n[![DB Version](https://img.shields.io/badge/DB-MongoDB--latest-blue)](https://github.com/peterxcli/basic-auth-gin/blob/master/go.mod) \n\nWelcome to **basic-auth-gin** v1\n\nThe fastest way to deploy a restful api's with [Gin Framework](https://github.com/gin-gonic/gin/) with a structured project that defaults to **MongoDB** database and **JWT** authentication middleware\n\n## Configured with\n\n- [jwt-go](https://github.com/golang-jwt/jwt): JSON Web Tokens (JWT) as middleware\n- Go Modules\n- Built-in **Custom Validators**\n- Built-in **CORS Middleware**\n- Built-in **RequestID Middleware**\n- google oauth api\n- sendGrid email api\n- SSL Support\n- Enviroment support\n- Unit test\n- swagger docs\n- And few other important utilties to kickstart any project\n\n-------------------\n\n## Prerequisite\n### google oauth api\n1. create oauth-client at https://console.cloud.google.com/apis/credentials\n2. set `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` in `.env` to your oauth-client id and secret\n3. set `REDIRECT_URI` for the google oauth callback\n### sendGrid email api\n1. if you have your own mail system, you can change the `sendEmail` function at `controllers/user.go:146` and connect to your smtp server\n2. if you dont have, try my free alternative: `cloudflare` + `sendgrid`\n3. after you get the sengrid email api key, set `SENDGRID_API_KEY` in `.env` to that\n\n### other setting\n##### environment variable\n*  `FRONTEND_URI`: frontend url, this would be use when the google auth callback to bring acess_token to the client\n* `EMAIL`: from email\n* `REDIRECT_URI`: the redirect uri for google oauth, the endpoint will get the grant code from google oauth\n\n## Installation\n\n```\n$ git clone https://github.com/peterxcli/basic-auth-gin.git\n```\n\n## Running Your Application\n\nRename `.env_rename_me` to `.env` and place your credentials\n\n```\n$ mv .env_rename_me .env\n```\n\nGenerate SSL certificates (Optional)\n\n\u003e if you need ssl, change `SSL=FALSE` to `SSL=TRUE` in the `.env` file, then\n\n```\n$ make https\n```\n\n\u003e Make sure to change the values in .env for your database\n\n```\n$ make install\n$ make run\n```\n\n* every time you run `$ make run` it would regenerate the swagger docs base on your comments\n\n\u003e link to http://localhost:9000/swagger/index.html to view the openAPI docs\n\n## Building Your Application\n\n```\n$ go build -v\n```\n\n```\n$ ./\u003cyour_package_name\u003e\n```\n\n## Testing Your Application\n\n```\n$ make test\n```\n\n---\n\n## Acknowledge\nthanks [Massad -\u003e gin-boilerplate](https://github.com/Massad/gin-boilerplate) \nfor enabling me to build the gin/mongoDB user auth template\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterxcli%2Fbasic-auth-gin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterxcli%2Fbasic-auth-gin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterxcli%2Fbasic-auth-gin/lists"}