Case 10
Backend for Long-Running Applications
API design for partial saves, file uploads, and async verification steps.
Step-by-step walkthrough
Synchronous path — autosave while editing
- ① PATCH /draft every 30s — Client debounced autosave; dominates write QPS vs final submit.
- ② UPSERT JSON — Draft API persists partial answers in Postgres keyed by user + form version.
- ③ PUT via signed URL — Large documents (PDF, scans) upload direct-to-S3; draft stores pointer only.
Async path — submit and verify
- ④ POST /submit — Idempotent final submit; draft status moves to PENDING_VERIFICATION.
- ⑤ Start verification — API calls external KYC/credit vendor; HTTP returns 202 immediately.
- ⑥ Webhook result — Vendor calls back hours later with pass/fail; no long-polling from browser.
- ⑦ status = APPROVED — Draft row updated; user notified via email or in-app poll.
Why these technologies?
draft APIS3webhookPIIfunnel analyticsPostgreSQLautosave QPS