Deploy the truck
Claw & Order's website runs fine on your laptop, which is the one place the Firewall can't see it. Requests to localhost never reach Vercel. Before we block a single scraper, the site needs a real URL.
Outcome
Claw & Order is live on a Vercel URL you own, and the project is linked to the Vercel CLI on your machine.
Fork and deploy
The starter is a Next.js app for a truck that sells 150 rolls a day. Use the button to fork it into your GitHub account and deploy it in one step:
The flow creates a claw-and-order repo in your account, makes a Vercel project from it, and deploys main. Keep the Root Directory at the repository root.
When the deploy finishes, open the production URL. The page says The truck has no cooler yet.
This is expected. The truck keeps its rolls and orders in Redis, and we haven't given it one. We'll fix that from the terminal in a minute.
Every command in this course needs that URL, and it has to be the right one. Open the project in the dashboard and copy the production domain listed under Domains, the one without a hash in it (something like claw-and-order-yourname.vercel.app). The address bar after a deploy often shows a generated deployment URL instead, like claw-and-order-abc123-yourteam.vercel.app. Your browser loads it because you're logged in, but Deployment Protection blocks it for scripts.
Put the domain in a shell variable so you only type it once:
export URL=https://<your-production-domain>Set it again in any new terminal. The sample output in these lessons shows https://claw-and-order.vercel.app; yours will show your own address.
Link the CLI
Later lessons read Firewall traffic and manage rules with vercel firewall. Clone the fork and link the folder to the project the button created:
git clone https://github.com/<your-username>/claw-and-order.git
cd claw-and-order
npm install
vercel linkPick the team that owns claw-and-order and confirm the project name. The CLI writes a .vercel folder, which the starter's .gitignore already excludes.
If the CLI skips the prompts (it runs non-interactively when it detects an agent), name the project yourself:
vercel link --project claw-and-orderGive the truck a cooler
Why does a lobster truck need a database? Because on Vercel, the home page, the preorder route, and the payment webhook can each run in a separate function instance. A roll counter kept in a JavaScript variable would give each instance its own 150 rolls. The bot would sell out the preorder route while the home page cheerfully reported a full truck.
Redis gives every instance the same count. Add one from the Vercel Marketplace:
vercel install upstash/upstash-kvupstash-kv is Upstash for Redis, one of several Upstash products. Pick the free plan when it asks. The command creates the database, connects it to claw-and-order, and pulls its credentials into .env.local.
The live site doesn't know about the database yet. Environment variables only reach new deployments, so deploy again:
vercel deploy --prodReload the production URL. Now you'll see today's spot, a counter of rolls left, and two styles on the menu: Connecticut (warm, butter) and Maine (cold, mayo). The spot changes with the day of the week, so yours might say the ferry terminal today and the carousel tomorrow. On Sundays the truck is on the boat, and the page says so.
Run it on your laptop
vercel install already put the credentials in .env.local, so the local copy talks to the same Redis:
npm run devOpen http://localhost:3000 and place a preorder. The counter drops to 149. Reload your production URL and it says 149 there too, because both copies read the same database.
This copy is useful for editing code, and the Firewall will never see a single request it receives. localhost traffic goes from your browser to your laptop and never passes through Vercel. Everything this course protects, it protects on the deployment.
Put the roll back:
npm run restockRestocked. 150 rolls on the truck.You'll run this a lot. The bots in this course empty the truck, and restock refills it from your machine. There's no restock button on the site on purpose. A public "reset the inventory" URL is exactly the kind of thing a Firewall course should make you nervous about.
Take a quick tour
Most of the app stays untouched for the whole course. These are the parts the villains care about:
| Path | What it does | Who wants it |
|---|---|---|
app/location/page.tsx | Shows where the truck is parked today | Pinchy's, the rival truck |
app/api/preorder/route.ts | Takes one of the day's 150 rolls | A preorder bot |
app/api/order/route.ts | Places an office lunch order | A fake-order bot |
app/api/webhooks/payment/route.ts | Marks an order paid when TidePay says so | Nobody, yet |
attack/ | Scripts that play the villains | You, starting in 1.3 |
TidePay is a made-up payment provider. The attack/payment-webhook.mjs script plays its part later in the course.
Hands-on exercise 1.1
Get the truck online and connected to your terminal.
Requirements:
- Deploy the starter with the button and open the production URL.
- Copy the production domain from Domains and
export URL=...with it. - Clone your fork, run
npm install, and runvercel linkto select the deployed project. - Add Upstash Redis with
vercel install upstash/upstash-kvand deploy again withvercel deploy --prod. - Run it locally with
npm run dev, place one preorder, and confirm the counter drops on both copies. - Put the roll back with
npm run restock. - In the Vercel dashboard, open the project and find Firewall in the sidebar.
Implementation hints:
- The production domain is under Domains on the project's overview page. It ends in
.vercel.appunless you add your own, and it has no deployment hash in it. - If
vercel linkasks to create a new project, say no. You want the one the button already made. - Your local copy and your deployment share one Redis database, so a preorder on
localhostchanges the number on the live site. That's handy for checking the setup, and it's whynpm run restockworks from your laptop.
Try It
Ask the deployment for the location page from your terminal. Swap in your own URL:
curl -s -o /dev/null -w "%{http_code}\n" "$URL/location"200A 200 means the page came back. Now check that the CLI sees the same project:
vercel firewall overviewThe configuration block should show no custom rules yet, since we haven't written any.
Done-When
- The production URL shows the truck's location and a rolls-left counter, not the setup notice
- A preorder on
http://localhost:3000drops the counter on the production URL too npm run restockprintsRestocked. 150 rolls on the truck.curlagainst/locationon your deployment returns200vercel firewall overviewruns in the project folder without asking which project you mean- You can open the project's Firewall page in the dashboard
Troubleshooting
The production URL still says "The truck has no cooler yet." The database is connected, but the live deployment was built before it existed. Run vercel deploy --prod again. If it still shows the notice, run vercel env ls and check that the Redis variables (they start with KV_ or UPSTASH_) list Production.
npm run restock says there are no Redis credentials. .env.local is missing or was pulled before the database existed. Run vercel env pull in the project folder and try again.
curl returns 401 instead of 200. $URL points at a generated deployment URL or a preview URL, and Deployment Protection is asking for a login your terminal doesn't have. Copy the production domain from Domains instead and export URL again.
vercel firewall says a command or option is unknown. Your CLI is older than the commands in this course. Update it with npm i -g vercel@latest, check vercel --version, and run the command again.
vercel firewall overview reports a different project or no activity at all. Traffic on a brand-new project can take a minute to show up, so wait a minute and run it again. If it still reports the wrong project, the folder is linked to the wrong project or team. Run vercel link again and pick claw-and-order under the team that owns it. Delete .vercel first if the CLI won't offer the choice.
npm install warns about the Node.js version. The starter's package.json sets an engines range that matches the current Next.js release. Install a Node.js version inside that range and run npm install again.
Solution
The full sequence, from button to linked project:
# After deploying with the button
export URL=https://<your-production-domain>
git clone https://github.com/<your-username>/claw-and-order.git
cd claw-and-order
npm install
vercel link # pick the team and the claw-and-order project
vercel install upstash/upstash-kv # Upstash for Redis, free plan
vercel deploy --prod # so the live site sees the database
npm run dev # http://localhost:3000, same Redis as production
npm run restock # after testing a preorder
curl -s -o /dev/null -w "%{http_code}\n" "$URL/location"
vercel firewall overviewThe truck is open for business. Next, we'll find out what's already standing between it and the internet.
Was this helpful?