How to Get Free File Storage for Your App
Your app needs a place to store images, user uploads, generated files, or PDFs. Cloudflare R2 gives you 10GB free with zero egress fees — meaning you're never charged when people download your files.
This guide was written as of April 2026. If anything looks different, let us know.
Before you start
What you'll have at the end
Access Key, Secret Key, and bucket URL in your .env file
Free tier
10GB storage, 10 million reads/mo, 1 million writes/mo. No egress fees ever. Beyond 10GB: $0.015/GB/mo.
What is file storage?
File storage is a place to put images and files your app uses — like a cloud hard drive. When your app lets users upload profile pictures, or your AI tool generates images, they need somewhere to live. That's what R2 does.
Create a Cloudflare account
Go to cloudflare.com and sign up. Free account, no credit card required.
Create an R2 bucket
In the Cloudflare dashboard, go to R2 Object Storage in the left sidebar. Click Create Bucket. Name it after your project (e.g., "my-app-files"). Pick a region close to your users.
Generate API credentials
In the R2 section, click Manage R2 API Tokens. Create a new API token with read and write permissions. Copy your Access Key ID and Secret Access Key.
Add to your .env file
Add these to your .env file:
R2_ACCESS_KEY_ID=your-access-key
R2_SECRET_ACCESS_KEY=your-secret-key
R2_BUCKET_NAME=my-app-files
R2_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com
Verify it works
You should now see your bucket in the Cloudflare dashboard and have four new lines in your .env file. Your AI tool can now upload and retrieve files.
Tell Your AI Tool
Copy this prompt and paste it into your AI coding tool. It tells your AI exactly what credentials you just set up.
I've set up Cloudflare R2 for file storage. My credentials are in my .env file: - R2_ACCESS_KEY_ID - R2_SECRET_ACCESS_KEY - R2_BUCKET_NAME - R2_ENDPOINT R2 is S3-compatible. Use it to store [images/uploads/files] for [describe your app].
Paste the prompt into the chat panel (Cmd+L or Ctrl+L). Cursor can also read your .env file directly — if your credentials are there, it already knows.
YepAPI Tip
Use YepAPI to generate AI images or scrape competitor pages — store everything in R2.
Was this guide helpful?
Cloudflare R2 — FAQ
Object storage is a way to store files (images, PDFs, videos) in the cloud. Unlike a database which stores structured data, object storage holds files exactly as they are. Think of it as a cloud hard drive for your app.
Yes. The free tier gives you 10GB of storage, 10 million reads per month, and 1 million writes per month. The biggest deal: zero egress fees, meaning you never pay when people download your files.
R2 is Cloudflare's version of Amazon S3. They work the same way and use the same API. The main difference: R2 has no egress fees (S3 charges you when files are downloaded). R2 also has a more generous free tier.
Egress fees are charges for downloading files from cloud storage. Most providers (AWS S3, Google Cloud Storage) charge you every time someone accesses your files. Cloudflare R2 charges zero egress fees — ever.
Start vibe coding with one API key.
One API key. 100+ endpoints. Yep, that's it.