Skip to content
Skip to content
Goodspeed

Connect Cloudflare R2 to your Goodspeed app

Binary-safe object storage for user-generated media, app assets, and exports, accessed from Supabase Edge Functions with zero egress fees. Goodspeed wires Cloudflare R2 into every app that needs it at generation time, so you start with a working integration, not a blank config and a documentation tab.

WHAT GETS WIRED IN

Built into every Cloudflare R2 build

Every app Goodspeed generates with Cloudflare R2 includes these wired integrations from the first build. No manual setup required.

ItemDescriptionStrength
R2 bucket credentials stored as Supabase secrets (R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY) and never exposed to the app bundleR2 bucket credentials stored as Supabase secrets (R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY) and never exposed to the app bundle01
lib/media.ts uses the S3-compatible R2 API to upload user profile photos and user-generated content from Edge Functionslib/media.ts uses the S3-compatible R2 API to upload user profile photos and user-generated content from Edge Functions02
Binary-safe upload pipeline uses base64 encoding for all binary blobs to prevent corruption across UTF-8 JSON boundariesBinary-safe upload pipeline uses base64 encoding for all binary blobs to prevent corruption across UTF-8 JSON boundaries03
Pre-signed URLs generated server-side for time-limited client access to private media assetsPre-signed URLs generated server-side for time-limited client access to private media assets04
RLS-equivalent access control enforced at the Edge Function layer so users can only read and write their own objectsRLS-equivalent access control enforced at the Edge Function layer so users can only read and write their own objects05

Source: gas-template repository · object-storage

REAL GENERATED CODE

A snippet from a Cloudflare R2 integration the pipeline ships

This pattern comes directly from the gas-template codebase. The studio generates Cloudflare R2 integration code like this for every app that includes it, not a placeholder you have to fill in yourself.

  1. Binary-safe R2 upload

    // supabase/functions/upload-media/handler.ts
    const r2 = new S3Client({
      region: 'auto',
      endpoint: `https://${ACCOUNT_ID}.r2.cloudflarestorage.com`,
      credentials: {
        accessKeyId: Deno.env.get('R2_ACCESS_KEY_ID')!,
        secretAccessKey: Deno.env.get('R2_SECRET_ACCESS_KEY')!,
      },
    });
    
    async function uploadBinary(key: string, body: Uint8Array) {
      await r2.send(new PutObjectCommand({ Bucket: BUCKET, Key: key, Body: body }));
    }
GDaily Allergens

Today's log

Gluten
Tree nuts
Shellfish
Dairy
HomeScanLogProfile

START WITH CLOUDFLARE R2

Your Cloudflare R2 integration, generated