Open the Firewall page on a brand-new project and you'll find it's already working. Every Vercel deployment sits behind a platform-wide firewall that mitigates DDoS attacks automatically, on every plan, before a request ever reaches your code. You don't have to configure anything.
What the platform doesn't know is your app. It has no idea that nobody needs to hit /api/preorder 400 times a minute, or that a rival truck has been scraping your location page every five minutes since March. You know that, and this course turns what you know into rules.
The truck
We'll protect the website for a lobster roll truck. It posts where it's parked each day, sells 150 rolls, and opens preorders at 11am. Connecticut-style comes warm with butter. Maine-style comes cold with mayo. Both sell out.
The truck has enemies. A rival truck scrapes the location page so it can park across the street. A preorder bot hammers the preorder endpoint the second the window opens. Another bot fills the order form with fake orders. The starter ships with a script that plays all of them, and we'll point it at our own deployment to watch each rule work.
What you'll learn
- Read how the Firewall protects a deployment, the actions it can take, and what it did with your traffic
- Write custom rules for a path, an IP, or a country, starting in log mode before you deny anything
- Rate limit a busy endpoint by IP
- Turn on the Bot Protection and AI Bots rulesets, and add a bypass rule for a good bot that gets caught
- Handle a bad day: read mixed traffic, roll back a rule that blocked customers, set up DDoS alerts, and run an Attack Mode drill
Before you begin
- Comfort reading a Next.js App Router project. You won't build the app, but you'll edit one component.
- Basic terminal and git
- Node.js at the version in the starter's
package.json - A Vercel account and the latest Vercel CLI (
npm i -g vercel@latest), logged in. Every lesson on the main path works on Hobby. Steps and lessons labeled Pro, Enterprise, or Advanced are optional, and they show what paid plans add right where you'd need it; plan availability for each lives in the Firewall docs. - A GitHub account
No security background required.
Sections
1. How Firewall Works. Deploy the truck, tour what the platform already protects and what the Firewall can do with a request, and watch the scalper walk right through.
2. Custom Rules. Stop the rival truck's scraper with a rule that starts in log mode, then find out what blocking by IP or country would have cost you.
3. Rate Limiting. Limit one busy endpoint by IP so a script can't take all 150 rolls.
4. Manage Bots. Turn on the Bot Protection and AI Bots rulesets, then let the payment webhook back in with a bypass rule. An optional lesson adds BotID to the order form.
5. When You're Under Attack. Read mixed traffic, roll back a rule that blocked the lunch rush, set up DDoS alerts, and run an Attack Mode drill. An optional last lesson covers what changes when one truck becomes a chain.
On this page