skills/security-compliance/bot-protection/SKILL.md
Block automated bots from scraping your catalog, scalping limited inventory, and abusing checkout flows using CAPTCHA and behavioral detection
npx skillsauth add finsilabs/awesome-ecommerce-skills bot-protectionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Commerce stores face three major bot threats: scrapers that harvest pricing and inventory data for competitors, scalper bots that buy limited-inventory items instantly, and credential-stuffing bots that test stolen usernames and passwords. Effective bot protection layers platform-level defenses, a WAF (Web Application Firewall), CAPTCHA for high-risk actions, and optional behavioral analysis. For most merchants, Cloudflare provides the most effective and lowest-friction protection — it sits in front of your store regardless of platform.
| Platform | Built-in Bot Protection | Recommended Additional Layer | |----------|------------------------|------------------------------| | Shopify | Shopify includes basic bot detection and rate limiting | Enable Cloudflare (free plan) in front of your Shopify store for WAF rules and bot management | | WooCommerce | None built in — the login and checkout forms are fully exposed | Wordfence (free) for login protection; Cloudflare for WAF and rate limiting | | BigCommerce | Basic DDoS protection included | Cloudflare for advanced bot management; BigCommerce supports custom scripts for CAPTCHA | | High-traffic drops (any platform) | None | Cloudflare Waiting Room (Business/Enterprise) or Queue-it for managed queue | | Custom / Headless | Must build | Cloudflare + custom rate limiting + behavioral analysis |
Cloudflare's free plan provides significant bot protection at the DNS level without touching your application code.
# Block requests with no User-Agent header
(not http.user_agent contains " " and not cf.client.bot)
# Rate limit catalog API scraping
# Under Security → WAF → Rate Limiting Rules:
# Path: /products/* or /api/products/*
# Rate: 100 requests per minute per IP
# Action: Block for 1 hour
Cloudflare Bot Management (Business plan, ~$200/month): For stores with serious scalping or scraping problems, Cloudflare Bot Management uses machine learning to score every request and challenge or block suspicious traffic without impacting legitimate shoppers.
Use Cloudflare Turnstile (free, privacy-preserving, invisible-first) on login and checkout forms. Turnstile uses passive signals before showing a visible challenge — most legitimate users never see a CAPTCHA.
Adding Turnstile to a Shopify store:
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script> and a <div class="cf-turnstile" data-sitekey="YOUR_SITE_KEY"> to the login formAdding Turnstile to WooCommerce:
Server-side token verification:
async function verifyTurnstile(token: string, ip: string): Promise<boolean> {
const res = await fetch('https://challenges.cloudflare.com/turnstile/v0/siteverify', {
method: 'POST',
body: new URLSearchParams({
secret: process.env.TURNSTILE_SECRET_KEY!,
response: token,
remoteip: ip,
}),
});
const data = await res.json();
return data.success === true;
}
For limited-inventory launches where you expect traffic spikes and scalpers:
Cloudflare Waiting Room (Business/Enterprise plan):
/products/limited-* or /collections/drop)Shopify — Per-customer purchase limits: Shopify does not enforce per-customer purchase limits natively for limited products. Options:
WooCommerce — Login brute-force protection:
WooCommerce — CAPTCHA on checkout:
For custom storefronts, add rate limiting at the middleware or edge layer:
// Next.js Edge Middleware — rate limiting per IP per route
import { NextRequest, NextResponse } from 'next/server';
import { Ratelimit } from '@upstash/ratelimit';
import { Redis } from '@upstash/redis';
const redis = Redis.fromEnv();
const limiters = {
checkout: new Ratelimit({ redis, limiter: Ratelimit.slidingWindow(10, '1 m'), prefix: 'rl_checkout' }),
catalog: new Ratelimit({ redis, limiter: Ratelimit.slidingWindow(100, '1 m'), prefix: 'rl_catalog' }),
};
export async function middleware(request: NextRequest) {
const ip = request.ip ?? request.headers.get('x-forwarded-for') ?? '127.0.0.1';
const pathname = request.nextUrl.pathname;
const limiter = pathname.startsWith('/checkout') ? limiters.checkout
: pathname.startsWith('/products') ? limiters.catalog
: null;
if (limiter) {
const { success } = await limiter.limit(ip);
if (!success) return new NextResponse('Too Many Requests', { status: 429 });
}
return NextResponse.next();
}
Per-customer purchase limits (custom):
async function enforcePurchaseLimit(customerId: string, productId: string, limit = 1) {
const count = await db.orders.countByCustomerAndProduct(customerId, productId);
if (count >= limit) throw new Error(`Purchase limit of ${limit} per customer reached`);
// Atomic lock to prevent race conditions at high concurrency
const lockKey = `purchase_lock:${customerId}:${productId}`;
const acquired = await redis.set(lockKey, '1', 'EX', 30, 'NX');
if (!acquired) throw new Error('Purchase already in progress');
}
| Problem | Solution | |---------|----------| | Rate limits blocking legitimate flash sale traffic | Set higher rate limits for authenticated customers with purchase history; apply strict limits only to unauthenticated requests | | Turnstile CAPTCHA breaking checkout | Test Turnstile in "Always passes" mode during setup; ensure your server-side verification endpoint is working before enabling in production | | Waiting room not activating for a product drop | Configure Cloudflare Waiting Room 24 hours before the drop and test with a staging URL; ensure the path pattern matches the product URL | | Purchase limit bypass via multiple accounts | Require phone verification for high-demand product purchases; link purchase limits to verified phone numbers or identity, not just accounts | | Wordfence blocking legitimate WooCommerce customers | Review blocked IP logs in Wordfence; allowlist legitimate customers and adjust sensitivity settings |
tools
Let shoppers save products to a wishlist, share it with friends, and get notified when saved items come back in stock or drop in price
development
Build a themeable storefront with design tokens and CSS custom properties that supports white-labeling, multi-brand variants, and dark mode
development
Speed up product discovery with instant search suggestions, fuzzy typo matching, and category-aware results powered by Algolia or Elasticsearch
development
Build a mobile-first storefront with thumb-friendly navigation, sticky add-to-cart buttons, and touch-optimized components for high mobile conversion