@@ -144,3 +144,38 @@ To enable locally:
144144NEXT_PUBLIC_ANALYTICS_ENABLED=true
145145NEXT_PUBLIC_ANALYTICS_DOMAIN=your-domain.com
146146```
147+
148+ ## Architecture notes
149+
150+ ### Route error boundaries (` error.tsx ` )
151+
152+ Next.js ** App Router** isolates render failures per route ** segment** using a
153+ client ` error.tsx ` next to ` page.tsx ` / ` layout.tsx ` . When a segment throws
154+ during render (or in a child Server/Client component during that render pass),
155+ only that subtree is replaced by the error UI; the root layout (navigation,
156+ wallet provider, etc.) keeps running.
157+
158+ ** Current segment boundaries**
159+
160+ | Segment | Path | Role |
161+ | -------------| -------------------| ------|
162+ | Claims | ` app/claims/ ` | Claims board list and nested routes |
163+ | Policies | ` app/policies/ ` | Policy dashboard (` PolicyDashboard ` ); ` /dashboard ` redirects here |
164+ | Admin | ` app/admin/ ` | Admin placeholder segment |
165+ | Policy flow | ` app/policy/ ` | Quote/bind policy wizard |
166+ | Quote | ` app/quote/ ` | Quote flow |
167+ | Support | ` app/support/ ` | Support |
168+
169+ Shared UI: ` RouteError ` (` src/components/route-error.tsx ` ) — user-safe message,
170+ support reference when present, ** Try again** (` reset() ` ), ** Go to dashboard**
171+ link. Development-only collapsible stack trace.
172+
173+ ** Observability:** ` logRouteSegmentError ` (` src/lib/observability.ts ` ) records
174+ anonymized metadata in production via Plausible (` route_segment_error ` : segment,
175+ error name, optional digest). ** No** ` error.message ` or stack is sent to
176+ analytics or shown to users in production.
177+
178+ ** Out of scope for these boundaries:** Wallet signing and other ** event
179+ handler** errors are not caught by ` error.tsx ` ; components must handle those
180+ inline (try/catch / toast) so users get immediate feedback without replacing the
181+ whole segment.
0 commit comments