Skip to content
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
aac5ff5
[DO] Squashing commits
Oxyjun Mar 19, 2025
58dbd64
Update src/content/docs/durable-objects/features/access-durable-objec…
Oxyjun Mar 20, 2025
a15e7e1
Implementing first round of feedback.
Oxyjun Mar 20, 2025
84bb517
Fixing broken links
Oxyjun Mar 20, 2025
0f62f5f
Merge commit 'f202b11ff9e6cb29309ec9a2a5b1c5898775fb47' into jun/do/f…
Oxyjun Mar 20, 2025
f38b62f
Keeping the sidebar as "Best practices".
Oxyjun Mar 26, 2025
7d0c814
Matching HEAD, resolving conflicts.
Oxyjun Mar 26, 2025
3bedee4
Manually capturing potential conflict.
Oxyjun Mar 26, 2025
58600bf
Sticking with 'best practices' as sidebar.
Oxyjun Mar 26, 2025
c847807
Removing infinite redirect
Oxyjun Mar 26, 2025
c8e0f01
Removing storage per account for SQLite DO limits
Oxyjun Mar 26, 2025
5c9ea0d
pm edits for sqlite ga
vy-ton Mar 30, 2025
3e38d21
pm edits for pricing & limits
vy-ton Mar 31, 2025
4b60e00
add note now sql storage billing
vy-ton Mar 31, 2025
00a1682
Merging `sql-storage` into `storage-api` chapter.
Oxyjun Mar 31, 2025
5d5ad91
Adding a note about local / remote development.
Oxyjun Apr 1, 2025
52a9c76
Merge commit '4bdf47a2b13b1e2f64fb1694a2db7bebdd809aa9' into jun/do/f…
Oxyjun Apr 1, 2025
670a36a
Updating footnote wording.
Oxyjun Apr 1, 2025
dc6c11c
Adding `migrations` to inheritable fields for
Oxyjun Apr 1, 2025
b4dd1a9
Merge commit '92af7a0c4f213dcc3f7a0cf3c0d93fe54882e7ac' into jun/do/f…
Oxyjun Apr 2, 2025
1d0db3e
Specifying what the changes are.
Oxyjun Apr 2, 2025
6a56e07
DO cleanup, adding table of APIs in storage-api.
Oxyjun Apr 3, 2025
41a5b0c
Explicitly stating product inside partial.
Oxyjun Apr 3, 2025
9d23c24
add changelogs
vy-ton Apr 3, 2025
2735451
add code to changelogs
vy-ton Apr 3, 2025
e33f371
pm re-structuring
vy-ton Apr 4, 2025
4a1c653
fix compile issue
vy-ton Apr 4, 2025
9ee4572
fix components
vy-ton Apr 4, 2025
e4b721b
Apply suggestions from code review
Oxyjun Apr 4, 2025
d9efb1d
Adding bookmark in glossary, referencing it in
Oxyjun Apr 4, 2025
61672ca
Accepting PCX Review part 1
Oxyjun Apr 4, 2025
4f85f28
Accepting PCX Review part 2
Oxyjun Apr 4, 2025
68ccf02
Merge branch 'jun/do/ft-srs-ga-2' of github.com:cloudflare/cloudflare…
Oxyjun Apr 4, 2025
567a160
Adding text in anticipation of the DtC button.
Oxyjun Apr 4, 2025
6ab6f95
pm fixup
vy-ton Apr 4, 2025
d5e5a95
Importing missing Render component.
Oxyjun Apr 4, 2025
00f52bb
add deploy button, release notes, small fixups
vy-ton Apr 5, 2025
f83fd9c
update changelog deploy button url
vy-ton Apr 5, 2025
480c0b2
fix spacing and add link
vy-ton Apr 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion public/__redirects
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@
/durable-objects/api/hibernatable-websockets-api/ /durable-objects/best-practices/websockets/ 301
/durable-objects/api/alarms-in-durable-objects/ /durable-objects/api/alarms/ 301
/durable-objects/api/websockets/ /durable-objects/best-practices/websockets/ 301
/durable-objects/api/sql-storage/ /durable-objects/api/storage-api/ 301
/durable-objects/platform/data-location/ /durable-objects/reference/data-location/ 301
/durable-objects/platform/environments/ /durable-objects/reference/environments/ 301
/durable-objects/platform/troubleshooting/ /durable-objects/observability/troubleshooting/ 301
Expand All @@ -406,7 +407,9 @@
/durable-objects/platform/changelog/ /durable-objects/release-notes/ 301
/durable-objects/changelog/ /durable-objects/release-notes/ 301
/durable-objects/glossary/ /durable-objects/reference/glossary/ 301
/durable-objects/get-started/walkthrough/ /durable-objects/get-started/tutorial/ 301
/durable-objects/get-started/walkthrough/ /durable-objects/get-started/ 301
/durable-objects/get-started/tutorial/ /durable-objects/get-started/ 301
/durable-objects/get-started/tutorial-with-sql-api/ /durable-objects/get-started/ 301
/durable-objects/get-started/video-series/intro/ /durable-objects/video-tutorials/ 301
/durable-objects/get-started/video-series/app-frontend/ /durable-objects/video-tutorials/ 301
/durable-objects/get-started/video-series/deploy-app/ /durable-objects/video-tutorials/ 301
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Durable Objects on Workers Free plan
description: Durable Objects now available on Workers Free plan.
products:
- durable-objects
- workers
date: 2025-04-07T06:00:00Z
---

