Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
DataDome can provide real-time bot protection, ip blocking, custom rules protection and other security protections to any website.
IP Blocking with DataDome is a Next.js edge middleware template from Vercel that shows how to add real-time bot protection, IP blocking, and custom-rule enforcement to any website using the DataDome service.
This template is a ready-to-run Next.js application that connects a website to DataDome's cloud-based protection platform. It acts as a middleware layer on the edge: for each incoming request, it consults DataDome using your account keys and then allows or blocks the request based on IP reputation, bot scores, and rules you define in the DataDome dashboard. The template is authored by Vercel and distributed as part of the vercel/examples collection on GitHub. It is styled with Tailwind CSS and runs on the Vercel edge network, which means protection decisions are made close to the visitor with minimal latency.
NEXT_PUBLIC_DATADOME_CLIENT_KEY, DATADOME_SERVER_KEY, and DATADOME_MANAGEMENT_KEY to authenticate with DataDome.https://edge-functions-ip-blocking-datadome.vercel.app so you can see the behavior before deploying.After deploying or cloning the repository, you create a DataDome account and copy the .env.example file to .env.local. You then fill in the three key values from your DataDome dashboard and run pnpm dev to test locally under Next.js development mode. When the app is deployed to Vercel, the edge middleware reads those environment variables, calls DataDome for each request, and enforces the allow/block decision before the page is served.
