Frontend Rapidorganizer · search · two themes

Hybrid Frontend — full notes, searchable

Source: rapid frontend.md (435 lines) plus the appended 99-line agent box. Nothing from the source was deleted. Search the page. Toggle paper / ink. Open a box, copy, run. Need everything in one paste? Use the large UNIFIED box.

LARGE UNIFIED HYBRID — all small boxes in one paste

Contains every small box below (how-to, 99-line agent, rules, golden, stack, never-do, tips, prompts, checklist, fluid CSS, no-React-state). One click copies the full hybrid for an AI agent.

building…

        
How to use these notes
  • Live build of a content site → paste the 99-line box into the agent first.
  • Pick a stack from §4 before writing code. Do not default to React for docs.
  • Then open the matching prompt in §7 (scaffold / virtualize / Pagefind / audit).
  • This organizer itself follows the below-part: CSS :checked-free details, clamp, dvh, no React state.
99-line AI-agent paste box

Title: Hybrid Frontend Architecture Agent — Static-First SSG, Islands Hydration, Virtualized Lists, Prefetch, Event Delegation, Pagefind, CDN

Function role

  1. Operating manual for huge-content sites that must stay fast, stable, and low-RAM: SSG many small pages, not one giant HTML.
  2. Eight hybrid rules plus five golden rules: one topic/page, zero-JS default, virtualize/paginate, lazy, prefetch, one parent listener, content in MD/JSON, Brotli+CDN.
  3. Stack picker (Astro/Pagefind vs SvelteKit+TanStack vs plain HTML vs SSR+Meilisearch) and a never-do list.
  4. Copy-paste AI prompts for scaffold, virtual list, Pagefind, audit, monolith migration, hover-prefetch, delegation.
  5. Below-the-box organizer: search, two themes, expandable sections, fluid clamp/dvh CSS, CSS-first UI with almost no React state.
75 source lines + 24 below-part = 99

        
1 · Executive summary

All three source voices agree: the file structure matters less than the rendering and delivery strategy. A single giant HTML file will choke the browser. Splitting folders is not enough.

Use a static-first, demand-driven, minimally-hydrated architecture. Only render, load, and execute what the user needs now.

SSG → many small HTML pages → minimal JS → lazy load → CDN + Brotli + cache → virtualize long lists.

HTML + CSS + JavaScript. Not Java. A standalone file can hold huge text, but the DOM tree will lag. The holy grail is huge content + lightning clicks + low RAM.

2 · Eight hybrid rules
  1. One topic = one page. Build-time HTML per article. Small DOM, granular cache, instant nav.
  2. Zero-JS default, hydrate by exception. Islands. JS only for search, filters, virtual scroll.
  3. Virtualize or paginate. 20–100 items to browse. Visible rows only for long scroll. Never 10k–100k nodes.
  4. Load on demand. loading="lazy" + IntersectionObserver. Search index only when search opens. API fetch on scroll/click.
  5. Prefetch the next step. <link rel="prefetch"> on hover. MPA feels like SPA.
  6. One parent listener. Event delegation. Memory stays flat.
  7. Content in Markdown/JSON/CMS. Thin shell. Never hardcode mass content into bundles.
  8. Brotli/gzip + cache + CDN. Cloudflare / Vercel / Netlify. Service worker only if offline is required.
3 · Five golden rules
  1. DOM: never more than 50–100 items at once. Window ~20 visible rows. 60fps, flat RAM.
  2. Delivery: Astro or Hugo static HTML. Alpine.js ~15KB or htmx ~14KB. No React/Angular on content pages.
  3. Anticipation: hover prefetch + immutable cache on hashed assets.
  4. On-demand: lazy images, code-split JS per topic, paginate long lists.
  5. Events: parent listener + closest("[data-id]").

Hard limits from the source: ≤1,500 DOM nodes/page · ≤200KB JS/page · ≤3s TTI · prefer ≤50KB JS. Test 6× CPU throttle.

4 · Decision matrix — which stack
SituationStackWhy
Docs, wiki, blog, KBAstro + Markdown + Pagefind + CDNZero-JS default, SEO, fastest loads
Dashboards, logs, huge tablesSvelteKit / SolidStart + TanStack Virtual + APILight reactivity, virtualization
No-build, ultra simplePlain HTML + vanilla JS + paginationZero deps, trivial host
User-generated, dynamicNext.js / Nuxt SSR + Meilisearch + CDNFreshness + search
SPA feel without SPA weightAstro + htmx/Alpine + prefetchStill multi-page under the hood

