Estimated Effort: 2 weeks / 6 days
Impacted Subsystems / Files:
app/api/webhooks/nanobanana/route.ts
lib/forge-nanobanana.ts
lib/server-data-paths.ts
Context & Problem Statement:
When image generation takes longer than Vercel serverless execution limits (10s/60s), the current implementation in lib/forge-nanobanana.ts times out, causing the client to lose payment confirmation context even though the AI engine eventually completes.
Technical Requirements & Scope:
- Refactor
app/api/webhooks/nanobanana/route.ts to receive async generation callbacks.
- Implement persistent job state tracking stored in
.data/generation-jobs.json.
- Build client polling endpoint allowing frontend to query job status by transaction hash.
- Implement dead-letter queue mechanism to record failed webhook callbacks for retry.
Multi-File Change Surface:
Modifies webhook endpoint app/api/webhooks/nanobanana/route.ts, lib/forge-nanobanana.ts, and frontend polling hooks in app/forge/page.tsx.
Acceptance Criteria:
Suggested Approach / Investigation Steps:
- Define async job state schema and webhook signature validator.
- Implement store operations in
lib/generation-job-store.ts.
- Connect client UI to poll generation job status until completed.
Estimated Effort: 2 weeks / 6 days
Impacted Subsystems / Files:
app/api/webhooks/nanobanana/route.tslib/forge-nanobanana.tslib/server-data-paths.tsContext & Problem Statement:
When image generation takes longer than Vercel serverless execution limits (10s/60s), the current implementation in
lib/forge-nanobanana.tstimes out, causing the client to lose payment confirmation context even though the AI engine eventually completes.Technical Requirements & Scope:
app/api/webhooks/nanobanana/route.tsto receive async generation callbacks..data/generation-jobs.json.Multi-File Change Surface:
Modifies webhook endpoint
app/api/webhooks/nanobanana/route.ts,lib/forge-nanobanana.ts, and frontend polling hooks inapp/forge/page.tsx.Acceptance Criteria:
NANOBANANA_WEBHOOK_SECRET.Suggested Approach / Investigation Steps:
lib/generation-job-store.ts.