Skip to content

Rate limits on public endpoints

Limit how often anyone can hit the endpoints that cost money or invite abuse, with clear 429 answers.

  • Free, no sign-up
  • 45 to 90 minutes with an agent
  • By Devvrat Hans
  • Version 1.0, updated Oct 26, 2026

1Your site and stack

Optional. The prompt adapts as you type; leave a field blank and the agent works it out.

2Copy it into your agent

rate-limits.md62 lines, about 869 tokens

Paste into any coding agent: Claude Code, Cursor, Codex, Copilot, Windsurf or Cline.

# Rate limits on public endpoints

When the production site launches, the same publicity that brings users brings scrapers, spam bots and the occasional angry script. Endpoints that send email, call paid APIs, run searches or accept uploads can run up a bill or fall over. Put sensible limits on them, using one shared mechanism.

Site: not given. Find the production URL in the project config, or ask me.

## Ground rules

1. Read before you write. Explore the parts of the codebase this job touches and tell me what is already in place.
2. Plan, then stop. Give me a numbered plan: what you will change, in which files, and why. Wait for my approval before editing anything.
3. Fix things at their source (the shared layout, the config, the generator), not with one-off patches page by page.
4. Keep the project's conventions: its framework APIs, file layout, naming and code style. Add no new dependency without asking.
5. Where something is already done well, say so and leave it alone.

## You will not

- Edit `.env` files, secrets or API keys, or print their values.
- Deploy, push, merge or publish anything.
- Delete data, or run migrations or scripts against a production database.
- Add tracking, third-party scripts or links to any site I did not ask for.
- Change copy, design or behaviour that this job does not need.
- Add a paid service without asking.
- Rate limit webhooks from payment providers in a way that drops events.

## Your stack

- Framework: Work out the framework, router and build output from the project files (package.json, lockfiles, framework config) before planning, and say which you found.
- Host: Work out where the site is hosted from the config files (vercel.json, netlify.toml, wrangler config, Dockerfile, fly.toml) and say which you found.

## Steps

### 1. List the endpoints worth limiting

List every public route that accepts input or does expensive work: auth, contact and feedback forms, newsletter sign-up, search, uploads, webhooks, AI or other paid API calls, exports. For each, note the cost of one call and who should be allowed to call it.

### 2. One limiter, shared

