Build a Fast Client-Rendered React App

Once per project, when starting a new client-rendered React app — scaffold it on a pinned Vite/Rolldown/TanStack stack with TanStack Redact as the default renderer, intent-based loading, hard byte budgets in CI, and a measured renderer release decision.

  • creation
  • foundation
  • #react
  • #vite
  • #tanstack
  • #performance
  • #frontend
  • by Pontus Abrahamsson (@pontusab)
build-fast-client-react-app.md
## Context

This is a greenfield project — no application code exists yet beyond a bare
skeleton. You are scaffolding a new client-rendered React app whose defining
requirement is speed: it is built, measured, and gated against explicit byte
and interaction budgets from the first commit.

Use TanStack Redact 0.3.1 as the default browser renderer.

## Goal

Scaffold and configure a fast client-rendered React app on the pinned stack
below, wired for intent-based loading, hard byte budgets in CI, and a measured
Redact-vs-React-DOM release decision.

## Inputs

This prompt is self-contained: the stack, budgets, and targets are specified
below. Provide a preview URL via `PREVIEW_URL` when running interaction
profiles.

## Instructions

Work through sections 1–5 in order.

### 1. Stack

- Vite 8.3.8 with Rolldown, React and React DOM 19.3.1, React Compiler 1.0.0,
  strict TypeScript 7.0.2.
- TanStack Router 1.170.46 with router-plugin 1.169.0 for file-based routes.
  TanStack Query 5.108.2 for server data. StyleX 0.19.2 for extracted CSS.
- Bun Canary 1.4.5-canary for development and CI.

### 2. Build with Redact

Register TanStack Router with autoCodeSplitting first, followed by StyleX with
runtimeInjection disabled, react(), Babel with reactCompilerPreset(), and
redact() from @tanstack/redact/vite. Keep standard React imports. Keep a build
switch for React DOM.

### 3. Load on intent

- On entry, start critical queries in the route loader while its component
  downloads. Share one QueryClient and one queryOptions definition per
  resource. Await queryClient.query(options) for required fresh data and read
  it with useSuspenseQuery. Give secondary panels their own Suspense
  boundaries.
- For navigation, set defaultPreload to 'intent', defaultPreloadDelay to 50
  ms, and defaultPreloadStaleTime to 0. Warm likely destinations on hover,
  keyboard focus, or touchstart. Disable preloading on low-value links.
- For editors and charts, warm the same import() used by React.lazy on
  deliberate hover, focus, or press. Open the feature on activation. Load
  rarely used tools on demand. Test direct links and cold taps.

### 4. Keep the first view small

Fail CI above 150 kB total cold-entry JS, 50 kB route-specific startup JS, or
20 kB first-view CSS, all Brotli. Count each asset once across the shell,
matched layouts, route chunks, and preloads. Verify with the Vite manifest and
a cold browser trace. Count the CSS StyleX actually emits. Make the LCP image
discoverable early and reserve its dimensions.

### 5. Ship on measured results

- Run `bun ci`, `bun lint`, `bun fmt --check`, `bun check`, `bun test`, and
  `bun run build`. Run React Doctor on new PR findings. Use Playwright to
  replay cold entry, warm navigation, and typing during filtering with
  realistic data.
- Profile one slow interaction at a time with the pinned React Doctor CLI:

  ```bash
  bun run react-doctor scan "$PREVIEW_URL" --trace-out interaction.json.gz
  ```

- Redact renders synchronously. Before release, compare both renderers on the
  same commit. Measure time to usable content and input latency while
  filtering the largest realistic list. Exercise forms, portals, and Suspense
  navigation. Ship Redact when cold entry improves and those interactions hold
  their baseline. Ship React DOM if Redact misses either condition or breaks a
  required flow.
- Report before/after timings and bytes. Sample web-vitals/attribution by
  route template and release to find slow interactions in the field. Target
  p75 LCP ≤ 2.5 s, INP ≤ 200 ms, CLS ≤ 0.1, and fully cached navigation to
  visible content ≤ 200 ms.

## Output format

The artifact is the app itself: a working scaffold on the stack above with the
budget checks wired into CI. Commit the code, then write a short performance
report (e.g. `PERFORMANCE.md`) covering:

1. **Budget results** — cold-entry JS, route startup JS, and first-view CSS
   against the limits, all Brotli.
2. **Renderer comparison** — Redact vs React DOM on the same commit: time to
   usable content and input latency while filtering the largest realistic
   list, and which renderer shipped and why.
3. **Field targets** — instrumentation for p75 LCP ≤ 2.5 s, INP ≤ 200 ms, CLS
   ≤ 0.1, and fully cached navigation to visible content ≤ 200 ms.

## Guardrails

- Use the pinned versions above; do not substitute newer or different tools.
- Keep standard React imports and keep the React DOM build switch working —
  Redact is opt-out, not a commitment.
- Do not preload low-value links, and do not eagerly load rarely used tools.
- Ship React DOM if Redact misses a shipping condition or breaks a required
  flow; do not force the new renderer.
- If critical information is missing, stop and ask instead of guessing.

More prompts

## Context You are running a one-time, comprehensive technical SEO + GEO (AI-search readiness)audit-and-fix on this existing, already-built web project. This condenses the SEOPrompt Master workflow (START.md, phase prompts 00–05, checklists and scoringrubric from github.com/umutxyp/Seo-Promt-Master) into a single self-contained run. Two principles drive everything: 

Audit and Fix a Site's SEO and AI-Search (GEO) Readiness

Once per site, when you want every public page brought into compliance with Google's SEO guidance plus AI-search readiness — route inventory, per-page 9-point audit, prioritized fixes, and verified SEO/GEO scores.

  • #seo
  • #geo
  • #audit
  • #web
  • #agents
12 views2 copies

DBy @DanKornas

## Context The app is already built and running. Its HTML and CSS are competent, but theinterface feels off: everything centered, one spacing value used everywhere, aprimary color leaning indigo or purple, every action rendered as a filledbutton, no empty states. Nothing errors out — the problem is that generation islocal while design has to be judged globally. What fixes this is a rulebook, not taste. This prompt applies the rules from

Audit and Refactor UI Design

Once per application, when the UI works but looks off — a diagnostic pass that sweeps seven lenses in fixed causal order (hierarchy to finishing touches), reports severity-ranked findings that each cite a rule, then fixes violations and re-verifies with screenshots.

  • #ui
  • #design
  • #audit
  • #frontend
  • #design-tokens
1 views0 copies

By edisonmbli

## Context Act as a Senior Application Security Engineer specialising in secure webdevelopment, OWASP security risks and abuse prevention. You are auditing anexisting, already-built application's actual source code, configuration, APIendpoints, dependencies and external integrations. The app works — authentication works and APIs return data — but a working apponly proves the code can run, not that it can safely face the internet. AI

Audit Application Security

Once per application, before it becomes publicly accessible — a defensive OWASP-style audit of source, config, endpoints and dependencies covering exposed secrets, injection paths, session and request protection, and abuse resistance, ending in a severity-ranked remediation plan.

  • #security
  • #audit
  • #owasp
  • #secrets
  • #abuse-prevention
3 views0 copies

SBy @Sujay__Raj