Streaming SSR and Selective Hydration Overhaul Plan
Design a migration plan to implement streaming server-side rendering and selective hydration to eliminate CPU bottlenecks.
Use this template when redesigning the rendering pipeline of a content-rich web application to solve severe hydration mismatches, server response lag, and client-side CPU thrashing during initial page load.
Role: Lead Web Infrastructure Engineer specializing in modern isomorphic rendering pipelines and edge runtime execution.
Context
- Current Isomorphic Framework: {{current_ssr_framework}}
- Edge/Server Runtime Environment: {{edge_runtime_provider}}
- Critical Backend Data Fetching Bottlenecks: {{data_fetching_bottlenecks}}
- Production Client Bundle Baseline: {{client_bundle_size_kb}}
- Global State Management Layer: {{state_management_library}}
- Content Invalidation Strategy: {{cache_invalidation_strategy}}
Task
Develop an actionable implementation plan to transition {{current_ssr_framework}} on {{edge_runtime_provider}} to an asynchronous streaming SSR architecture with selective hydration, mitigating {{data_fetching_bottlenecks}} while handling {{state_management_library}} reliably.
Method
- Map page layouts into critical above-the-fold shells versus deferred asynchronous boundary blocks.
- Configure HTML streaming boundaries using Suspense primitives suited for {{edge_runtime_provider}}.
- Design state serialization and progressive dehydration pipelines to prevent hydration mismatch crashes in {{state_management_library}}.
- Establish client-side island or partial hydration triggers (e.g.,
client:visible,client:idle, or user interaction listeners). - Restructure data loaders to stream chunked payload responses, decoupling slow upstream services in {{data_fetching_bottlenecks}} from the initial byte stream.
- Align CDN caching policies and stale-while-revalidate headers in accordance with {{cache_invalidation_strategy}}.
- Formulate a bundle optimization plan to reduce {{client_bundle_size_kb}} via fine-grained code splitting across isolated boundaries.
- Define automated load testing and regression verification protocols simulating throttled mobile CPUs and slow networks.
Constraints
- MUST eliminate full-page blocking queries prior to emitting initial HTTP headers.
- MUST NOT allow client-side hydration to overwrite asynchronous server-streamed markup with empty flash states.
- Streaming fallbacks MUST display accessible skeletal UI states conforming to web accessibility standards.
- Memory footprint on {{edge_runtime_provider}} worker instances MUST remain under predefined platform execution limits.
Output format
- Streaming Render Architecture Diagram Description (Max 250 words)
- Component Boundary & Hydration Strategy Table (Component, Boundary Type, Hydration Trigger, Fallback)
- Data Fetching & State Pipeline Specifications (Max 300 words with pseudo-code / contract schema)
- Operational Rollout & Fallback Matrix (Phased milestones from canary to 100% traffic)
Self-review
- Ensure the distinction between streaming SSR chunks and client-side interactive islands is explicit.
- Verify that edge execution memory constraints are respected in data-streaming steps.
- Confirm that state hydration mismatch handling covers all dynamic data boundaries.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.