{"id":23466044,"url":"https://github.com/teacoder-team/nestjs-cloudflare-captcha","last_synced_at":"2025-04-14T11:41:20.588Z","repository":{"id":268507466,"uuid":"904557627","full_name":"teacoder-team/nestjs-cloudflare-captcha","owner":"teacoder-team","description":"🌐 A library for integrating and working with Cloudflare CAPTCHA in NestJS applications. 🔐","archived":false,"fork":false,"pushed_at":"2024-12-21T02:54:59.000Z","size":511,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-23T15:17:42.952Z","etag":null,"topics":["captcha","cloudflare","library","nestjs","nestjs-library","turnstile"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nestjs-cloudflare-captcha","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/teacoder-team.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-12-17T05:57:56.000Z","updated_at":"2025-01-14T18:05:07.000Z","dependencies_parsed_at":"2024-12-24T11:51:02.090Z","dependency_job_id":null,"html_url":"https://github.com/teacoder-team/nestjs-cloudflare-captcha","commit_stats":null,"previous_names":["teacoder-team/nestjs-cloudflare-captcha"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teacoder-team%2Fnestjs-cloudflare-captcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teacoder-team%2Fnestjs-cloudflare-captcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teacoder-team%2Fnestjs-cloudflare-captcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teacoder-team%2Fnestjs-cloudflare-captcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teacoder-team","download_url":"https://codeload.github.com/teacoder-team/nestjs-cloudflare-captcha/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248874501,"owners_count":21175858,"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":["captcha","cloudflare","library","nestjs","nestjs-library","turnstile"],"created_at":"2024-12-24T11:50:59.520Z","updated_at":"2025-04-14T11:41:20.579Z","avatar_url":"https://github.com/teacoder-team.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NestJS Cloudflare CAPTCHA\n\nThis module provides integration with Cloudflare CAPTCHA (also known as Turnstile) for NestJS-based applications.\n\n## Installation\n\nTo install this module, use npm or yarn:\n\n```bash\nnpm install nestjs-cloudflare-captcha\n# or\nyarn add nestjs-cloudflare-captcha\n```\n\n## Usage\n\n### 1. Module Configuration\n\nTo use TurnstileModule, you need to import it into your main module and pass the configuration.\n\n**Example using synchronous configuration:**\n\n```typescript\nimport { Module } from '@nestjs/common'\nimport { TurnstileModule } from 'nestjs-cloudflare-captcha'\n\n@Module({\n\timports: [\n\t\tTurnstileModule.forRoot({\n\t\t\tsecretKey: process.env.CAPTCHA_SECRET_KEY,\n\t\t\ttoken: req =\u003e req.body.captchaToken,\n\t\t\tskipIf: process.env.NODE_ENV === 'development',\n\t\t}),\n\t],\n})\nexport class AppModule {}\n```\n\n**Example using asynchronous configuration:**\n\n```typescript\nimport { Module } from '@nestjs/common'\nimport { TurnstileModule } from 'nestjs-cloudflare-captcha'\n\n@Module({\n\timports: [\n\t\tTurnstileModule.forRootAsync({\n\t\t\tuseFactory: async (configService: ConfigService) =\u003e ({\n\t\t\t\tsecretKey: configService.get('CAPTCHA_SECRET_KEY'),\n\t\t\t\ttoken: req =\u003e req.headers['captcha-token'],\n\t\t\t\tskipIf: configService.get('NODE_ENV') === 'development',\n\t\t\t}),\n\t\t}),\n\t],\n})\nexport class AppModule {}\n```\n\n### 2. Protect Routes with CAPTCHA\n\nTo protect routes from bots, use Turnstile as a decorator.\n\n**Example usage in a controller:**\n\n```typescript\nimport { Controller, Post } from '@nestjs/common'\nimport { Turnstile } from 'nestjs-cloudflare-captcha'\n\n@Controller('auth')\nexport class AuthController {\n\t@Post('login')\n\t@Turnstile()\n\tasync login() {\n\t\treturn 'This method is protected from bots with CAPTCHA'\n\t}\n}\n```\n\n## Support\n\nIf you have any questions or issues, feel free to contact the author.\n\n-   Author: [TeaCoder](https://teacoder.ru)\n-   Contributors:\n    -   Vadim Nechaev (help@teacoder.ru)\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteacoder-team%2Fnestjs-cloudflare-captcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteacoder-team%2Fnestjs-cloudflare-captcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteacoder-team%2Fnestjs-cloudflare-captcha/lists"}