Object Storage is a scalable, high-performance storage solution for large files and unstructured data in Webflow Cloud. It enables you to store, retrieve, and manage objects, like images, videos, documents, and backups—without the complexity or egress fees of traditional cloud storage.
Use Object Storage when you need to store and serve large, binary, or unstructured data that doesn’t fit well in a database or key-value store.
Object Storage organizes data as objects, each identified by a unique key within a bucket, a container for objects.
Objects are stored and retrieved via a simple API, supporting direct uploads, downloads, and deletions. Data is distributed and replicated for durability and high availability.
Key features:
Object Storage is ideal for:
Create a bucket by adding a binding to the r2_buckets array in your wrangler.json file at the root of your app.
A bucket is a logical container for objects. Think of it as a dedicated database for your app’s files and media. Add a separate binding for each bucket you need for storing and serving files.
After deployment, Webflow Cloud automatically connects your app to each bucket, so you can store and retrieve objects by key.
Add a binding to your wrangler.json file
In your wrangler.json file, add a r2_buckets array. Declare a binding for each bucket you want to use inside the array. Binding names must be valid JavaScript variable names.
Generate TypeScript types for your bindings to enable autocomplete and type safety in your code editor:
This creates/updates a worker-configuration.d.ts file with your binding types. Note: in Next.js you’ll also need to update the types for the cloudflare-env.d.ts file to avoid type errors.
Deploy your app to Webflow Cloud. After deployment, you can view and manage your buckets in the Webflow Cloud dashboard.
Webflow Cloud exposes Object Storage buckets to your app as an environment variable, known as a binding, allowing you to interact with it directly from your application code without the need for API keys and credentials.
Always access the environment variable in your app’s runtime environment. This variable exposes methods from Cloudflare’s R2 Bindings API, allowing you to run data operations directly from your code.
In Astro, access the binding in your code using the locals object.
Manage objects in your bucket using the R2 API methods available on the binding. The most common operations are uploading, downloading, deleting, and listing objects. Each method is designed for fast, reliable access to your files and data directly from your app, with no need for external API keys.
Object Storage also supports S3-compatible API operations, making it easy to integrate with existing S3 tools and workflows. Learn more about S3 API compatibility.
To upload (store) an object in your bucket, use the .put() method on your binding. This method stores the provided data under the specified key and creates an R2Object containing the object’s metadata.
.put() returns a promise that resolves to an R2Object with metadata about the stored object. If a precondition in options fails, .put() returns null and the object isn’t stored.
key: Unique name for the object (string)value: Data to store (string, ArrayBuffer, ReadableStream, Blob, etc.)options: (Optional) Metadata, HTTP headers, or storage classObject Storage writes are strongly consistent: once the promise resolves, all subsequent reads will see the new object globally.
For all parameters and advanced options, see the Cloudflare R2 API documentation.
To retrieve an object from your bucket, use the .get() method on your binding. This method fetches the object body and metadata if the key exists, or returns null if not found.
.get() returns a promise that resolves to an R2ObjectBody that contains the object’s data and metadata, or null if the object doesn’t exist.
key: The object key (string)options: (Optional) Conditional headers or response optionsFor all parameters and advanced options, see the Cloudflare R2 API documentation.
To delete an object from your bucket, use the .delete() method on your binding. You can delete a single object by key or multiple objects by passing an array of keys (up to 1000 per call).
.delete() returns a promise that resolves when the objects have been deleted. Deleting a key that doesn’t exist is treated as a successful operation.
key: The object key (string) or an array of keysFor all parameters and advanced options, see the Cloudflare R2 API documentation.
To list objects in your bucket, use the .list() method on your binding. This method returns an array of objects and supports options such as prefix filtering, result limits, and pagination.
.list() returns a promise that resolves to an object containing an array of R2Object entries, a truncated boolean indicating if more results are available, and a cursor for pagination.
options: (Optional) Object with properties like prefix, limit, cursor, and delimiterFor all parameters and advanced options, see the Cloudflare R2 API documentation.
For more information on object storage, see the Cloudflare R2 API documentation.
Public buckets aren’t currently supported in Webflow Cloud. To serve files publicly, add them to your public folder.