VitNode

Cloudflare Turnstile

How to integrate Cloudflare Turnstile in your application.

Sign in to Cloudflare

Go into Cloudflare and sign in.

Add a domain

Select Add a domain button and add your domain.

Follow the instructions to add your domain. If you have any trouble, you can check the Cloudflare documentation.

Create a widget

Go to the Turnstile section and create a new widget.

Cloudflare Turnstile Home

Configure the widget

Configure the widget to your needs. We support all the mods that Cloudflare provides like Managed, Non-interactive and Invisible.

Remember to add your hostname to the Hostname Management list.

Get the Site Key & Secret Key

After you create the widget, you will get the Site Key and Secret Key. Save it, You will need these keys to integrate the widget into your application.

Add keys to .env

Add the keys to your .env file.

CAPTCHA_SECRET_KEY=XXX
CAPTCHA_SITE_KEY=XXX

Provide keys to VitNode

Edit your app.module.ts file and add captcha object to the VitNodeModule configuration.

@Module({
  imports: [
    VitNodeCoreModule.register({
      database: {
        config: DATABASE_ENVS,
        schemaDatabase,
      },

      captcha: {

        type: 'cloudflare_turnstile',

        site_key: process.env.CAPTCHA_SITE_KEY,

        secret_key: process.env.CAPTCHA_SECRET_KEY,

      },
    }),
    DatabaseModule,
    PluginsModule,
    CacheModule.register({
      isGlobal: true,
    }),
  ],
})
export class AppModule {}

On this page