{"id":14978626,"url":"https://github.com/ivanvs/nest-zitadel","last_synced_at":"2025-10-28T11:31:43.060Z","repository":{"id":224623284,"uuid":"763258695","full_name":"ivanvs/nest-zitadel","owner":"ivanvs","description":"Nest.js module that setup authentication with Zitadel for Nest.js application","archived":false,"fork":false,"pushed_at":"2024-03-11T21:33:44.000Z","size":485,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-29T01:41:20.235Z","etag":null,"topics":["nest","nest-zitadel","nestjs","passport","passportjs","zitadel"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ivanvs.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":"2024-02-26T00:02:10.000Z","updated_at":"2024-05-15T10:51:53.000Z","dependencies_parsed_at":"2024-09-24T01:00:35.043Z","dependency_job_id":null,"html_url":"https://github.com/ivanvs/nest-zitadel","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"780edc7beef6ef8ff97eac611a4046f16c633d24"},"previous_names":["ivanvs/nest-zitadel"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvs%2Fnest-zitadel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvs%2Fnest-zitadel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvs%2Fnest-zitadel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvs%2Fnest-zitadel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanvs","download_url":"https://codeload.github.com/ivanvs/nest-zitadel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859638,"owners_count":16556034,"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":["nest","nest-zitadel","nestjs","passport","passportjs","zitadel"],"created_at":"2024-09-24T13:58:03.237Z","updated_at":"2025-10-28T11:31:42.637Z","avatar_url":"https://github.com/ivanvs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nest-zitadel\n\n![GitHub](https://img.shields.io/github/license/ivanvs/nest-zitadel)\n![npm](https://img.shields.io/npm/v/nest-zitadel)\n![npm](https://img.shields.io/npm/dw/nest-zitadel)\n![npm](https://img.shields.io/npm/dt/nest-zitadel)\n\n\u003e Nest.js module that setup authentication with Zitadel for Nest.js application\n\nThis library is higly inspired by [https://github.com/ehwplus/zitadel-nodejs-nestjs](https://github.com/ehwplus/zitadel-nodejs-nestjs)\n\n## Installation\n\n```bash\nnpm install --save passport-zitadel nest-zitadel @nestjs/passport\n```\n\n## Getting Started\n\nRegistering the module:\n\n```typescript\nZitadelAuthModule.forRoot({\n        authority: 'http://localhost:8080',\n        authorization: {\n        type: 'jwt-profile',\n        profile: {\n            type: 'application',\n            keyId: 'key-id',\n            key: 'key',\n            appId: 'app-id',\n            clientId: 'client-id',\n        },\n        },\n    }),\n```\n\nRegistering the module with configuration from `ConfigurationService`:\n\n```typescript\nZitadelAuthModule.forRootAsync({\n      imports: [ConfigModule],\n      inject: [ConfigService],\n      useFactory: (configService: ConfigService) =\u003e {\n        return {\n          authority: configService.getOrThrow('ZITADEL_AUTHORITY'),\n          authorization: {\n            type: 'jwt-profile',\n            profile: {\n              type: 'application',\n              keyId: configService.getOrThrow('ZITADEL_KEY_ID'),\n              key: configService.getOrThrow('ZITADEL_KEY'),\n              appId: configService.getOrThrow('ZITADEL_APP_ID'),\n              clientId: configService.getOrThrow('ZITADEL_CLIENT_ID'),\n            },\n          },\n        };\n      },\n    }),\n```\n\n## Guards\n\nRegister any of the guards either globally, or scoped in your controller.\n\n### ZitadelAuthGuard\n\nBy default, it will throw a 401 unauthorized when it is unable to verify the JWT token or Bearer header is missing.\n\n```typescript\n@Controller('cats')\n@UseGuards(ZitadelAuthGuard)\nexport class CatsController {}\n```\n\n### RolesGuard\n\nCheck if user has role that is put in `@Roles` decorator\n\n```typescript\n@Roles('super-user')\n@Get('protected/roles')\n@UseGuards(ZitadelAuthGuard, RolesGuard)\ngetProtectedHelloWithRoles(): string {\n  this.logger.log('Requesting role protected hello');\n  return this.appService.getHello();\n}\n```\n\n## Decorators\n\n### ZitadelAuthGuard\n\nRetrieves the current Zitadel logged-in user.\n\n```typescript\n@Controller('users')\n@UseGuards(ZitadelAuthGuard)\nexport class UsersController {\n  @Get()\n  getCurrentUser(@AuthenticatedUser() user: ZitadelUser) {\n    return user;\n  }\n}\n```\n\n# License\n\nnest-zitadel is released under [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanvs%2Fnest-zitadel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanvs%2Fnest-zitadel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanvs%2Fnest-zitadel/lists"}