Skip to content

How-to · @faultatlas/dev-next

Connect local debugging to Next.js

Use the browser client adapter and server environment inspection in a Next.js application.

The Next.js adapter separates browser error listeners from server environment inspection. The client adapter uses the shared dev-adapter lifecycle and remains independent from production telemetry.

Select the runtime entry point

Import the client adapter in a Client Component and call getSafeServerEnv from the server subpath in server-only code. Only the client adapter has a lifecycle: server environment filtering is a plain function with no start or stop state.

import { createNextClientAdapter } from "@faultatlas/dev-next";
import { getSafeServerEnv } from "@faultatlas/dev-next/server";

const client = createNextClientAdapter({
  onError: (error) => console.warn("Next.js client error captured", error),
});
const safeEnv = getSafeServerEnv(process.env);

client.start();
const { NODE_ENV: nodeEnv } = safeEnv;
console.info("Next.js server environment ready", { nodeEnv });

The server function returns only allowlisted public configuration. It excludes credentials and arbitrary environment values. Register application state through the debug runtime.