# Dev Overlay ## Project Structure - `next-devtools/dev-overlay/` - The UI that Next.js developers can interact with in development. - `next-devtools/server/` - Code that runs in the Next.js development server. - `next-devtools/shared/` - Anything that doesn't fit in - `next-devtools/userspace/` - Code that runs in the user's application. Modules in `dev-overlay/` are isolated from the rest of the source. Any stateful module will not share state with e.g. `userspace/`. Stateful modules in `shared/` cannot be used to pass data from `dev-overlay/` to `userspace/` or vice versa. `userspace/` code can send messages to `dev-overlay/` via the `dispatcher` imported from `next/dist/compiled/next-devtools`. Keep processing in `userspace/` to a minimum and prefer deriving data in `dev-overlay/`. ## Development The dev overlay leverages [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM) to insert the dev overlay into the client without affecting the user's application through encapsulation from CSS. ### Local Development Next.js uses [Storybook](https://storybook.js.org) to develop UI components in the dev overlay. To run the dev overlay locally, you can run the following command: ```bash pnpm storybook ``` This will start the Storybook server at `http://localhost:6006`. ### Styling Next.js direcly injects CSS into the DOM via `