프롬프트 도감 › No.1802
앱 첫 실행 안 느린 구조
Cold Start Safe Architecture
Expo 앱과 Supabase로 AI 생성 작업을 느려지지 않게 처리하는 구조가 나와요. 데이터베이스 설계, 서버 함수, 앱 화면 흐름, 작업 처리 담당 서비스까지 정리해 줘요.
이럴 때 AI 앱 설계, 앱 서버 구조 잡기, 개발 계획 세우기
도구 ChatGPT · Claude · Gemini
프롬프트
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
팁
- 내 앱 기능을 한 줄 덧붙이면 맞춤 설계가 나와요
- 답이 길면 A~E 항목을 하나씩 나눠 요청해요
출처
권리: CC0 (f/prompts.chat). 자유 사용. 기여자: Ted2xmen.