Skip to content
Blogs

Designing Resilient Full-Stack Systems

· 21 min read

Reliability is end-to-end: device, network, edge, API, queue, and third-party dependencies all shape what users experience. Staff engineers define journey SLOs first, encode timeouts and idempotency in contracts, degrade optional capabilities without hiding stale state, trace decisions with correlation ids, and rehearse recovery while the system is calm—not after the first payment double-charge.

Reliability is end-to-end

A healthy database does not guarantee a reliable product. Users experience a chain that includes device storage, radio quality, CDN and edge behavior, application code, background jobs, payment processors, and human on-call response. Resilience comes from mapping that chain for each critical journey—not from sprinkling retries on every fetch call.

Begin with journeys that move revenue or trust: sign-up, checkout, upload, invite, or the core AI feature your MVP sells. For each step, ask what must succeed synchronously, what can complete asynchronously, what can be retried safely, and what must never happen twice. That framing produces better architecture than copying generic multi-AZ diagrams onto a four-week Supabase plus Expo stack.

Mobile clients remain in the wild after backend deploys. Cloudflare Workers and edge routes may cache responses differently from your Node assumptions. Treat every layer as a participant in the same SLO conversation, with explicit ownership when a dependency degrades.

Run a premortem on each journey: list the top three dependencies that could fail independently, the user-visible symptom for each, and the feature flag or config toggle that limits blast radius. Capture that table in the repo next to the runbook so new engineers inherit resilience context instead of rediscovering it during the first payment incident.

Define journey SLOs before patterns

Infrastructure availability metrics rarely match user-perceived failure. A service can meet four-nines uptime while checkout fails because a third-party fraud check times out without a clear client message. Journey SLOs tie reliability to outcomes: payment authorized, file uploaded and virus-scanned, message delivered, or AI response streamed to completion.

Pick one primary indicator per journey—success rate, freshness, or tail latency—and an error budget that product and engineering share. When the budget burns on optional features, pause enhancements to the core path instead of adding more parallel dependencies.

| Journey | Example SLI | Client-visible failure | | --- | --- | --- | | Checkout | Payment authorized / started | Spinner forever, duplicate charge fear | | Media upload | Asset reachable within N minutes | Blank preview, lost work | | Realtime feed | Update latency p95 | Stale thread, silent disconnect | | LLM feature | Stream completes or fails clearly | Truncated answer, no retry hint |

Document minimum viable degradation for each row: what still works when the optional path fails, and what copy the UI must show. Support and sales should recognize the same language as your status page.

Contracts prevent cascading ambiguity

Typed APIs help, but a resilient contract also defines timeouts, error categories, idempotency, pagination, version compatibility, and authorization behavior. Clients must distinguish validation errors from temporary dependency failures and permission denials without guessing from HTTP status alone.

Bound every outbound call with a timeout shorter than the user-facing wait budget. Propagate deadline context where your stack supports it so deep services do not start work the gateway already abandoned. Machine-readable error codes stabilize client logic; human messages can change for support without breaking parsers.

For Expo and React Native apps, document which errors trigger retry with backoff, which require user action, and which mean "show cached data with freshness label." Without that matrix, mobile engineers reimplement inconsistent retry storms that amplify outages.

Stable contracts extend to webhooks and queue consumers: payload schema, signing, replay windows, and dead-letter semantics belong in the same review as REST routes.

Idempotency and safe retries

A request timeout does not tell the client whether the server completed the operation. Idempotency keys are essential for payments, orders, messages, inventory holds, and any mutation a client may retry after backgrounding or flaky radio.

Store the terminal result keyed by tenant plus caller plus operation intent. Replays return the same outcome with the same HTTP semantics instead of creating duplicate side effects. TTL must cover worst-case client retry and offline outbox replay windows.

```typescript async function acceptOrder(req: Request, env: Env) { const key = req.headers.get("Idempotency-Key"); if (!key) return problem(400, "missing_idempotency_key"); const tenant = requireTenant(req); const prior = await env.ORDERS.get(idempotencyKey(tenant, key)); if (prior) return Response.json(JSON.parse(prior.body), { status: prior.status }); const result = await fulfillOrder(req, tenant); await env.ORDERS.put(idempotencyKey(tenant, key), JSON.stringify(result), { expirationTtl: 60 * 60 * 24, }); return Response.json(result.body, { status: result.status }); } ```

Pair idempotency with queryable operation state for long work: clients poll or subscribe instead of blind retry loops. Support staff need a single id to trace from user report to ledger entry.

Degrade by capability, not by page

Graceful degradation should preserve the useful core of the product. If recommendations fail, search may still work. If realtime updates disconnect, a timestamped snapshot may remain readable. If media processing delays, accept the upload and complete processing asynchronously with visible progress.

Feature boundaries make this possible. When one dependency is embedded across every route and render path, its outage becomes universal. Isolate optional capabilities behind narrow interfaces, cache only results that are safe to serve with explicit freshness, and never present stale cache as live data without labeling.

Staff teams map capabilities to dependency tiers: tier zero blocks the journey, tier one reduces quality, tier two is invisible when off. Incident response toggles tier-one features off before restarting databases that tier-zero needs.

For AI features, separate model availability from core CRUD: users should still manage account and billing when inference is down, with honest messaging instead of blank screens.

Isolation, bulkheads, and backpressure

Shared thread pools, unbounded queues, and global connection limits convert local slowness into global outages. Apply bulkheads per dependency: dedicated worker pools, concurrency caps on calls to fragile APIs, and shed load at the edge before Postgres connection storms begin.