Reuse a rate limiter if the project has one. If not, propose one that works on the current host across instances (a key-value store, Redis, the database, or the platform's rate limiting), not an in-memory counter that resets per instance. Key limits by IP for anonymous traffic and by account for signed-in traffic.

### 3. Set the limits

Pick limits per endpoint that a real person never hits (for example 5 password resets an hour, 30 searches a minute) and that stop a script. Answer over-limit requests with 429 and a `Retry-After` header, and show a friendly message in the UI rather than a raw error.

### 4. Make it observable

Log when limits trip (endpoint, key type, not personal data) so I can see attacks and tune limits. Add a test for at least one limited endpoint.

## Done means

- [ ] Every endpoint that sends email, calls a paid API, searches or accepts uploads is rate limited.
- [ ] Limits work across instances, keyed by IP or account.
- [ ] Over-limit requests get 429 with Retry-After and a friendly message in the UI.
- [ ] Tripped limits are logged, and a test covers one limited endpoint.

## Report back

When you finish, give me:

- what you changed, file by file;
- anything you skipped, and why;
- anything I must do by hand (DNS records, dashboards, accounts, deploys);
- how to check each change on the live site.

One-line version

For agents that can read a URL. It fetches this prompt with your settings applied.

Read https://abacklaunch.com/prompts/rate-limits.md and follow it for this project.

3Check the result

When the changes are live, run these free checks. Add your site URL above and each one opens already running on it.

This prompt will not

  • Edit .env files, secrets or API keys, or print their values.
  • Deploy, push, merge or publish anything.
  • Delete data, or run migrations or scripts against a production database.
  • Add tracking, third-party scripts or links to any site I did not ask for.
  • Change copy, design or behaviour that this job does not need.
  • Add a paid service without asking.
  • Rate limit webhooks from payment providers in a way that drops events.

It reads your code first, shows you a plan, and waits for your approval before it changes anything.

What you get

  • A list of your public endpoints and the cost of each call
  • Shared rate limits on the expensive and abusable ones
  • Friendly 429 answers and logs for tripped limits

How to use this prompt

  1. 1

    Describe your stack

    Add your site, framework and host. The prompt adapts; blank fields are left for the agent to work out.

  2. 2

    Paste it into your agent

    Open your project in Claude Code, Cursor, Codex, Copilot, Windsurf or Cline, and paste the prompt or the one-line version.

  3. 3

    Approve the plan

    The agent reads your code, shows you a plan with the files it will touch, and waits. Change anything you disagree with.

  4. 4

    Check the result

    When the changes are live, run the free checks below on your site to confirm each fix.

What the agent does

When the production site launches, the same publicity that brings users brings scrapers, spam bots and the occasional angry script. Endpoints that send email, call paid APIs, run searches or accept uploads can run up a bill or fall over. Put sensible limits on them, using one shared mechanism.

  1. 1. List the endpoints worth limiting

    List every public route that accepts input or does expensive work: auth, contact and feedback forms, newsletter sign-up, search, uploads, webhooks, AI or other paid API calls, exports. For each, note the cost of one call and who should be allowed to call it.

  2. 2. One limiter, shared

    Reuse a rate limiter if the project has one. If not, propose one that works on the current host across instances (a key-value store, Redis, the database, or the platform's rate limiting), not an in-memory counter that resets per instance. Key limits by IP for anonymous traffic and by account for signed-in traffic.

  3. 3. Set the limits

    Pick limits per endpoint that a real person never hits (for example 5 password resets an hour, 30 searches a minute) and that stop a script. Answer over-limit requests with 429 and a Retry-After header, and show a friendly message in the UI rather than a raw error.

  4. 4. Make it observable

    Log when limits trip (endpoint, key type, not personal data) so I can see attacks and tune limits. Add a test for at least one limited endpoint.

Done means

  • Every endpoint that sends email, calls a paid API, searches or accepts uploads is rate limited.
  • Limits work across instances, keyed by IP or account.
  • Over-limit requests get 429 with Retry-After and a friendly message in the UI.
  • Tripped limits are logged, and a test covers one limited endpoint.

Questions

Why not an in-memory counter?

Serverless and multi-instance hosts run many copies of your app. Each copy keeps its own counter, so the real limit is the limit times the number of copies, and it resets whenever one restarts.

Will rate limits block real users behind one office IP?

Limits keyed by account for signed-in users avoid that, and anonymous limits should be generous enough for a shared network. The prompt asks the agent to size them for real use.

Should webhooks be rate limited?

Carefully. Payment providers retry and may send bursts. Verify their signatures instead, and never drop a signed event.

Does this prompt add links to Aback Launch to my site?

No. Nothing in the prompt mentions Aback Launch or asks your agent to link to us. The only exception is an optional badge step, which stays off unless you tick it. Some prompt libraries slip their own link into your codebase by default; we think that should always be your choice.

Which coding agents does it work with?

Claude Code, Cursor, Codex, GitHub Copilot, Windsurf, Cline, and any agent that can read your project and edit files. You can copy it as a plain prompt, save it as a Claude Code skill or a Cursor rule, or add it to AGENTS.md.

Is it safe to run on my real codebase?

The prompt makes the agent read first, show a plan and wait for your approval, and it forbids touching secrets, deploying and deleting data. Still review the changes and run your tests before you deploy, as with any change.

Changelog

  • v1.0First version.

Launch your startup on Aback Launch

Get a launch page that search engines and AI assistants can read, a place in the weekly launch list, and a review by a real person. Free to join.