Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt

Use this file to discover all available pages before exploring further.

The Supabase resource exposes a Supabase Storage bucket as a virtual filesystem. It uses the S3-compatible API internally.

Config

import os

from mirage import MountMode, Workspace
from mirage.resource.supabase import SupabaseConfig, SupabaseResource

config = SupabaseConfig(
    bucket=os.environ["SUPABASE_BUCKET"],
    region=os.environ["SUPABASE_REGION"],
    project_ref="oawrffhlppbtbpnehiif",
    access_key_id=os.environ["SUPABASE_ACCESS_KEY_ID"],
    secret_access_key=os.environ["SUPABASE_SECRET_ACCESS_KEY"],
)
resource = SupabaseResource(config=config)
ws = Workspace({"/supabase": resource}, mode=MountMode.READ)
FieldRequiredDefaultDescription
bucketyesSupabase storage bucket name
regionyesSupabase project region
project_refno*Supabase project reference ID
endpoint_urlno*Custom S3-compatible endpoint
access_key_idyesS3 access key from Supabase settings
secret_access_keyyesS3 secret key from Supabase settings
session_tokennoOptional session token
timeoutno30Request timeout in seconds
proxynoHTTP proxy URL
*Either project_ref or endpoint_url is required. If project_ref is provided, the endpoint is auto-built as https://{project_ref}.storage.supabase.co/storage/v1/s3.

Filesystem Layout

/supabase/
  <object-key-path>/
    <file>
Object keys map directly to virtual paths. Example:
/supabase/
  avatars/
    user-001.png
    user-002.png
  documents/
    report.pdf
    data.csv

Cache

Uses IndexCacheStore for directory listings with configurable TTL. File content caching is handled by the workspace.

Example

import asyncio
import os

from dotenv import load_dotenv

from mirage import MountMode, Workspace
from mirage.resource.supabase import SupabaseConfig, SupabaseResource

load_dotenv(".env.development")

config = SupabaseConfig(
    bucket=os.environ["SUPABASE_BUCKET"],
    region=os.environ["SUPABASE_REGION"],
    project_ref="oawrffhlppbtbpnehiif",
    access_key_id=os.environ["SUPABASE_ACCESS_KEY_ID"],
    secret_access_key=os.environ["SUPABASE_SECRET_ACCESS_KEY"],
)
resource = SupabaseResource(config=config)


async def main():
    ws = Workspace({"/supabase": resource}, mode=MountMode.READ)

    r = await ws.execute("ls /supabase/")
    print(await r.stdout_str())

    r = await ws.execute("cat /supabase/documents/data.csv | head -n 10")
    print(await r.stdout_str())

    r = await ws.execute("find /supabase/ -name '*.pdf'")
    print(await r.stdout_str())

    r = await ws.execute("tree -L 2 /supabase/")
    print(await r.stdout_str())


if __name__ == "__main__":
    asyncio.run(main())

Shell Commands

CommandNotes
lsList objects and prefixes
catRead object content
head / tailFirst/last N lines
grepPattern search
wcLine/word/byte counts
statObject metadata (size, modified time)
findRecursive search with -name, -maxdepth