JEDIAH AI

Cloudflare R2 Setup Guide

Self-Hosted Media Storage for Generated Clips

Prepared: August 2026 ยท Confidential

๐Ÿ“‹ Table of Contents

  1. Overview โ€” What & Why
  2. What You'll Need
  3. Create a Cloudflare Account
  4. Set Up an R2 Bucket
  5. Create an API Token
  6. Enable Public Access (Custom Domain)
  7. Gather Your Credentials
  8. Connect Storage to Jediah AI
  9. What Happens Next (Build Phase)
  10. Estimated Cost Summary
  11. Pre-Build Checklist

1. Overview โ€” What & Why

Currently, every video and image your studio generates is stored on the current managed media storage and served from a URL that contains the managed-media host. This guide walks you through setting up Cloudflare R2 โ€” your own media storage bucket โ€” so that after a clip is generated, it's automatically copied to your bucket and served from your domain instead.

Key benefit: Your generated clips will display URLs like https://media.jediahai.com/clips/...mp4 instead of https://the managed-media host/... โ€” fully branded, no third-party platform reference.

2. What You'll Need

ItemDetails
Email addressTo register a Cloudflare account
A custom domain (optional but recommended)e.g., jediahai.com or a subdomain like media.jediahai.com โ€” this is what appears in the clip URLs
5โ€“10 minutesThe setup is quick
A credit card (for verification)Required by Cloudflare even on the free tier; you won't be charged for low usage

3. Create a Cloudflare Account

1 Go to https://dash.cloudflare.com/sign-up
2 Enter your email and create a password
3 Verify your email address (check your inbox for the confirmation link)
4 Once logged in, you'll be on the Cloudflare dashboard home page

4. Set Up an R2 Bucket

1 In the left sidebar of the Cloudflare dashboard, click R2 Object Storage
2 If prompted, add a payment method (required to activate R2 โ€” you won't be charged for low usage)
3 Click Create bucket
4 Bucket name: Enter something like jediah-ai-media (lowercase, no spaces)
5 Location: Leave as "Automatic" (or pick the region closest to your users)
6 Click Create
Write down your bucket name โ€” you'll need to share it later. Example: jediah-ai-media

5. Create an API Token

This token allows the app to upload files to your bucket programmatically.

1 Go to https://dash.cloudflare.com/profile/api-tokens (or click your profile โ†’ My Profile โ†’ API Tokens)
2 Click Create Token
3 Scroll to the bottom and click Get started under "Create Custom Token"
4 Token name: jediah-ai-r2-upload
5 Under Permissions, set: Account โ†’ Cloudflare R2 โ†’ Admin Read & Write
6 Under Account Resources, select Include โ†’ your account
7 Click Continue to summary โ†’ then Create Token
8 Copy the token value immediately โ€” it's only shown once!
โš ๏ธ Save this token somewhere secure (a password manager). You will NOT be able to see it again after closing the page. If you lose it, you'll need to create a new one.

6. Enable Public Access (Custom Domain)

So clips can be viewed in the browser without a signed URL, you'll connect a domain to your bucket.

1 Go back to R2 Object Storage in the dashboard
2 Click your bucket name (jediah-ai-media)
3 Go to the Settings tab
4 Find Public access โ†’ R2.dev subdomain and enable it โ€” this gives you a quick public URL like https://pub-xxxxx.r2.dev
5 (Recommended) For a branded URL, connect a custom domain:
  • Under Custom Domains, click Connect Domain
  • Enter a subdomain like media.jediahai.com
  • If your domain is already on Cloudflare, it auto-configures. If not, you'll need to add your domain to Cloudflare first (DNS setup โ€” Cloudflare walks you through it).
Write down your public base URL. This is what will appear in clip links. Example: https://media.jediahai.com or https://pub-abc123.r2.dev

7. Gather Your Credentials

You should now have these four pieces of information. Write them all in one place:

CredentialExample
Bucket Namejediah-ai-media
Account IDFound on the right side of the Cloudflare dashboard home (a long alphanumeric string)
API TokenThe token you copied in Step 5
Public Base URLhttps://media.jediahai.com or https://pub-xxxxx.r2.dev

8. Connect Storage to Jediah AI

Once you have all four credentials, tell me (in this chat):

"I'm ready โ€” here are my R2 credentials:"

Then provide:
1. Bucket Name
2. Account ID
3. API Token
4. Public Base URL

I'll register them as secure secrets in the app (they're stored encrypted โ€” never visible in code or logs) and build the self-hosting pipeline.

9. What Happens Next (Build Phase)

Once you share your credentials, here's what I'll build:

  • Backend function โ€” downloads each generated clip from managed storage and uploads it to your R2 bucket
  • Updated generation flow โ€” after a clip is generated, it's automatically transferred and the stored URL is swapped to your branded one
  • Fallback handling โ€” if a transfer fails, the clip still works (falls back to the original URL so nothing breaks)
  • Testing โ€” I'll run a test generation to confirm the URL shows your domain

Timeline: Built and tested in the same session once credentials are provided.

10. Estimated Cost Summary

Usage LevelMonthly Cost (R2)
Light (under 100 clips)~$0 (free tier covers it)
Medium (100โ€“1,000 clips)$1โ€“5
Heavy (1,000+ clips, lots of views)$5โ€“20+ (still far cheaper than S3 due to $0 egress)
Why R2 over AWS S3? Cloudflare R2 charges $0 for egress (downloads/streams). For a media-heavy app where people watch and share clips, this is the single biggest cost saver โ€” S3 would bill you for every view.

11. Pre-Build Checklist

Before telling me you're ready, confirm you have all of these:

  • Cloudflare account created and email verified
  • R2 bucket created (bucket name noted)
  • Payment method added to Cloudflare (for R2 activation)
  • API token created and saved securely
  • Account ID noted (from dashboard home)
  • Public access enabled (R2.dev or custom domain)
  • Public base URL noted