Register and share your invite link to earn from video plays and referrals.

Aaron Boodman
@aboodman
CEO @rocicorp. Building @zero__ms, raising two great kids, trying to be a better person. Past: @replicache, @nomsdb, @googlechrome.
1000 Following    9.8K Followers
Think of DOs by analogy to a serverless function. A better (and much funnier) name might have been "serverless objects". A "serverless function" is a stateless javascript program you upload to, say, Vercel. The external interface is a function. It is reachable at a URL. You send a request to the URL, Vercel instantaites your program, sends the exported function the request, gets the function result, send the result to you as an HTTP response, then destroys the program. DOs are exact same thing, but stateful. You upload a JavaScript program to CloudFlare. The external interface is a *class*, not a function. DOs are reachable at a URL. You send a request to the URL and CloudFlare invokes your program, instantiates your class, and sends a particular method on the class the request, gets the result, and send it to you as an HTTP response. So far, just a more complicated version of serverless functions. The difference is that CF keeps that class running for awhile. If another request comes into same URL, CF routes it to the same running program and the same exact JavaScript object in memory. So you can keep state in that JS objects across invocations. That's it, that's the whole pitch. These little javascript programs are low-power (last I looked max ram was maybe 1GB?). But they are cheap to run so you can have zillions of them. This makes them a very useful primitive for certain kinds of problems, like say chatrooms, multiplayer games, etc.
Show more
Do you guys want to know what durable objects are? The name is awful but I can explain it to you. It's a really cool and unique architectural primitive, different than really anything else on the market.
Show more