| ▲ | Ask HN: How do you handle strict rate-limiting on stateless edge workers? | |||||||||||||
| 1 points by rwasimsk 2 days ago | 6 comments | ||||||||||||||
I just finished building Inbondz, a serverless API on Cloudflare Workers that extracts pure text from URLs (strips HTML/CSS/JS). Because it's a free endpoint (api.inbondz.com/v1/extract), I had to figure out a way to stop abuse without a traditional server. I ended up using a D1 SQL ledger to track IPs and hard-cap them at 50 requests/day, plus a global 100k limit. For those of you building on the edge, is D1 the most efficient way to handle this, or is there a better way to track daily IP limits without burning through read/write quotas? (If you want to try breaking my current limit logic to see how it responds, the docs and terminal commands are at www.inbondz.com). | ||||||||||||||
| ▲ | danelliot a day ago | parent | next [-] | |||||||||||||
Unkey handles this well — single API call at the edge that does both key verification and rate limiting in sub-millisecond. Avoids the D1 read-modify-write race condition entirely since the rate limit state lives in their distributed system, not your worker's database. | ||||||||||||||
| ||||||||||||||
| ▲ | 2 days ago | parent | prev | next [-] | |||||||||||||
| [deleted] | ||||||||||||||
| ▲ | riyaroyxyz18 2 days ago | parent | prev | next [-] | |||||||||||||
I would say, you should increase its 50/day limit to make it more generous. Just wait for more donations. | ||||||||||||||
| ▲ | riyaroyxyz18 2 days ago | parent | prev [-] | |||||||||||||
That's great, I am gonna check it out and donate you as well. | ||||||||||||||