Research Archive

The AI-Native Web Framework Thesis

Why React is wrong for agentic coding

Updated: December 2025 Source: research/AI-NATIVE-WEB-THESIS.md

The AI-Native Web Framework Thesis

Analysis Date: December 21, 2025 Status: You're Onto Something - But Too Early to Build

The Core Question

"If I were starting all my projects today, would I use a different stack from React?"

Answer: Yes, but not to any of the currently available alternatives.


Why React is Wrong for Agentic Coding

1. Training Data Bias Creates a Trap

LLMs are biased toward React because it dominates training data. This seems like an advantage but is actually a trap:

  • LLMs generate React code that compiles but often fails at runtime
  • UICoder research found UI code is <1% of training datasets
  • LLMs "struggle to handle domain-specific UI patterns or produce compilable code"
  • Generated code often violates accessibility guidelines and has hidden bugs

The irony: React's popularity makes AI generate more React code, but not better React code.

2. React's Complexity Exceeds AI's Reasoning Capacity

React patterns that confuse LLMs:

  • Hooks rules (can't call conditionally, must be top-level)
  • Closure stale state in useEffect callbacks
  • Re-render cascades from improper memoization
  • Server vs Client component boundaries (Next.js 13+)
  • Hydration mismatches between SSR and client

When handling streaming responses, developers "start wrestling with ReadableStream and intricate useEffect hooks... Suddenly, a 'simple' AI wrapper app is 500 lines of spaghetti code."

3. The "Vibe Coding Hangover" is Real

The industry is learning this the hard way:

  • 45% of AI-generated code introduces security vulnerabilities (Veracode 2025)
  • Fortune 50 companies: AI-assisted devs produce 3-4x more code but 10x more security issues
  • 40% of AI-generated queries vulnerable to SQL injection
  • 21.7% of open-source model outputs hallucinate non-existent packages

Even Karpathy (who coined "vibe coding") hand-coded his latest project Nanochat because "Claude/Codex agents just didn't work well enough at all."


What AI-Friendly Code Actually Looks Like

Research and practice reveal clear patterns:

1. Deterministic > Generative

From Blueprint First research:

"Separate the rigid, predefined process flow from the flexible, model-driven execution of individual tasks."

AI should select from components, not invent components.

2. Common Patterns > Novel Abstractions

From Simon Willison:

"The more common the kind of code you write, the more likely an AI model will do a good job."

Next.js + Tailwind works because it's common. Custom architectures fail.

3. Server-Rendered HTML > Client-Side State

From HTMX philosophy:

"We can use any programming language on the server side. We don't need lots of libraries and other cruft."

HTMX reduced codebases by 67% compared to React in real-world ports.

4. Declarative Registries > Freeform Generation

From CopilotKit analysis:

"Declarative UI is the sweet spot for most agentic apps. It balances creativity with safety. You get variety without chaos."

AI picks from a catalog of pre-approved components, not infinite possibility space.


The Framework That Should Exist

Based on all research, an AI-native web framework would have:

Principle Implementation
Server-first All state lives on server, HTML over the wire
Deterministic routing File-based, no dynamic route generation
Component registry Finite set of composable primitives
No client state Eliminates hooks, effects, hydration bugs
Typed templates Compiler catches errors before AI generates them
Single language Same code runs server and generates HTML

Closest Existing Options

Framework Matches Gaps
Phoenix LiveView Server-first, no client JS, typed Elixir learning curve, small ecosystem
Go + HTMX + Templ Server-first, typed templates, fast No component registry, manual assembly
SvelteKit Compiler-based, simpler than React Still has client state, scaling issues
Astro Server-first, component islands Still pulls in React/Vue/Svelte

None fully implement the vision. They're steps in the right direction, not the destination.


Why "Too Early"

The Technology Gaps

  1. No AI-aware component registry exists

    • A2UI is closest but v0.8 preview only
    • AG-UI focuses on agent protocols, not component catalogs
  2. No property-based test generation

    • fast-check exists but isn't AI-integrated
    • AI can't verify its own output
  3. No deterministic workflow SDK

    • MCP is protocol-level, not workflow-level
    • Blueprint First is research, not product
  4. Server-first frameworks aren't AI-optimized

    • LiveView is great but Elixir-only
    • HTMX is library, not framework

The Ecosystem Gaps

  1. Hiring: React developers are 10x more available than Elixir/Phoenix
  2. Libraries: npm has 2M+ packages; Hex (Elixir) has 15K
  3. Tooling: React DevTools, Storybook, Testing Library - nothing equivalent elsewhere
  4. Deployment: Vercel, Netlify optimized for React/Next.js

The Opportunity You've Identified

You're sensing something real. The opportunity has three layers:

Layer 1: Build the Registry (Near-term)

Create a finite, AI-composable component catalog for your apps:

  • E-commerce primitives (product card, cart, checkout flow)
  • Dashboard primitives (metric card, data table, chart)
  • Form primitives (validated inputs, multi-step wizards)

This works with your existing Next.js stack while preparing for the future.

Layer 2: Define the Workflow Primitives (Medium-term)

Create a deterministic workflow SDK on top of your component registry:

  • Migration steps as pure functions (bc-migration already does this)
  • UI flows as state machines
  • API calls as typed commands

This is the "standard library" gap you identified in the original analysis.

Layer 3: Build the Framework (Long-term)

When the ecosystem is ready:

  • Server-first rendering with typed templates
  • AI-aware component selection
  • Property-based test generation
  • Single-language (TypeScript or Elixir)

This is 18-24 months away from being practical.


Recommended Path Forward

For Your Existing Projects

Don't migrate. The cost exceeds the benefit today.

Instead, introduce AI-friendly patterns incrementally:

  1. Create component registries within your Next.js apps
  2. Use Zod schemas everywhere (typed, deterministic)
  3. Prefer server actions over client state
  4. Build pure functions that AI can compose

For New Projects

Evaluate per-project:

Project Type Recommendation
Complex app (rally-hq scale) Next.js 16 + component registry
Simple dashboard SvelteKit or Astro
CLI tool Bun + TypeScript
Agent-native product Phoenix LiveView (accept learning curve)
Prototype/experiment Go + HTMX + Templ

For the Framework Opportunity

Document and build the missing pieces:

  1. Component registry specification
  2. Workflow primitive SDK
  3. Property-based test generator for AI code

These become the foundation of the framework when timing is right.


Conclusion

You're onto something. The thesis is correct:

React is the wrong abstraction for agentic coding. The future is server-first, declarative, and deterministic.

But you're too early to build a framework. The alternatives aren't mature enough, the ecosystem isn't ready, and the tooling doesn't exist.

The revised play: Define a Standard, Not a Framework

The opportunity isn't to build another framework—it's to define the conventions that make any framework AI-composable. Like Rails defined "convention over configuration" and Spring Boot defined "opinionated defaults," the agentic web needs someone to define the patterns.

See: AGENTIC-WEB-STANDARD.md for the full specification approach.

Why specification-first wins:

  1. Framework-agnostic - Works with Next.js today, Phoenix tomorrow
  2. Adoption path - Teams adopt conventions without rewriting
  3. Ecosystem growth - Others can build implementations
  4. AI training - Specification becomes training data

The execution path:

  1. Define specifications (component registry, primitives, workflows, tests)
  2. Build reference implementation on Next.js (path of least resistance)
  3. Expand to SvelteKit, Phoenix, Go+HTMX
  4. Let the ecosystem adopt and extend

The standard will exist. The question is whether you define it or follow someone else's.


Sources

React/AI Code Generation Problems

Deterministic/AI-Friendly Patterns

Server-First Frameworks

Declarative UI and Component Registries