Durable Objects can now be used with zero commitment on the [Workers Free plan](/workers/platform/pricing/) allowing you to build AI agents with [Agents SDK](/agents/), collaboration tools, and real-time applications like chat or multiplayer games.

Durable Objects let you build stateful, serverless applications with millions of tiny coordination instances that run your application code alongside (in the same thread!) your durable storage. Each Durable Object can access its own SQLite database through a [Storage API](/durable-objects/best-practices/access-durable-objects-storage/). A Durable Object class is defined in a Worker script encapsulating the Durable Object's behavior when accessed from a Worker. To try the code below, click the button:

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/templates/tree/staging/hello-world-do-template)

```js
import { DurableObject } from "cloudflare:workers";

// Durable Object
export class MyDurableObject extends DurableObject {
...

async sayHello(name) {
return `Hello, ${name}!`;
}
}

// Worker
export default {
async fetch(request, env) {
// Every unique ID refers to an individual instance of the Durable Object class
const id = env.MY_DURABLE_OBJECT.idFromName("foo");

// A stub is a client used to invoke methods on the Durable Object
const stub = env.MY_DURABLE_OBJECT.get(id);

// Methods on the Durable Object are invoked via the stub
const response = await stub.sayHello("world");

return response;
},
};
```

Free plan [limits](/durable-objects/platform/pricing/) apply to Durable Objects compute and storage usage. Limits allow developers to build real-world applications, with every Worker request able to call a Durable Object on the free plan.