Backpressure belongs in both directions. Slow consumers should not accumulate unbounded in-memory buffers; producers should drop or sample optional telemetry before dropping checkout events. Cloudflare Workers enforce CPU limits—design hot paths to fail fast and return actionable errors rather than retry internally until subrequest limits trip.

Circuit breakers need half-open probes with metrics, not permanent open states forgotten after incidents. Document who resets breakers and under what evidence dependency health returned.

Supabase Postgres remains the bottleneck for many MVPs: protect it with caching discipline, read replicas only when measured need exists, and avoid N+1 patterns that explode under mobile launch spikes.

Observe decisions, not only machines

CPU graphs reveal pressure; journey telemetry reveals broken outcomes. Trace a user operation with correlation identifiers across the client, API gateway, queue, worker, and third-party callback. Record meaningful transitions—order accepted, payment authorized, asset processed, notification delivered—not only generic HTTP 200 counts.

Structure logs for questions operators actually ask: which tenant, which app version, which feature flag, which dependency timed out. Redact at collection time; retention policies should match privacy commitments before sensitive fields land in cold storage.

Alerts tie to journey SLO burn or error-budget policy, not static thresholds on queue depth alone. An alert that fires weekly and changes no decision is noise that trains teams to ignore real fires.

Frontend real-user monitoring closes the gap when API metrics look green but mobile crash reports spike on a specific OS version. Link release version tags on every signal so regressions map to deploys without archaeology.

Expo, Supabase, and Workers in one chain

Typical MVP stacks combine Expo clients, Supabase Auth and Postgres, and Cloudflare Workers for APIs or webhooks. Resilience requires explicit handoffs: JWT validation on Workers must match RLS assumptions in Postgres; offline outbox replay must reuse idempotency keys; edge caches must not serve authenticated responses from shared keys.

Auth refresh failures should degrade to read-only or signed-out UX with clear recovery—not infinite spinners. Storage uploads should survive app kill with resumable or retryable chunks and server-side verification before marking assets public.

Workers calling Supabase with service role bypass RLS—every such path needs equivalent authorization checks and audit logging. Treat service role secrets like production root passwords: narrow scopes, rotate, never embed in mobile binaries.

Test the chain on representative devices and network profiles, not only simulators on office Wi-Fi. Tail latency on 4G exposes timeout mistakes that localhost hides.

Practice recovery while calm

Backups are intentions until restoration is tested. Queues are durable until poison messages block progress. Runbooks fail when they assume credentials or access responders lack during incidents. Schedule recovery drills: restore Postgres to a scratch project, replay webhooks from dead letters, fail over read traffic behind a flag, and measure time-to-first-successful checkout in staging.

Game days should include communication: who updates status, who talks to support, who can freeze deploys. Partial failures—degraded AI, delayed thumbnails—need playbooks distinct from full region outages.

Post-incident work improves the system that shaped response: add missing correlation, remove noisy alerts, automate one safe rollback step, or fix a contract that forced clients to retry dangerously. Resilience is the ability to make failure unsurprising and bounded, not the fantasy of zero incidents.

Document RTO and RPO per journey in plain language leadership understands. Engineers implement; product accepts tradeoffs when budgets cannot fund dual-region yet.

Rotate drill facilitators so the person who wrote the runbook is not the only one who has executed it. Measure time-to-first-successful transaction after simulated failure, not slides produced. Feed drill gaps into the next sprint as concrete tickets: missing dashboard, broken flag, unclear on-call handoff.

Operational checklist for resilient systems

Before shipping a new journey to production, verify:

| Check | Pass criteria | | --- | --- | | Journey SLO | SLI defined, dashboard linked, error budget owner named | | Contract | Timeouts, error codes, idempotency on mutations documented | | Degradation | Tier-one features can disable without blank core UX | | Tracing | Correlation id flows client → worker → database → webhook | | Recovery | Restore or replay tested in last 90 days with recorded duration | | Mobile | Minimum app version and offline replay behavior documented |

Link resilience work to delivery: MVPs shipped in weeks still need these basics on money paths—not a later "hardening sprint" that never arrives.

When you want hands-on help designing resilient Expo plus Supabase products, see [/hire](/hire) and [/projects/strumai](/projects/strumai) for patterns used on client launches.

Frequently asked questions

How are journey SLOs different from service uptime?
Uptime measures whether a component responds to probes; journey SLOs measure whether users complete a business outcome such as payment authorized or file delivered. A healthy API can still fail journeys when mobile clients timeout, fraud checks stall, or error copy blocks safe retry. Define SLIs on those outcomes, share an error budget with product, and alert on budget burn tied to user impact rather than only green ping dashboards.
How should mobile apps generate idempotency keys?
Generate a stable UUID or hash per user intent at button tap, persist it in local storage until the server returns a terminal success or failure, and reuse the same key when the offline outbox replays after connectivity returns. Scope keys to tenant plus operation type so unrelated actions never collide. Publish TTL and format in public API docs so client teams know when a genuinely new attempt requires a fresh key.
When is cached degradation acceptable?
Cached degradation is acceptable only when the interface labels freshness explicitly and the cached payload cannot mislead users about security, billing, or permissions. Never show stale account balances, role changes, or AI safety settings as current. Prefer turning off optional modules with honest copy over silently serving outdated personalized feeds that look live.
How often should teams run recovery drills?
Run timed recovery drills at least quarterly for revenue-critical journeys, and monthly while architecture or dependencies change quickly. Each drill should record restore duration, first successful checkout or upload, and gaps in runbooks or access. Convert those gaps into sprint work before adding new third-party dependencies that expand the same failure surface.

Sources

Related service

APIs, data stores, auth, observability, and cloud infrastructure that hold up under real traffic.

View hire details


Published on August 7, 2025 by Berktug Berke Ates.