CYDERCODER // PLAYBOOK
SYS.STATUS: OK 00%
> INITIALIZING...
Install this playbook for offline access
You're offline — reading cached content
WHO THIS IS FOR

Built for every stage of the builder journey

Beginners

Clear path from zero to deployed product in one afternoon. Exact AI prompts to copy. Explains the why, not just the how — all the way to production with a custom domain.

  • Build your first website end-to-end
  • Deploy with Vercel, set up Google Search Console
  • Understand what React is doing behind the scenes

Senior Devs

A reference manual for AI architecture decisions. RAG chunking, MCP, multi-agent systems, CDN caching, deployment strategies — without the fluff.

  • RAG chunking strategies, MCP protocol architecture
  • Typography scale, color theory, motion design systems
  • CDN caching, edge functions, deployment strategies
Portrait Lock Active
Please rotate your device back to Portrait orientation to read the playbook content.
Back to Dashboard

Framework Thinking: Decoupling the Rendering Matrix

01. The JavaScript Tax

Amateur developers treat modern frontend frameworks like default skin presets — they spin up a heavy Single Page Application (SPA) with full client-side hydration for a simple static landing page or portfolio.

When you do this, you pass a massive JavaScript Tax down to the user. The browser has to download megabytes of JS, parse it, compile it, and execute it before the user can even read a sentence. This destroys your Core Web Vitals and plummets your SEO ranking.

The Structural Rule: Do not ship JavaScript to the browser unless it is absolutely required for dynamic user interactivity. Treat JS as a premium enhancement, not your baseline infrastructure.

The Real Cost of JavaScript

Every kilobyte of JavaScript has a compounding cost:

Bundle SizeParse + Compile TimeImpact
50 KB~100msNegligible — good budget for interactive components
100 KB~200msAcceptable — typical for a well-optimized SPA
250 KB~500msNoticeable — mobile users feel the delay
500 KB~1s+Critical — Lighthouse score drops, bounce rate spikes
1 MB+~2s+Unusable — most mobile users leave before content appears

The hidden multiplier: JavaScript isn’t just downloaded — it’s parsed, compiled, AND executed. A 200KB JS bundle can take 400ms+ to become interactive on a mid-range Android phone. Meanwhile, a pure HTML page renders in under 50ms.

The JS Budget Framework

Before choosing any framework, set a JavaScript budget:

MetricTargetWhat It Means
Total JS< 200 KB (gzipped)Total JavaScript sent to browser
First Contentful< 1.0sWhen first text/image appears
Largest Paint< 2.5sWhen main content is visible
Time to Interactive< 3.0sWhen user can click buttons
Cumulative Layout Shift< 0.1Elements don’t jump around

If your framework choice can’t meet this budget for your use case, you’ve chosen the wrong framework — not the wrong optimization.


02. The Modern Rendering Spectrum

Before choosing a tool, you must explicitly select your rendering pattern based on two questions:

  1. How fresh does the content need to be? (Never changes → Changes hourly → Real-time)
  2. How fast must it load? (Instant → Fast → Acceptable)
FRESHNESS →
<div class="flow">
  <div class="flow-step">
    <div class="flow-box">
      <span class="flow-num">SSG</span>
      <span class="flow-label">Static Site Generation</span>
      <span class="flow-sub">Build once, serve forever</span>
    </div>
  </div>
  <div class="flow-step">
    <div class="flow-arrow"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg></div>
  </div>
  <div class="flow-step">
    <div class="flow-box">
      <span class="flow-num">ISR / PPR</span>
      <span class="flow-label">Incremental / Partial</span>
      <span class="flow-sub">Static shell + fresh data</span>
    </div>
  </div>
  <div class="flow-step">
    <div class="flow-arrow"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg></div>
  </div>
  <div class="flow-step">
    <div class="flow-box">
      <span class="flow-num">SSR</span>
      <span class="flow-label">Server-Side Rendering</span>
      <span class="flow-sub">Fresh render per request</span>
    </div>
  </div>
</div>

| Pattern | Freshness | JS Runtime | Best For |
|---------|-----------|------------|----------|
| **SSG** | Never changes | Zero | Docs, portfolios, blogs |
| **ISR / PPR** | Changes hourly | Minimal | E-commerce, product pages |
| **SSR** | Real-time | Full | Dashboards, user-specific |
  ~50ms TTFB           ~100ms TTFB            ~300ms+ TTFB

SSG (Static Site Generation)

The Mechanics: The server compiles the entire website into raw HTML, CSS, and asset files once at build time. When a user requests a page, the CDN serves the pre-baked file instantly.

Best For: Documentation sites, portfolios, corporate landing pages, blogs, marketing pages.

Tell your AI tool: “Create a static landing page with a hero section and layout. The page should be pure HTML with zero JavaScript shipped. Use Astro’s static output mode.”

The limitation: Content is frozen at build time. If your data changes (new blog post, updated price), you must rebuild and redeploy the entire site.

ISR (Incremental Static Regeneration)

