Skip to main content

Data Models

Tables

Triggers & helper

  • handle_updated_at trigger keeps updated_at current on products, prices, subscriptions, profiles.
  • RPC increment_download_count updates license counts.

Buckets

  • download — Product ZIP served via signed URLs in /api/download.
  • avatars — User-uploaded profile images (public URLs generated in profile actions).

Access patterns

  • RLS enforced for end users; webhook/admin paths use SUPABASE_SECRET_KEY.
  • lib/access.ts first checks one_time_purchases, then user_subscriptions with status in ('active','trialing','past_due'), plus lifetime flag and period end.
  • Feature gating uses plan config featureAccess (e.g., basic, templates, api, custom_domain, advanced).