SSG: Astro zero JS · 11ty simple · Hugo fastest Go. Content stays in MD/JSON.

5 · Never-do list
Do notDo instead
One HTML with 50,000 linesSplit pages; SSG
All topics on the homepagePaginate or topic index
100,000 table rows in the DOMVirtualize or server paginate
Ship React for a static blogAstro or plain HTML
Click listener on every itemOne parent listener
Search index on every loadLazy load when search opens
Ignore cache headersImmutable assets, revalidate HTML
6 · Actionable tips

Content

  • Markdown/MDX — portable, versioned, writing ≠ code.
  • Folders /content/category/topic.md auto-build indexes.
  • Generate topic pages at build time, never runtime.

Speed

  • Hover prefetch (5-line script or Astro prefetch).
  • One small CSS file beats over-preloading.
  • Native View Transitions API — no framework.

Lists / search / deploy

  • <500 paginate · 500–10k clusterize.js or content-visibility · 10k+ TanStack Virtual.
  • <1k pages: Pagefind / Fuse.js. 10k+: Meilisearch / Typesense.
  • Assets: public, max-age=31536000, immutable. HTML: max-age=0, must-revalidate.
  • Images: WebP/AVIF, width+height, lazy+async. Fonts: self-host, font-display:swap.
  • Web Worker for 100k-row JSON filter. defer scripts. Minify.
document.getElementById("list").addEventListener("click", (e) => {
  const item = e.target.closest("[data-id]");
  if (item) handleClick(item.dataset.id);
});
7 · Copy-paste AI prompts

A · Scaffold. Astro, Markdown in /content/, one page per topic at /topics/[slug]/index.html, min CSS, zero client JS except search, hover prefetch, static host.

B · Virtual list. TanStack Virtual or vanilla. 50,000+ rows. Delegation. 60fps. Under 50MB RAM.

C · Pagefind. Do not load the index on first paint. Init on search focus. No external API.

D · Audit. JS size, DOM count, unused CSS, lazy images, cache headers, Brotli, listener count. Fix over-threshold items.

E · Migrate 30k-line HTML. URL per topic, extract CSS/JS, Astro or 11ty, paginate/virtualize, CDN.

Hover prefetch. Vanilla: hover on internal a injects link[rel=prefetch], skip duplicates.

Delegation. #topic-list parent, hundreds of child buttons, one listener.

Instant nav. Fetch HTML, swap main, pushState, prefetch on hover, degrade if JS is off.

8 · Performance checklist
  • CDN serving Brotli (or gzip) for HTML/CSS/JS/SVG.
  • WebP/AVIF + width/height + loading="lazy".
  • Self-hosted fonts, font-display: swap, preload only above-fold weights.
  • Hashed assets immutable one year. HTML revalidate.
  • Heavy parse → Web Worker. Progressive enhancement: readable with JS off.
  • Service worker only if offline is a real requirement.

Final recipe: Astro + Markdown/MDX + static HTML + Pagefind + tiny CSS + minimal JS + pagination/virtualization + lazy + prefetch + cache + CDN.

9 · Fluid CSS — less code, every screen
  • clamp(min, preferred, max) for font, padding, gap. Example font-size: clamp(1rem, 2.5vw, 1.5rem).
  • Pair with min() / max(). Container max: min(100%, 600px).
  • Images: aspect-ratio: 16/9; object-fit: cover; max-width: 100%; height: auto;
  • Viewport: dvh / svh / lvh — not raw vh (mobile chrome).
  • Container queries when supported — style the component, not the viewport.
  • Logical props: margin-inline, padding-block, width: fit-content, grid auto-fit + minmax().
10 · Faster UI without React state
  • Hover, checkbox + :checked / :has(), details, CSS transitions for open/close — not useState.
  • useRef for focus, measure, DOM, timers (no re-render).
  • Composition over state. Uncontrolled children. Do not lift state high.
  • Skip state for modals/tooltips/animations CSS can do.
  • If state is required: keep it local. useMemo/useCallback only after profiling.
  • External store only for truly global data. Result: fewer re-renders, snappier low-end pages.