For more information, checkout:
- [Documentation](/durable-objects/what-are-durable-objects/)
- [Zero-latency SQLite storage in every Durable Object blog](https://blog.cloudflare.com/sqlite-in-durable-objects/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: SQLite in Durable Objects GA with 10GB storage per object
description: SQLite-backed Durable Objects are generally available.
products:
- durable-objects
- workers
date: 2025-04-07T06:00:00Z
---

SQLite in Durable Objects is now generally available (GA) with 10GB SQLite database per Durable Object. Since the [public beta](https://blog.cloudflare.com/sqlite-in-durable-objects/) in September 2024, we've added feature parity and robustness for the SQLite storage backend compared to the preexisting key-value (KV) storage backend for Durable Objects.

SQLite-backed Durable Objects are recommended for all new Durable Object classes, using `new_sqlite_classes` [Wrangler configuration](/durable-objects/best-practices/access-durable-objects-storage/#create-sqlite-backed-durable-object-class). Only SQLite-backed Durable Objects have access to Storage API's [SQL](/durable-objects/api/storage-api/#sql-api) and [point-in-time recovery](/durable-objects/api/storage-api/#pitr-point-in-time-recovery-api) methods, which provide relational data modeling, SQL querying, and better data management.

```js
export class MyDurableObject extends DurableObject {
sql: SqlStorage
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
this.sql = ctx.storage.sql;
}

async sayHello() {
let result = this.sql
.exec("SELECT 'Hello, World!' AS greeting")
.one();
return result.greeting;
}
}
```

KV-backed Durable Objects remain for backwards compatibility, and a migration path from key-value storage to SQL storage for existing Durable Object classes will be offered in the future.

For more details on SQLite storage, checkout [Zero-latency SQLite storage in every Durable Object blog](https://blog.cloudflare.com/sqlite-in-durable-objects/).
2 changes: 1 addition & 1 deletion src/content/docs/agents/api-reference/schedule-tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Calling `await this.schedule` returns a `Schedule`, which includes the task's ra

:::note[Maximum scheduled tasks]

Each task is mapped to a row in the Agent's underlying [SQLite database](/durable-objects/api/sql-storage/), which means that each task can be up to 2 MB in size. The maximum number of tasks must be `(task_size * tasks) + all_other_state < maximum_database_size` (currently 1GB per Agent).
Each task is mapped to a row in the Agent's underlying [SQLite database](/durable-objects/api/storage-api/), which means that each task can be up to 2 MB in size. The maximum number of tasks must be `(task_size * tasks) + all_other_state < maximum_database_size` (currently 1GB per Agent).

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Learn more about the zero-latency SQL storage that powers both Agents and Durabl

:::

The SQL API exposed to an Agent is similar to the one [within Durable Objects](/durable-objects/api/sql-storage/): Durable Object SQL methods available on `this.ctx.storage.sql`. You can use the same SQL queries with the Agent's database, create tables, and query data, just as you would with Durable Objects or [D1](/d1/).
The SQL API exposed to an Agent is similar to the one [within Durable Objects](/durable-objects/api/storage-api/#sql-api): Durable Object SQL methods available on `this.ctx.storage.sql`. You can use the same SQL queries with the Agent's database, create tables, and query data, just as you would with Durable Objects or [D1](/d1/).

### Use Agent state as model context

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,15 @@ Create a new Worker project named `browser-worker` by running:
args={"browser-worker"}
/>

## 2. Enable Durable Objects in the dashboard

To enable Durable Objects, you will need to purchase the Workers Paid plan:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/), and select your account.
2. Go to **Workers & Pages** > **Plans**.
3. Select **Purchase Workers Paid** and complete the payment process to enable Durable Objects.

## 3. Install Puppeteer
## 2. Install Puppeteer

In your `browser-worker` directory, install Cloudflare’s [fork of Puppeteer](/browser-rendering/platform/puppeteer/):

```sh
npm install @cloudflare/puppeteer --save-dev
```

## 4. Create a R2 bucket
## 3. Create a R2 bucket

Create two R2 buckets, one for production, and one for development.

Expand All @@ -68,7 +60,7 @@ wrangler r2 bucket list

After running the `list` command, you will see all bucket names, including the ones you have just created.

## 5. Configure your Wrangler configuration file
## 4. Configure your Wrangler configuration file

Configure your `browser-worker` project's [Wrangler configuration file](/workers/wrangler/configuration/) by adding a browser [binding](/workers/runtime-apis/bindings/) and a [Node.js compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag). Browser bindings allow for communication between a Worker and a headless browser which allows you to do actions such as taking a screenshot, generating a PDF and more.

Expand Down Expand Up @@ -100,13 +92,13 @@ class_name = "Browser"

[[migrations]]
tag = "v1" # Should be unique for each entry
new_classes = ["Browser"] # Array of new classes
new_sqlite_classes = ["Browser"] # Array of new classes

```

</WranglerConfig>

## 6. Code
## 5. Code

The code below uses Durable Object to instantiate a browser using Puppeteer. It then opens a series of web pages with different resolutions, takes a screenshot of each, and uploads it to R2.

Expand Down Expand Up @@ -219,11 +211,11 @@ export class Browser {
}
```

## 7. Test
## 6. Test

Run [`npx wrangler dev --remote`](/workers/wrangler/commands/#dev) to test your Worker remotely before deploying to Cloudflare's global network. Local mode support does not exist for Browser Rendering so `--remote` is required.

## 8. Deploy
## 7. Deploy

Run [`npx wrangler deploy`](/workers/wrangler/commands/#deploy) to deploy your Worker to the Cloudflare global network.

Expand Down
Loading
Loading