The Mechanics: Like SSG, but with a TTL (time-to-live). The page is served from cache, and when the TTL expires, the next request triggers a background revalidation. The user gets the cached version instantly; the fresh version is built and cached for the next user.

Tell your AI tool: “Create a pricing page with ISR. Set revalidation to 3600 seconds (1 hour). The page should fetch fresh prices on each revalidation but serve cached content between refreshes.”

Best For: E-commerce product pages, news articles, any content that changes periodically but doesn’t need real-time freshness.

SSR (Server-Side Rendering)

The Mechanics: The server waits for a user request, queries the database live, renders the HTML on the fly, and sends the completed page. Every request gets fresh content.

Best For: User-specific dashboards, banking portals, real-time feeds, authenticated areas.

// Next.js — SSR (no caching, fresh on every request)
export const dynamic = 'force-dynamic';

export default async function DashboardPage() {
  const user = await getUser();           // Fresh auth check
  const stats = await getLiveStats();     // Real-time data
  return <Dashboard user={user} stats={stats} />;
}

The cost: Higher server load, slower TTFB (Time to First Byte). Every request hits your server and database.

PPR (Partial Prerendering)

The Modern Apex: PPR breaks the binary trade-off between SSG and SSR. At build time, it generates a static HTML shell for parts of the page that never change (navbar, layout, footer) but leaves dynamic holes wrapped in React Suspense boundaries.

PPR Page Structure:

  • STATIC (instant): Nav, Hero, Footer — served from CDN in ~20ms
  • DYNAMIC (streams): User data, Dashboard metrics — loaded as data arrives
  • SKELETON (placeholder): Shown while dynamic content loads

The Execution: The instant a user clicks your link, the edge server ships the static shell immediately (~20ms TTFB). While the user reads the hero, the server streams the dynamic components down the same HTTP request. No extra round trips.

CSR (Client-Side Rendering) — The Legacy Pattern

The Mechanics: The server sends an empty HTML shell with a <div id="root"></div> and a script tag. The browser downloads the JavaScript, which then fetches data and renders everything client-side.

Why it still exists: SPAs built with Create React App, Vue CLI, or Angular CLI use this pattern by default. It was the standard from 2015-2020.

Why you should avoid it for new projects: The user sees a blank screen until the JS loads and executes. No SEO (crawlers see empty HTML). Worst Core Web Vitals of any pattern.

CSR Loading Timeline:

  • 0ms: Browser receives empty HTML shell
  • 200ms: JS bundle starts downloading
  • 500ms: JS bundle finishes downloading
  • 700ms: JS starts executing
  • 1000ms: API call fires to fetch data
  • 1500ms: Data returns, React renders DOM
  • 1600ms: User finally sees content
  • Total: ~1.6 seconds of blank screen

03. The Decision Framework

Stop asking “React or Next.js?” — that’s the wrong question. The right question is: “What rendering pattern does my content require?”

The Decision Table

What You’re BuildingRendering PatternFrameworkWhy
Marketing / Landing / PortfolioSSGAstroZero JS, instant load, perfect SEO
Blog / Documentation / ContentSSG + IslandsAstroStatic content, minimal interactive widgets
E-commerce product pagesISRNext.jsStatic shell, prices refresh hourly
SaaS dashboard with user dataPPR or SSRNext.js App RouterStatic layout, dynamic user content
Real-time collaborative appCSR + WebSocketReact/VueHeavy JS is unavoidable here
Hybrid (marketing + app)Astro + Next.jsBothAstro for public, Next.js for app behind auth

The Framework Comparison

DimensionAstroNext.js (App Router)RemixSvelteKit
Default JS0 KB~100 KB~80 KB~30 KB
RenderingSSG default, SSR optionalSSR/SSG/ISR/PPRSSR defaultSSR default
InteractivityIslands (opt-in hydration)Server/Client ComponentsClient componentsSvelte reactivity
Data LoadinggetStaticProps equivalentServer Components + fetchloader functionsload functions
Best ForContent-heavy sitesFull-stack SaaS appsForm-heavy appsPerformance-critical apps
Learning CurveLowMedium-HighMediumLow
EcosystemGrowingMassiveModerateGrowing
DeploymentAny static hostVercel (optimal), any Node hostAny Node hostAny Node host

04. Deep Dive: Astro’s Islands Architecture

Astro treats your page like an ocean of static, high-performance HTML. If an element requires interactivity, you drop that component into the page as an isolated Island.

The master advantage: You choose exactly how and when that component hydrates on the user’s device via client directives.

The Client Directives

Tell your AI tool: “Use Astro’s client directives to control when components hydrate:

  • client:load — hydrate immediately (for critical above-fold elements)
  • client:idle — hydrate when browser is idle (for below-fold widgets)
  • client:visible — hydrate when scrolled into view (for charts, maps)
  • client:hydrate — hydrate on user interaction (hover, click, focus)“

Client Directive Cheat Sheet

