How Terra securely stores uploaded files with private buckets and signed URLs
All files are stored in private Supabase Storage buckets. Zero public URLs.
form-uploads/ {formId}/ {uuid}/ {sanitized-filename}
// 1. Request signed upload URL const { data } = await supabaseAdmin.storage .from("form-uploads") .createSignedUploadUrl(path); // 2. Client uploads directly to signed URL await fetch(data.signedUrl, { method: "PUT", body: file, });
// Generate short-lived download URL const { data } = await supabaseAdmin.storage .from("form-uploads") .createSignedUrl(path, 60); // 60 second expiry return data.signedUrl;
if (form.google_drive_folder_id) { // Upload to Drive via service account const fileId = await uploadToDrive(file, folderId); return { provider: "drive", fileId }; } else { // Upload to Supabase await uploadToSupabase(file, path); return { provider: "supabase", path }; }
Was this page helpful?