Skip to content

Rock-solid FE+BE — design

Date: 2026-04-21 Trigger: user-surfaced screenshots (cloud Unmatched Route, local Loading stuck, many COEP/CORS errors, font 404s, demo tonight). Status: brainstorm — awaiting user approval before any implementation. Supersedes: nothing — layers on top of existing plans + SOTA research below.

Prior work to consult (not to duplicate):


1. Executive summary — user premise accepted

Section titled “1. Executive summary — user premise accepted”

User’s premise (2026-04-21): “if it works local, apart from env or infra issues, it should work also on cloud.”CORRECT. Every demo-blocker traces to one of three buckets:

  1. Latent app bugs visible on local once you actually walk the flow (e.g. /(consumer)/home post-auth crash)
  2. Env/infra drift (Metro cache staleness, missing Dockerfile ARG, Sentry DSN swap, HTTP vs HTTPS, stale Cloudflare tunnel URL)
  3. Low test signal (354 mocked-tautology unit tests, 116 Playwright specs that never run, dead tour.spec.ts config, web-build smoke missing)

The strategy is therefore: harden local to zero-defect, then cloud = deploy exercise, not debug exercise.


2. Root-cause table (from 5-agent investigation)

Section titled “2. Root-cause table (from 5-agent investigation)”
#BugEvidenceScope
B1router.replace("/(consumer)/home" as never) after email-OTP + OAuth successlib/auth/use-continue-flow.ts:74,97/(consumer)/home doesn’t exist; every fresh-auth user hits Unmatched Route. as never cast suppressed typed-routes guard.app — latent bug, reaches users
B2build:web script missing --clear → Metro cache leaks stale EXPO_PUBLIC_* values across rebuildsMemory feedback_metro_cache_env.md documented; agent probe confirmed localhost:3000 baked into http://178.104.154.74 bundle. Fixed already; commit pending.build
B3apps/mobile/Dockerfile missing ARG EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN + Dokploy buildArgs missing sameAny map screen 401s against Mapbox on cloud → blank mapsinfra — demo cosmetic blocker
B4Dokploy web buildArgs ship BE Sentry DSN (…618666576) as EXPO_PUBLIC_SENTRY_DSN (should be …624302672)Agent grep of env vs Dokployinfra — observability wrong
B5.dockerignore whitelists !.env.example → risks re-leaking localhost:3000 even with --clear.dockerignore:12-13; apps/mobile/.env.example:2build — latent re-breakage risk
B6apps/mobile/playwright.config.ts points at missing scripts/tour.spec.tsFile deleted during UX overhaul, config not updatedtests — dead config
B7132 Playwright E2E specs never run (ECONNREFUSED :3001; no webServer in config; verify-local.sh excludes @ideony/e2e)Agent pnpm test outputtests — 100% of E2E investment invisible
B8No web-build smoke gate → import.meta crash class shipsToday’s commit a6890f0 landed after prod white-screentests
B9@ideony/mobile Jest “worker failed to exit gracefully” warningLeaked timer in reanimated or socket.io mocktests — future flake
B10No coverage measurement; no incidents-per-deploy trackingapps/api has test:cov orphan, apps/mobile has no configtests
B11Sentry Session Replay + Performance not enabled@sentry/react-native + @sentry/nestjs installed, flags offobservability
B12No OpenAPI contract drift gateBE ships schema change → FE fails silently until runtimetests
B13No visual regressionUI drift lands undetectedtests

Phase 0 — Demo tonight (P0 blockers, ~90 min)

Section titled “Phase 0 — Demo tonight (P0 blockers, ~90 min)”

Fix what the cofounders WILL see on 2026-04-21 evening. Nothing speculative.

StepChangeFilesEst
P0.1Fix B1 — change router.replace("/(consumer)/home" as never)router.replace("/(consumer)") at both call siteslib/auth/use-continue-flow.ts:74,975 min
P0.2Commit B2 fixbuild:webexpo export --platform web --clear (already on disk; needs commit + CHANGELOG + status.md)apps/mobile/package.json, CHANGELOG.md, docs/status.md5 min
P0.3Fix B3 — add ARG EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN + ENV line to apps/mobile/Dockerfile; add buildArg on Dokploy web app via MCPapps/mobile/Dockerfile, Dokploy15 min
P0.4Fix B4 — swap Dokploy web EXPO_PUBLIC_SENTRY_DSN to FE project DSNDokploy MCP5 min
P0.5Fix B5 — remove !.env.example whitelist in .dockerignore (belt-and-suspenders after B2).dockerignore2 min
P0.6Redeploy FE + verify./scripts/deploy.sh --fe-only → probe bundle for localhost, Mapbox render, Sentry DSN, Clerk signup success → land on /(consumer) not Unmatchedshell15 min
P0.7Walk consumer flow manually via Playwright headed against LOCAL first: welcome → signup → home → triage → results → pro-detail → book → chat → review → SOS. Capture any new breakage.ad-hoc30 min
P0.8Fix anything P0.7 surfaces. Stop at first pass.buffer

Exit criteria Phase 0:

  • Cloud FE → prod BE (no localhost leak)
  • Signup/signin lands on /(consumer), not Unmatched Route
  • Mapbox tiles render
  • Sentry receives FE events in correct project
  • One complete consumer flow green on local AND cloud

Phase 1 — This week (after demo, before next sprint)

Section titled “Phase 1 — This week (after demo, before next sprint)”

Eliminate the class of bugs Phase 0 fixed.

