transcripts table, the shared importly.ts helper, the importly-webhook function that saves each finished transcript, and the sweep for missed webhooks. Here you add:
- a private
uploadsbucket where each user can only write to and read their own folder; transcribe-upload, which checks the file belongs to the caller, signs it and starts the transcript.
1. The bucket
Run this in the SQL editor or add it as a migration. Each user uploads to a folder named after their user ID, so the policies can check the first part of the path.2. Upload from the app
The upload goes straight from the browser to Storage with the user’s session. Nothing passes through your functions.new row violates row-level security policy.
3. Sign it and start the transcript
The frontend calls this function with the user’s session and the path it just uploaded. The function makes sure the path is in the caller’s own folder before it signs anything, so one user can’t get another user’s file transcribed.supabase/functions/transcribe-upload/index.ts
importly-webhook function from the transcripts recipe saves the result to the row when it’s ready, and the sweep catches a missed webhook. Neither needs a change.
4. Call it and show the transcript
segments has the start and end of each line in seconds, so you can show the transcript next to the recording and seek the player when a user clicks a line. To let users search across everything they’ve uploaded, add Supabase transcript search.
What we tested
We uploaded a 2 minute 41 second MP3 (a public-domain LibriVox reading of the Gettysburg Address) to a private bucket as a signed-in user, signed it with this function’s checks and sent the signed link toPOST /transcribe with "mode": "ai". With "wait": 60 the finished transcript, 18 timestamped segments, came back in the response 13 seconds later and cost $0.03. A second user asking for the first user’s path got 403, a path that didn’t exist got 404, and an upload into another user’s folder was refused by the policy.
Things to know
The signed link only has to work until Importly fetches the file, which is when the job starts. If you queue many uploads at once, an hour still covers it. Don’t store the link: store the path and sign it again when you need it. Supabase’s Free plan caps a single file at 50 MB, about 50 minutes of 128 kbps MP3 or a few minutes of phone video. Paid plans can raise the bucket limit. Importly only needs the link, so a bigger file doesn’t change the function. For a video upload you only want the words from, the same function works: Importly transcribes the audio track.Speech-to-text is $0.01 per minute, and
maxCostDollars stops a long recording before it’s charged. Try it free, no card required. See Pricing & credits.