Configuration
Add a storage adapter to the rootstorage key. Without further configuration, it stores the files for FrogBot’s own upload collections:
- The files collection: the collection marked
file: true, if any. frogbot-chat-assets, when chat persistence is enabled.
collections. To keep one of FrogBot’s collections on local disk, set it to false:
Multiple adapters
FrogBot’s collections go to the first storage adapter instorage. To store one of them with a different adapter, list it in that adapter’s collections. Setting one to false only takes effect in the first adapter. Listing the same collection in two adapters stops FrogBot at startup with an error.
files collection marked file: true. Here files uses Vercel Blob and frogbot-chat-assets uses S3.
Vercel Blob Storage
@frogbotai/storage-vercel-blob
Installation#vercel-blob-installation
Usage#vercel-blob-usage
- FrogBot’s upload collections use the adapter automatically. Add your own upload collections to
collections; each slug must match an existing upload collection. - Ensure you have
BLOB_READ_WRITE_TOKENset in your Vercel environment variables. This is usually set by Vercel automatically after adding blob storage to your project. - When enabled, this package will automatically set
disableLocalStoragetotruefor each collection. - When deploying to Vercel, server uploads are limited with 4.5MB. Set
clientUploadstotrueto do uploads directly on the client.
Configuration Options#vercel-blob-configuration
Also accepts the shared options.S3 Storage
@frogbotai/storage-s3
Installation#s3-installation
Usage#s3-usage
- FrogBot’s upload collections use the adapter automatically. Add your own upload collections to
collections; each slug must match an existing upload collection. - The
configobject can be anyS3ClientConfigobject (from@aws-sdk/client-s3). This is highly dependent on your AWS setup. Check the AWS documentation for more information. - When enabled, this package will automatically set
disableLocalStoragetotruefor each collection. - When deploying to Vercel, server uploads are limited with 4.5MB. Set
clientUploadstotrueto do uploads directly on the client. You must allow CORS PUT method for the bucket to your website. - Configure
signedDownloads(either globally or per-collection incollections) to use presigned URLs for files downloading. This can improve performance for large files (like videos) while still respecting your access control. Additionally, withsignedDownloads.shouldUseSignedURLyou can specify a condition whether FrogBot should use a presigned URL, if you want to use this feature only for specific files. - You can conditionally enable the adapter using the
enabledoption. For example,enabled: Boolean(process.env.S3_BUCKET)skips the adapter in local development when credentials are not set.
Configuration Options#s3-configuration
Also accepts the shared options. Entries incollections also accept signedDownloads, which overrides the adapter-level setting for that collection.
Signed downloads
For full
S3ClientConfig options, see the AWS SDK Package and S3ClientConfig docs.
Using with Cloudflare R2 (via S3 API)#s3-r2
Cloudflare R2 exposes an S3-compatible API, so you can use@frogbotai/storage-s3 to connect to it. This is the recommended approach when deploying to Vercel, Netlify, or any Node.js environment. (The @frogbotai/storage-r2 adapter is for Cloudflare Workers only, where R2 is available as a native bucket binding.)
region: 'auto'— required by R2; standard AWS region values are not acceptedendpoint— your R2 S3 API endpoint from the Cloudflare dashboard. This is for uploads only — not for serving filesforcePathStyle: true— required for R2’s path-style bucket addressingR2_PUBLIC_URL— your bucket’s public URL (either the*.r2.devsubdomain or a custom domain you’ve connected in Cloudflare). This is separate from the S3 API endpointdisablePayloadAccessControl: true— bypasses FrogBot’s file proxy so URLs point directly to your public R2 domain
Azure Blob Storage
@frogbotai/storage-azure
Installation#azure-installation
Usage#azure-usage
- FrogBot’s upload collections use the adapter automatically. Add your own upload collections to
collections; each slug must match an existing upload collection. - When enabled, this package will automatically set
disableLocalStoragetotruefor each collection. - When deploying to Vercel, server uploads are limited with 4.5MB. Set
clientUploadstotrueto do uploads directly on the client. You must allow CORS PUT method to your website.
Configuration Options#azure-configuration
Also accepts the shared options.Google Cloud Storage
@frogbotai/storage-gcs
Installation#gcs-installation
Usage#gcs-usage
- FrogBot’s upload collections use the adapter automatically. Add your own upload collections to
collections; each slug must match an existing upload collection. - When enabled, this package will automatically set
disableLocalStoragetotruefor each collection. - When deploying to Vercel, server uploads are limited with 4.5MB. Set
clientUploadstotrueto do uploads directly on the client. You must allow CORS PUT method for the bucket to your website.
Configuration Options#gcs-configuration
Also accepts the shared options.R2 Storage
@frogbotai/storage-r2
Use this adapter to store uploads in a Cloudflare R2 bucket via the Cloudflare Workers environment. If you’re connecting to R2 from a Node.js environment (Vercel, Netlify, etc.) using the S3-compatible API, see Using with Cloudflare R2 (via S3 API) instead.
Installation#r2-installation
Usage#r2-usage
- FrogBot’s upload collections use the adapter automatically. Add your own upload collections to
collections; each slug must match an existing upload collection. - Pass in the R2 bucket binding to the
bucketoption, this should be done in the environment where FrogBot is running (e.g. Cloudflare Worker). - You can conditionally enable the adapter with the
enabledoption.
Configuration Options#r2-configuration
Also accepts the shared options.Shared storage options
Every storage adapter accepts these options, except where noted.Collection-specific options
Prefix Composition
Storage adapters support two types of prefixes:- Collection prefix: Set at the adapter configuration level (e.g.,
prefix: 'media-folder') - Document prefix: Set per-document via the
prefixfield on the upload collection
useCompositePrefixes changes how a document prefix is read and stored:
- Default (
false): the document prefix is a full path. If it already starts with the collection prefix, it’s used as-is; otherwise it’s nested beneath the collection prefix, and the storedprefixfield holds the combined path. true: the document prefix is always relative. It’s joined to the collection prefix when the file key is built, and the storedprefixfield holds only the document part.
FrogBot Access Control
FrogBot ships with Access Control that runs even on statically served files. The sameread Access Control property on your upload-enabled collections is used, and it allows you to restrict who can request your uploaded files.
To preserve this feature, by default, storage adapters keep all file URLs exactly the same. Your file URLs won’t be updated to point directly to your cloud storage source, as in that case, FrogBot’s Access control will be completely bypassed and you would need public readability on your cloud-hosted files.
Instead, all uploads will still be reached from the default /collectionSlug/staticURL/filename path. Storage adapters will “pass through” all files that are hosted on your third-party cloud service—with the added benefit of keeping your existing Access Control in place.
If this does not apply to you (your upload collection has read: () => true or similar) you can disable this functionality by setting disablePayloadAccessControl to true. When this setting is in place, the adapter will update your file URLs to point directly to your cloud host. For a concrete example, see Using with Cloudflare R2 (via S3 API).
Conditionally Enabling/Disabling
Use the adapter’senabled property to conditionally enable or disable cloud storage. When disabled, local uploads remain available unless the collection disables local storage.