4 comments

[ 4.1 ms ] story [ 23.6 ms ] thread
The biggest take is:

> Say you need to maintain per user API usage counts. You could simply call the right Durable Object after fielding every request to update the usage count.

> Historically, API usage to be maintained by a database entry with a piece of compute running in front of it to handle updates.

With cloudflare workers and durable objects, complex operations(in terms of implementation) such as api usage and access limits can be handled easily.

You can both track and limit access(and cache at edge as a bonus) to api by simply using a worker on cloudflare with minimal development time and cost.

Do you experience using DOs in this way?
I have played around with cloudflare workers alot recently and ended up using it on a couple of projects to use it cache api requests to my app thus reducing massive overhead to the server.

At some point I was thinking of offering the API as a service to users and I was trying to figure out the best way to go about the usage tracking. After doing some research, I realized that using cloudflare workers(with Do) would be an easy and nifty way to do it but never got around to actually implementing it.

I'd love to learn more once you get around to it.