{"id":15665447,"url":"https://github.com/marcoshuck/auth-go","last_synced_at":"2025-03-30T04:25:29.426Z","repository":{"id":57696147,"uuid":"291209179","full_name":"marcoshuck/auth-go","owner":"marcoshuck","description":"An authentication microservice written in go.","archived":false,"fork":false,"pushed_at":"2020-08-29T21:26:14.000Z","size":27,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T06:43:52.828Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcoshuck.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}},"created_at":"2020-08-29T05:44:12.000Z","updated_at":"2024-02-18T01:33:18.000Z","dependencies_parsed_at":"2022-09-15T20:50:16.794Z","dependency_job_id":null,"html_url":"https://github.com/marcoshuck/auth-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoshuck%2Fauth-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoshuck%2Fauth-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoshuck%2Fauth-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoshuck%2Fauth-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcoshuck","download_url":"https://codeload.github.com/marcoshuck/auth-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246276404,"owners_count":20751438,"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":"2024-10-03T13:46:12.752Z","updated_at":"2025-03-30T04:25:29.401Z","avatar_url":"https://github.com/marcoshuck.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authentication microservice\nThis project is an authentication microservice written in go that follows Clean Architecture and SOLID patterns.\n\n## Installation\n```bash\n$ go mod download\n```\n\n## Routes\nThis microservice has an Authentication Controller in charge of handling authentication requests using gin.\n\n| Route | Method | Input | Output |\n| ----- | ------ | ----- | ------ |\n| /auth/register | POST | [Register](https://github.com/marcoshuck/auth-go/blob/master/pkg/dto/register.go) | [Public User](https://github.com/marcoshuck/auth-go/blob/master/pkg/dto/user.go#L22) |\n| /auth/login | POST | [Login](https://github.com/marcoshuck/auth-go/blob/master/pkg/dto/login.go) | [Access Token](https://github.com/marcoshuck/auth-go/blob/master/pkg/controller/auth_controller.go#L41) |\n\n## Usage\n\n```go\nfunc main() {\n\t// Initialize router\n\trouter := http.NewRouter()\n\n\t// Initialize db connection\n\t// TODO: Replace sqlite3 with MySQL/Postgres\n\tdb, err := gorm.Open(\"sqlite3\", \"file::memory:?cache=shared\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Migrate models\n\tmodel.Migrate(db)\n\n\t// Initialize validator\n\tv := validator.NewValidator()\n\n\t// Initialize user layers\n\tuserRepository := repository.NewUserRepository(db)\n\tuserService := service.NewUserService(userRepository, v)\n\n\t// TODO: Remove this block\n\terr = os.Setenv(\"APP_SECRET_KEY\", \"changeme\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Initialize auth layers\n\tauthService := service.NewAuthService(userService, v, []byte(os.Getenv(\"APP_SECRET_KEY\")))\n\tauthController := controller.NewAuthController(authService)\n\n\t// Register routes\n\trouter = http.Register(router, authController)\n\n\t// Run http server\n\terr = router.Run(\":3000\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## TODO\n- [ ] Refresh tokens\n    - [ ] Invalidation\n- [ ] Logging\n- [X] Validation\n- [ ] CI/CD\n- [ ] Error handling\n- [ ] Event subscription/publishing\n- [ ] API Rest layers tests (Controller, service, repository)\n- [ ] Integration tests.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoshuck%2Fauth-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcoshuck%2Fauth-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoshuck%2Fauth-go/lists"}