I'm still a little sad I made my whole project work on Cloudflare just to realize the pricing would absolutely kill me because of the checks I do in the middleware
DOs are supported in a bunch of places, https://where.durableobjects.live/, support their own tranactional storage api which replicates reads to a few nearby dcs for redundancy. You make a Durable Object instance per user, store cookie/etc in their storage, and setup an alarm to delete it in x time
I'm still a little nervous about the Cloudflare pricing though, its very possible that my initial app launch could cost a lot, since I cant really estimate usage at the moment.
But I guess I'll see. Worst case scenario I can take the app down for a bit and switch to hosting on a VPS. I'd rather avoid that but if pricing becomes an issue that's the only choice I see as viable.
@Chaika this is kind of a broad question, but do you know of any tools that can estimate the cost of cloudflare services based on my expected daily users? Or anything similar to that
Workers are V8 Isolates, a kind of single-threaded web environment javascript execution environment. Durable Objects are the same, also isolates, but the catch is there's only one per Durable Object ID in the entire world, and they have transactional consistent storage. Their storage has to be reliable, so they can only run in locations where there is several nearby DCs to replicate writes to
It doesn't move around, it stays in the same place once created. You define a Durable Object in your code, for example for a session store. You then create a DO instance per user which gets created nearby and won't move, and you can save the session cookie/token in storage. Then, whenever the user goes to auth, you have the DO which is nearby to check for their auth. state.
You benefit from the fact that there's only one DO and storage is transactional/with locks, don't have to wait for eventual consistency like with KV, and it's nearby the user so low latency