DirectiveWhen It HydratesUse Case
client:loadImmediately on page loadCritical interactive elements above the fold
client:idleWhen browser is idleBelow-the-fold widgets, search bars
client:visibleWhen element enters viewportCharts, maps, heavy components below fold
client:mediaWhen a CSS media query matchesMobile-only navigation, responsive widgets
client:hydrateManual trigger via scriptComplex state-driven components

Real-World Island Example

Tell your AI tool: “Create a dashboard page where:

  • Sidebar is static HTML (zero JS)
  • StatsCard hydrates when scrolled into view
  • LiveActivityFeed hydrates immediately (real-time data)
  • PricingToggle hydrates on user interaction”

The result: The page loads as pure HTML (~20KB). The interactive components download their JS individually and hydrate only when needed.


05. Deep Dive: Next.js App Router

Next.js App Router (introduced in v13, stable in v14+) fundamentally changed how React applications are structured. The core shift: Server Components by default.

Server Components vs. Client Components

Server Components run on the server and ship zero JavaScript to the browser. Use them for data fetching, database queries, and static layout.

Client Components run in the browser and ship JavaScript. Use them for user interactions (clicks, inputs), state management, and browser APIs.

Tell your AI tool: “By default, all components are server components in Next.js App Router. Only add ‘use client’ directive when the component needs useState, useEffect, onClick handlers, or browser APIs. Keep everything else as server components to minimize JavaScript bundle.”

The Rule: Server First, Client Only When Necessary

Use Server Component When…Use Client Component When…
Fetching data from databaseHandling user interactions (clicks, inputs)
Accessing backend resources directlyUsing useState, useEffect, or other hooks
Keeping sensitive logic server-sideUsing browser APIs (localStorage, window)
Reducing client-side JS bundleUsing third-party libraries that require browser runtime
Rendering static layout and structureAnimations, transitions, real-time updates

Streaming and Suspense

PPR in Next.js uses React Suspense to stream dynamic content:

Tell your AI tool: “Use React Suspense to stream dynamic content. Wrap async server components in Suspense with skeleton fallbacks. The static header renders instantly while dynamic content streams in as database queries complete.”

What this does: The user sees the header immediately. Stats stream in when ready. Activity feed streams in when ready. No waterfall. No layout shift (skeletons hold space).


06. Core Web Vitals: The Performance Gate

Google uses three metrics to rank your site. If you fail these, your SEO suffers regardless of how good your content is.

MetricWhat It MeasuresTargetHow Rendering Pattern Affects It
LCP (Largest Contentful Paint)When the main content becomes visible< 2.5sSSG: ~0.5s. SSR: ~1.5s. CSR: ~3s+
INP (Interaction to Next Paint)Responsiveness to user input< 200msMore JS = worse INP. Islands help.
CLS (Cumulative Layout Shift)Visual stability (things jumping around)< 0.1Skeletons prevent CLS. Dynamic inserts cause it.

The Performance Budget

{
  "budgets": [
    {
      "resourceType": "script",
      "budget": 200000,
      "budgetWarning": 150000
    },
    {
      "resourceType": "stylesheet",
      "budget": 50000,
      "budgetWarning": 30000
    },
    {
      "metric": "largest-contentful-paint",
      "budget": 2500,
      "budgetWarning": 1800
    },
    {
      "metric": "cumulative-layout-shift",
      "budget": 0.1,
      "budgetWarning": 0.05
    }
  ]
}

Senior Moves for Performance

  1. Measure first, optimize second. Run Lighthouse on your actual site before changing anything. You can’t improve what you can’t measure.
  2. SSG for anything that doesn’t change per-request. If the content is the same for every user, there’s no reason to render it server-side on every request.
  3. Lazy load everything below the fold. Use client:visible (Astro) or dynamic() (Next.js) for components that aren’t immediately visible.
  4. Monitor real user data (RUM). Lighthouse is lab data. Use Vercel Analytics, SpeedCurve, or Web Vitals library to see what real users experience.
  5. Font loading matters. Use font-display: swap and self-host fonts. Third-party font requests add 200-500ms to LCP.

Key Takeaways

ConceptMental ModelSenior Insight
JavaScript TaxEvery KB costs parse + compile + execute timeSet a budget: < 200KB gzipped for most sites
SSGBuild once, serve foreverBest performance, worst freshness — use for content that doesn’t change
ISRStatic shell + time-based revalidationGood for product pages, prices, anything that updates hourly
SSRFresh render on every requestUse only when content is user-specific or real-time
PPRStatic shell + dynamic holesThe modern default — instant TTFB + streaming dynamic content
CSREmpty shell + client-side renderLegacy pattern — avoid for new projects unless building real-time apps
Astro IslandsOpt-in hydration per componentBest for content-heavy sites — zero JS unless you explicitly add it
Next.js Server ComponentsServer-first, client only when neededDramatically reduces client bundle — most components never ship JS
Core Web VitalsLCP + INP + CLSPerformance is SEO — failing these metrics means less traffic