LoopCLI

Supabase Connector

Supabase makes it easy to manage Postgres, storage, and auth from LoopCLI automations.

Required secrets

Vault key Maps to Notes
supabase-service-role SUPABASE_SERVICE_ROLE_KEY Full access for SQL and storage operations. Keep safe.
supabase-url (optional) Project URL Helpful for CLI steps that need the REST endpoint.

CLI commands:

loopcli secret add supabase-service-role --value <service-role-key>
loopcli secret add supabase-url --value https://your-project.supabase.co

Common automations

  • Nightly SQL jobs — run reports and copy results into analytics warehouses.
  • Edge function orchestration — trigger serverless functions after Stripe events.
  • Storage lifecycle — archive and purge stale assets automatically.

Example loop

name: supabase-reporting
description: Export daily MRR and store in analytics schema.
steps:
  - id: query
    name: Run SQL
    type: http
    config:
      url: "{{secret:supabase-url}}/rest/v1/rpc/run_billing_report"
      method: POST
      headers:
        apikey: "{{secret:supabase-service-role}}"
        Authorization: "Bearer {{secret:supabase-service-role}}"
        Content-Type: application/json
      body:
        interval: "day"
  - id: export
    name: Save report to S3
    type: cli
    config:
      command: aws
      args:
        - s3
        - cp
        - -
        - s3://finance-reports/mrr/{{run.started_at}}.json
      env:
        AWS_ACCESS_KEY_ID: "{{secret:aws-access-key}}"
        AWS_SECRET_ACCESS_KEY: "{{secret:aws-secret-key}}"
      stdin: "{{steps.query.response.body}}"
schedule:
  cron: "15 1 * * *"
  timezone: UTC

Supabase CLI hand-off

For migrations managed via supabase db, run commands inside a CLI step:

- id: migrate
  name: Apply migrations
  type: cli
  config:
    command: supabase
    args: ["db", "push", "--project-ref", "{{env:SUPABASE_PROJECT_REF}}"]
    env:
      SUPABASE_ACCESS_TOKEN: "{{secret:supabase-service-role}}"

Templates

Helpful links

Related Documentation

Continue learning with these related topics