Storage is where your app keeps uploaded files and generated media. If you
skip storage, the basic app can still run, but upload-heavy features will not
work properly.
Why You Need Storage
This repo uses storage for things like:- chat document uploads
- generated images
- generated videos
- generated audio
- user-uploaded files for vision or other tools
What You Need To Configure
What These Env Vars Mean
STORAGE_REGION: region value expected by your providerSTORAGE_ACCESS_KEY: access key for your bucketSTORAGE_SECRET_KEY: secret key for your bucketSTORAGE_ENDPOINT: S3-compatible API endpointSTORAGE_BUCKET: bucket nameSTORAGE_PUBLIC_URL: the public URL users will open in the browser
The Most Important Rule
STORAGE_PUBLIC_URL must point to the same bucket your app is uploading into.
If your app writes to Bucket A but your public URL points to Bucket B or the
wrong CDN domain, uploads may succeed but the generated links will be broken.
Recommended Provider: Cloudflare R2
Cloudflare R2 is the easiest default because it is S3-compatible and simple to wire up for this kind of app.Cloudflare R2 Setup
- Create a bucket in R2
- Generate an API token with read/write access
- Copy the S3 endpoint
- Configure a public URL using a custom domain or
r2.dev - Put those values into
.env.local
How The Repo Uses Storage
The main files are:lib/storage/object-storage.tslib/clients/cloudflare.ts
Verification Checklist
Your storage setup is working if:- you can upload a file
- generated media saves successfully
- the stored file URL opens in the browser
Common Mistakes
- wrong bucket name
- wrong endpoint
STORAGE_PUBLIC_URLpointing at the wrong bucket or domain- creating the env vars but not restarting the app

