The AI cost of JavaScript frameworks nolanlawson.com · 330 points · 251 comments...
HN Best 30 @best30
The AI cost of JavaScript frameworks nolanlawson.com · 330 points · 251 comments · HN thread
TL;DR Nolan Lawson benchmarked agents (Opus 5.5) building the same Pokémon app across 12 JavaScript frameworks and Vanilla Vite, measuring cost, time, tokens, Lighthouse scores and lines of code. Astro and Hono+htmx were cheapest and smallest in code; Angular was the most expensive and largest, and the SSR-heavy and content-oriented MPAs won on load metrics. The post argues that framework choice in the agentic era should be based on evidence rather than vibes, while admitting the test app is small and the results stochastic.
- Each framework's app was built 5 times by Claude Code with Opus 5.5 (Angular 3 usable runs for some metrics) and checked against an accessibility-tree conformance suite.
- Median cost per run ranged from $2.67 (Hono+htmx) and $2.76 (Astro) to $4.97 (Angular); SvelteKit, Gracile+Lit and Angular were the most expensive builds.
- Lighthouse Performance and Accessibility were nearly saturated (mostly 99-100); JavaScript bytes ranged from 0 (Astro) to 142 KB-scale values for Next.js, and LCP favored MPAs like Astro (810 ms).
- Lines of code ranged from 1370 (Hono+htmx) to 2009 (Angular); Hono+htmx produced about 70% of Angular's code.
- Agents often failed to use installed MCPs or skills (e.g. Next.js skill read in only 1 of 5 runs), and Angular's SSR build broke the spec in 2 runs, so results are noisy.
- The author stresses the benchmark covers one simple content-heavy app, not a complex interactive product.
Discussion The thread splits between people defending frameworks as tools that reduce state-management complexity and maintenance burden for teams, and people arguing that vanilla JS, server rendering or htmx suffice for most apps. Many commenters question the benchmark's scope, saying a simple content app does not represent complex SPAs, dashboards or real products, and some dismiss it as vibes-adjacent. The mood is argumentative and skeptical, with long side debates about the definition of a framework, whether employers push frameworks, and what 'writing your own' actually costs.
- Benchmark too simple to say anything about real apps (most): Many argue the Pokémon app is a content site with little interactivity, so results do not transfer to dashboards, social apps or commercial SPAs. They want a more complex app with auth, state and multiple teams of agents.
- Frameworks reduce state-sync bugs and maintenance cost (many): Commenters with production experience say frameworks like React or Vue make state consistency and long-term maintenance manageable, and that rolling your own often becomes a mess. Some note agents still need structure to avoid tangled code.
- Vanilla JS or server rendering is enough (many): Several argue that most web apps do not need a client framework, citing htmx, server-rendered pages and vanilla DOM code. Some report their own large vanilla or homegrown apps working well, which others dispute.
- Angular performs poorly, pre- and post-AI (some): Multiple commenters say Angular was already disliked and the benchmark confirms it is costly and verbose for agents, though others defend its rigidity and ongoing development.
- Astro and htmx look like good defaults for content sites (some): Users report positive experiences with Astro and htmx for content-driven sites, noting Astro's zero-JS default and that its escape hatches allow interactivity where needed.
- Frameworks are a tradeoff in agent-heavy codebases (a few): A minority notes that agents may still benefit from a stable, widely known framework because it lives in training weights and reduces drift, while unstable or new APIs cost tokens.
Links from the comments
- Rich Hickey's 'Simple Made Easy' talk, cited in a debate about component systems versus simplicity.
- Chrome's experimental declarative partial updates, suggested as an alternative to SPA frameworks for streaming HTML.
- Anthropic's web artifacts builder skill, offered as a React-based starting template to avoid sloppy generated frontends.
- ArrowJS, a minimal agent-oriented SPA framework that a commenter shared, noting its shift from library to framework.
- A static Astro site built entirely by Opus 5.5, shared as an example of agent output.
#JavaScriptFrameworks #AIcoding #Benchmarks #WebPerformance #Astro #Angular