start-import, an Edge Function the signed-in user calls with a link. It starts the import and adds a row to avideostable.importly-webhook, a second function that Importly calls when the file is in your bucket. It checks the signature and marks the row ready.- A frontend list that shows each user their own videos with signed URLs, so the bucket stays private.
1. Connect your bucket once
Create a private bucket (this guide calls itimports) and an S3 access key in your Supabase project, then save them on the dashboard’s S3 Storage page and click Test connection. The steps and the exact field values are in Supabase Storage setup.
Supabase’s S3 access keys can read and write every bucket in the project. Paste them into Importly only, never into your app’s code or a prompt.
On the Supabase Free plan, a single file can be at most 50 MB, and a 10-minute 720p video is about 77 MB. A file over your project’s limit doesn’t reach the bucket: the import still completes, and the result has s3StorageError instead of s3Storage. Use a lower videoQuality, audio only (includeVideo: false), or raise the limit on a paid plan. See Supabase’s file limits.
2. Add your Importly keys as secrets
Create your key on the API key page (it is shown once), and copy the Webhook signing secret (it starts withwhsec_) from the same page. Store both as Edge Function secrets, in the Supabase dashboard under Edge Functions > Secrets, or with the CLI:
SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY are already available inside every Edge Function.
3. The table and the Storage policy
Run this in the SQL editor. Users can read their own rows, and only the functions write them. The second policy lets a signed-in user create signed URLs for files underusers/<their id>/, which is where start-import puts them.
4. Start the import
The frontend calls this function with the user’s session.store: true sends the file to your bucket, storagePath puts it in the user’s folder, and storageFilename gives it a short, predictable name (without it, the file is named after the video’s title, spaces and emoji included).
supabase/functions/start-import/index.ts
error and code, and no row is written. A wrong IMPORTLY_API_KEY secret, for example, gives a 401 with UNAUTHORIZED. See Error handling.
compatibleCodecs gets H.264 video wherever the source has it at that size. TikTok only has H.264 up to 540p, so a 720p TikTok import comes back as HEVC, which some browsers can’t play. Use videoQuality: '480p' if every file has to play everywhere. Each result reports its videoCodec. See Codecs.
5. Mark the row ready from the webhook
Importly sends one signedPOST when the job finishes. Importly can’t send a Supabase JWT, so turn off the JWT check for this function. The signature check is what keeps other callers out.
supabase/config.toml
s3Storage.key. Once the signature checks out, the function saves that key on the row:
supabase/functions/importly-webhook/index.ts
status = 'queued' filter makes a repeated delivery harmless. If the download worked but the copy to your bucket didn’t (a revoked S3 key, say), the payload has s3StorageError instead of s3Storage, and the row records why. See When the copy fails.
Deploy both functions:
6. Show each user their videos
The frontend starts an import withsupabase.functions.invoke, which sends the user’s session for you, and lists the ready rows with signed URLs. RLS returns only the user’s own rows, and the Storage policy lets them sign only their own files.
src/components/VideoLibrary.tsx
videos table (Database > Publications, or alter publication supabase_realtime add table public.videos). Without it, call load() again after a few seconds. The import path is the one Lovable uses; in Bolt or your own setup, import your Supabase client from wherever it lives.
7. Or let the builder write it
Paste this into Lovable or Bolt after step 1, and it builds the same feature:Video library in Supabase Storage
Catch a missed webhook
Each job gets one webhook delivery and no retries, and a function served onlocalhost never receives it. For rows still queued after a few minutes, read the job with GET /import/status and save result.s3Storage.key the same way. The Supabase Edge Functions recipe has a sweep function you can adapt, run every few minutes with Supabase Cron.
Downloads cost $0.002 per MB, with a $0.01 minimum per import: the 24-second TikTok used to test this guide cost $0.01, and a 10-minute 720p video is about $0.15. Copying the file to your bucket costs nothing extra. Try it free, no card required. See Pricing & credits.