Skip to main content
Prompts Expo Supabase AI Generation Architect

developer coding user risk: medium

Expo Supabase AI Generation Architect

Instructs the model to act as a Senior Expo + Supabase Architect and implement a cold-start safe architecture using Expo client, Supabase Postgres, Storage, Realtime, Edge Function…

  • Policy sensitive
  • Human review

PROMPT

Act as a Senior Expo + Supabase Architect.

Implement a “cold-start safe” architecture using:
- Expo (React Native) client
- Supabase Postgres + Storage + Realtime
- Supabase Edge Functions ONLY for lightweight gating + job enqueue
- A separate Worker service for heavy AI generation and storage writes

Deliver:
1) Database schema (SQL migrations) for: jobs, generations, entitlements (credits/is_paid), including indexes and RLS notes
2) Edge Functions:
   - ping (HEAD/GET)
   - enqueue_generation (validate auth, check is_paid/credits, create job, return jobId)
   - get_job_status (light read)
   Keep imports minimal; no heavy SDKs.
3) Expo client flow:
   - non-blocking warm ping on app start
   - Generate button uses optimistic UI + placeholder
   - subscribe to job updates via Realtime or implement polling fallback
   - final generation replaces placeholder in gallery list
4) Worker responsibilities (describe interface and minimal endpoints/logic, do not overbuild):
   - fetch queued jobs
   - run AI generation
   - upload to storage
   - update jobs + insert generations
   - retry policy and idempotency

Constraints:
- Do NOT block app launch on any Edge call
- Do NOT run AI calls inside Edge Functions
- Ensure failed jobs still create a generation record with original input visible
- Keep the solution production-friendly but minimal

Output must be structured as:
A) Architecture summary
B) Migrations (SQL)
C) Edge function file structure + key code blocks
D) Expo integration notes + key code blocks
E) Worker outline + pseudo-code

ROLES & RULES

Role assignments

  • Act as a Senior Expo + Supabase Architect.
  1. Keep imports minimal; no heavy SDKs.
  2. Do NOT block app launch on any Edge call
  3. Do NOT run AI calls inside Edge Functions
  4. Ensure failed jobs still create a generation record with original input visible
  5. Keep the solution production-friendly but minimal

EXPECTED OUTPUT

Format
structured_report
Schema
markdown_sections · Architecture summary, Migrations (SQL), Edge function file structure + key code blocks, Expo integration notes + key code blocks, Worker outline + pseudo-code
Constraints
  • structured as A) Architecture summary
  • B) Migrations (SQL)
  • C) Edge function file structure + key code blocks
  • D) Expo integration notes + key code blocks
  • E) Worker outline + pseudo-code

SUCCESS CRITERIA

  • Deliver database schema (SQL migrations) for jobs, generations, entitlements including indexes and RLS notes
  • Provide Edge Functions: ping, enqueue_generation, get_job_status
  • Describe Expo client flow: non-blocking warm ping, optimistic UI, subscribe to job updates, final generation in gallery
  • Outline Worker responsibilities: fetch queued jobs, run AI generation, upload to storage, update jobs and insert generations, retry policy and idempotency

FAILURE MODES

  • Blocking app launch on Edge calls
  • Running AI calls inside Edge Functions
  • Not creating generation records for failed jobs
  • Overbuilding Worker or using heavy SDKs
  • Ignoring cold-start safety or production constraints

CAVEATS

Missing context
  • Specific AI service or model for Worker generation (e.g., OpenAI, Stability AI)
  • Type of AI generation output (e.g., image, text, video)
  • Pre-existing app structure or gallery component details

QUALITY

OVERALL
0.85
CLARITY
0.95
SPECIFICITY
0.95
REUSABILITY
0.25
COMPLETENESS
0.90

IMPROVEMENT SUGGESTIONS

  • Introduce placeholders for AI service, generation type, and custom schema fields to boost reusability
  • Explicitly define data shapes (e.g., JSON examples for job payload) in constraints
  • Add success criteria like expected latency or error rates for production-friendliness

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR DEVELOPER