This blog post and its accompanying Hacker News discussion critically examine Next.js, particularly focusing on the author's frustrating experience with setting up production-ready logging and middleware. The author details how Next.js's architecture, especially its "edge" runtime and AsyncLocalStorage limitations, forces complex and "hacky" solutions for basic concerns like request-scoped logging, contrasting it unfavorably with frameworks like SvelteKit. The Hacker News comments largely corroborate these frustrations, highlighting issues such as Next.js's excessive abstraction, frequent breaking changes, poor documentation, perceived vendor lock-in to Vercel, and a general decline in developer experience, often drawing comparisons to historical enterprise software "monstrosities." The discussion also explores various alternative frameworks and paradigms that aim to offer a more stable and predictable development environment.
Summarizing "Next.js Is Infuriating" and Hacker News Discussion
Initial Frustrations with Logging and Middleware:
The author begins by detailing the challenge of setting up production-ready logging in Next.js, as default logging is only for development.
Next.js middleware is identified as problematic, offering only four parameters (with headers being the only effective one for route interaction) and preventing multiple or chained middlewares.
Attempts to use AsyncLocalStorage for request-scoped logging within middleware fail, as the rendering context does not share the same async context as the middleware.
The "Hacky" Solution and Architectural Critique:
The only viable (but "stomach-churning") solution involves passing a requestId via HTTP headers from the middleware, which then has to be read asynchronously by pages/layouts, creating significant code splitting and complexity.
A custom Next.js server, often seen as an "eject" option, also fails to maintain AsyncLocalStorage context, frustrating the author who notes that Next.js developers themselves utilize this power.
The author contrasts Next.js with SvelteKit, praising its straightforward event.locals object for passing custom request data and its support for multiple, chainable middleware functions.
Developer Support and Community Issues:
Next.js's GitHub issue tracker is heavily criticized as a "super massive black hole" where bug reports (even with minimal reproductions) often go unaddressed for years.
The author expresses a strong desire to stop using Next.js due to constant "bugs and edge cases around every corner" and the perceived lack of tools to leverage its client/server distinction effectively.
Hacker News Comments - Widespread Frustration and Agreement:
Over-abstraction & Complexity: Many commenters echo the sentiment that Next.js introduces excessive layers of abstraction and complexity that most projects don't need, making it difficult to understand where code is running (especially with "App Router," "Edge," "Node," and "Client" runtimes).
Breaking Changes & Instability: Frequent breaking changes across major versions are a recurring complaint, leading to significant maintenance overhead and making older codebases fragile.
Vendor Lock-in (Vercel): A strong theme is the perception that Next.js's design choices are geared towards pushing users onto Vercel's hosting platform, with features and documentation favoring their ecosystem, hindering self-hosting or deployment on other providers.
Poor Documentation & Support: Commenters confirm the author's critique of documentation being "too simplified" for advanced use cases and the GitHub issue tracker being unresponsive.
Comparisons to "Enterprise Bloatware": Next.js is unfavorably compared to older, notoriously complex and "bloated" enterprise technologies like SharePoint, Lotus Notes, and JEE (Java Enterprise Edition), signaling a loss of the simplicity once associated with the JavaScript ecosystem.
React's Influence: The official React documentation's recommendation of Next.js as the default framework for new React apps is seen as problematic, contributing to its widespread (and sometimes reluctant) adoption.
Hacker News Comments - Alternative Solutions and Paradigms:
SvelteKit: Frequently recommended for its superior developer experience, clear context passing, and chainable middleware.
Astro & Remix/React Router: Mentioned as viable alternatives, often praised for simpler architecture, closer adherence to web standards (HTML, HTTP), and better control over client-side JavaScript.
Traditional Server-Side Rendering (SSR): Many advocate for frameworks like Ruby on Rails, Django, or PHP-based solutions (sometimes augmented with HTMX or AlpineJS) for their stability, predictability, and clearer separation of concerns.
Simpler Frontend Stacks: Suggestions include vanilla React (with Vite for bundling), Angular (especially newer versions with Signals), and other micro-frameworks or approaches that avoid the full-stack complexity of Next.js.
Backend Languages: Go and Elixir/Phoenix are recommended for their stability, performance, and developer experience in backend development, contrasting with the perceived "cursed" nature of the Node.js ecosystem.
(Note: Timestamps are not available for a blog post and its comments. Section titles are used to delineate major topics within the blog post, and general themes are used for the Hacker News comments.)