StepChangeWhy
P1.1Delete apps/mobile/playwright.config.ts (dead) OR repoint at ../../e2e/web/smoke.spec.tsB6 — single source of Playwright config in e2e/web/
P1.2Wire web-build smoke into verify-local.sh: expo export --platform web --clearnpx serve dist -p 8081playwright test smoke.spec.ts --project=chromium → fail on any page.on('pageerror'). ~45 sec gate.B8 — catches import.meta class permanently
P1.3Start API in Playwright webServer so @ideony/e2e can actually run. Add docker:up precondition. Drop --filter='!@ideony/e2e' from verify-local.sh. Run subset (smoke + scenario-0[1-3]) in gate; full suite nightly.B7 — unlocks 132 specs
P1.4Delete 3 low-signal tests (per test-audit agent): test/app/(consumer)/_layout.test.tsx, test/lib/hooks/use-theme-colors.test.ts, test/components/chrome/{TabBar,SkeletonLoader,EmptyState}.test.tsx presentational-smoke bundle. ~15 specs removed.B10 — mocked tautologies
P1.5Add 3 HIGH-value tests: (a) real Stripe Connect onboarding E2E (BAPI user + webhook), (b) SOS dispatch multi-actor (uses existing scenario-02 stub), (c) Clerk svix webhook with real signature.Critical paths currently 0%
P1.6Enable Sentry Session Replay + Performance on @sentry/react-native (FE) + @sentry/nestjs (BE). Set replaysOnErrorSampleRate: 1.0, tracesSampleRate: 0.2.B11 — free RUM from installed dep
P1.7Add openapi-diff CI step (when CI restored): after BE build, diff packages/api-client/src/generated/openapi.json vs main. Fail on breaking change. ~1 hr to wire.B12 — cheap SOTA win
P1.8Fix B9 — instrument Jest teardown, find the leaked timer (likely in reanimated or socket.io mock).B9

Phase 2 — Post-MVP-0 (observability + SOTA uplift)

Section titled “Phase 2 — Post-MVP-0 (observability + SOTA uplift)”
StepChangeCost
P2.1Maestro for native iOS+Android — Expo itself migrating Detox→Maestro. Start with 3 flows (auth, booking, SOS). YAML, <1% flakiness (vs Detox 2%).~3 days
P2.2Visual regression — Playwright toHaveScreenshot() on 7 hero screens. Baseline commit per release tag. Free, already installed.~1 day
P2.3Synthetic monitoring — Checkly w/ existing Playwright scripts. 3 critical journeys every 5 min from EU. Free tier fits MVP 0.~½ day
P2.4Flaky quarantine@flaky Playwright tag + separate non-blocking job; cap 5 entries; weekly auto-retire passing-3x-consecutive.~½ day
P2.5Switch metric — coverage % → incidents/deploy + MTTR on SOS + payment modules (per SOTA — Airbnb/Uber/Faire all track outcomes, not %)
P2.6Migrate to named Cloudflare tunnel api.ideony.is-a.dev + app.ideony.is-a.dev (per infra.md blocker: is-a.dev/register#36614) → HTTPS stable → no more tunnel-URL rotation rebuilds → Clerk/Stripe/Mapbox secure context warnings goneblocked on PR
P2.7Resume Phase E multi-role E2E per existing spec. Blueprint already locked.12.5 days est

  • Rewriting test suite from scratch — 195 API unit tests mostly HIGH value; don’t throw the baby out. Only touch the 3 low-value clusters listed.
  • Chromatic/Percy visual regression SaaS — Playwright built-in covers MVP 0 free; revisit if Storybook gets heavy.
  • Contract tests via Pact bidirectionalopenapi-diff is 80% of the value at 20% of the cost; revisit Pact post-PMF.
  • Bolt/Glovo-style city simulator — pre-revenue, no historical data to seed with. Phase F+.
  • Multi-tenancy in prod (DoorDash pattern) — overkill for MVP 0; test_tenant column per Phase E spec is already the right scope.
  • Switching off Playwright in favour of Cypress — no benefit; cost is real.

#RiskLikelihoodImpactMitigation
R1B1 fix breaks existing E2E that happened to land on Unmatched Route and still asserted some elementLMgrep E2E for /(consumer)/home; update specs same commit
R2Removing !.env.example whitelist breaks a dev who clones fresh and needs the example for referenceLLKeep .env.example in repo (it’s in git); only removed from docker build context
R3Adding Playwright webServer slows verify-local.sh from 30s → 90sMLRun smoke only locally (3 specs); full suite nightly
R4Sentry Session Replay at 100% on-error overwhelms free tierLMStart at 0.2; tune after first week
R5openapi-diff false positives from hey-api version bumpsMLPin hey-api version; allowlist schema version bumps

  • Phase 0: 1 full consumer flow green on local AND cloud by 2026-04-21 18:00
  • Phase 1: verify-local.sh runs web-build smoke + E2E smoke; ≤90 sec total; blocks commit on pageerror
  • Phase 2: Sentry shows FE session replays on error; Checkly pages on critical path regression within 5 min

  • Q1 — Proceed with Phase 0 now (all 8 steps before demo)? Or only P0.1–P0.4 (app + infra essentials, skip test-suite cleanup)?
  • Q2 — Phase 1 post-demo: scope as above (~1 day of work) or trim? Specifically: does P1.3 (unblock 132 Playwright specs) feel worth 2-3 hrs today?
  • Q3 — Phase 2 Maestro + Checkly + visual regression — approve as post-MVP-0 sprint target, or defer?
  • Q4 — Do I write this spec to docs/specs/2026-04-21-rock-solid-fe-be-design.md (current location, matches repo convention) or move to docs/superpowers/specs/ (superpowers default)?

Awaiting confirmation — no implementation until user says “proceed” (or proceed P0 only / modify: …).