Tweet by BraydenWilmoth
June 25, 2025
Today we're announcing the all new @cloudflare/actors library to help make developing with Durable Objects easier than ever before. Powerful feature defaults, improved interfaces, and a new default export handler. So what all can it do today? - Get current instance by name - Store all instances by name and last accessed - Route to a DO without a user-defined Worker - Define instance name within a DO - Execute SQL with template literals - Run SQL Migrations - Set multiple alarms by date, delay, or cron - Access an Actor by class (not by env.XY) - Destroy instances How to use it: `npm i @cloudflare/actors` Examples: ----------- Basic Worker ^ and yep. that's the whole index.ts file you need for the most basic Worker now. RPC into an Actor: ^ now you can just do a `.get` on your Actor class directly and pass in the instance name to interact with it via RPC. No more creating a stub and doing the things. Alarms: ^ schedule as many alarms as you want and define them with a Date, seconds delay (see above), or cron and pass in an array of parameters that map to the function you're calling into. Shout out to @threepointone for his work here. Storage: ^ define & run migrations, query with `this.sql` template literals. You can also see here how we log out `this.identifier` which logs out the user provided "name" value of the instance (not the ID itself). Also the second param in our `handler` allows us to define that we should in fact track all instances we create by name and store it in another instance altogether to keep track of. Shout out to @LambrosPetrou for his migrations work! Handler: As shown in all the examples above you can use our new `export default handler(...)` to export a Worker or an Actor. This handler does a lot of the magic of some of the features (such as tracking instances, holding identifiers and more). Best of all, these features can be used by your DurableObject classes as they are today without extending Actor... ...or.... you can just extend "Actor" instead of "DurableObject" and get all of the power this library unlocks automagically. ---- This is a BETA release to get user feedback. Intention of this library is to make working with various components of Durable Objects much easier, have less overhead, and add things here that may be more difficult or time consuming to add to the runtime to provide benefits to developers fast. Please provide feedback & share what types of features you would love to see in this library. Hope you all enjoy it!
- Author
- BraydenWilmoth
- Date
- June 25, 2025
- Canonical URL
- /tweets/braydenwilmoth-1937862089332404402-47f343