Skip to Content
Edge FunctionsOverview

Edge functions

NativeExpress includes four Supabase Edge Functions , each running on Deno in supabase/functions/.

FunctionWhat it doesCustom secrets
chatStreams AI chat responses, persists threads and messagesYes
generateImage generation for the Create tabYes
identifyObject identification for the Scan tabYes
delete-accountRemoves the user’s stored images, then deletes their accountNo

Supabase supplies the database connection settings for all four functions. Set function secrets before using the AI features.

Every function authenticates the caller using their Supabase access token. Shared helpers in _utils/ handle provider access, entitlements, quota and storage.

Files

      • auth.ts - Caller authentication and Supabase clients
      • http.ts - Request validation and error responses
      • ai.config.json - Models, presets and default allowance
      • registry.ts - Shared configuration exports
      • provider.ts - OpenRouter client
      • entitlements.ts - RevenueCat Pro checks
      • quota.ts - Monthly usage checks
      • media.ts - Image uploads and downloads
      • storage.ts - Account image cleanup
      • index.ts - Streaming chat handler
      • deno.json - Function dependencies and compiler settings
      • index.ts - Image generation handler
      • index.ts - Scan handler
      • index.ts - Account deletion handler

Each function has its own deno.json. When adding a function, copy a sibling’s configuration and run yarn check:functions to check its types and the shared tests. This needs Deno  installed. Without Deno, the local script checks the configuration files and skips the type checks and tests.

See the AI request diagram for how the app, functions, provider and database connect.

Last updated on