Replies: 1 comment
-
|
@foxted Next.js Dev-Extension API The Goal: Move from "private hacks" and forks to a standardized, plugin-based architecture for Next.js development tooling (Dev Indicators and Menus).
Location: Project root or /src. Behavior: Default exports a component or array of components that hook into the Next.js Dev Overlay. Isolation: This file is strictly excluded from production bundles, ensuring zero impact on end-user performance.
and : Sub-components for structured data (e.g., "API Health: 84ms").
Reduced Fragmentation: It eliminates the need for projects like next-devtools to maintain complex forks of Next.js internals just to add a UI layer. Framework-Level Introspection: It allows for "Health Checks" and "RSC Introspection" to be shipped directly with packages, making the "Black Box" of Next.js more transparent during development. 💡 Key Technical Considerations (For the Badge) Execution Context: Should these indicators be standard React Client Components (allowing hooks/state) or static metadata? (The proposal leans toward components for flexibility). Tree Shaking: Ensuring the next/devtools package is completely purged during next build is the highest priority for the Next.js core team. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
Nuxt DevTools is the example I keep coming back to: dev-only UI that helps you understand the app without leaving the browser. Next.js does not need to copy that product, but the idea that the framework can host small dev tools in one predictable place is useful.
There is already community energy around this. next-devtools wraps Next with extra dev UI, which tells me people want more than ad hoc scripts or browser extensions.
On my side I maintain RSC Boundary. It wants a tiny dev-only signal so users know the tooling is on. I can ship a floating pill or something similar, but it would feel better if library authors could plug into the same dev tools surface Next.js already shows, instead of adding another overlay. SWR and other packages could also hook into this surface.
Right now, if you want to extend that area you mostly reach for internals or a fork. A small public extension point would make ecosystem tools easier to build and easier to trust.
Proposal
Ship a documented way to extend dev tooling: a root file convention plus a stable module (for example
next/devtools) with primitives for menu items. Apps and packages compose those in one place so everything lines up with the built-in dev tools menu.Before:

After:

Illustrative API (names and rules are up for debate)
1. Project root or
src/:dev-indicators.tsxThe app registers indicators by default-exporting a single
MenuItem, a component that rendersMenuItem, or an array of those (each entry is one indicator).2. Same pattern inside a package
A library ships an indicator component; the app imports and lists it.
3. Local or app-specific indicator
Open questions (for discussion)
Big unknowns for me: how indicator trees get evaluated (sync vs normal client mount), and what you allow inside leaf components (hooks or not). That changes ergonomics and bundles a lot, so I would rather take guidance from people who ship this every day.
I also assume this stays dev-only in practice and lines up with existing knobs like devIndicators where that already exists.
I would ship a small surface first (menu items and labels). If that works, more ambitious devtools UI can follow.
Sketch implementation
I have a rough branch and a demo app so people can click around. Neither is a promise about the final API.
Fork: foxted/next.js feat/devtools-plugins
Demo: foxted/dev-indicators-demo
Notes
I have not contributed to Next.js before. If the direction (official extension hooks for dev tooling) is interesting but this shape is wrong, tell me what you would do instead. I am also curious whether next-devtools-style projects would benefit from a supported boundary here, or if maintainers prefer a different integration model.
Beta Was this translation helpful? Give feedback.
All reactions