
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
next-plugin-devtools-json
Advanced tools
Next.js plugin for generating the Chrome DevTools project settings file on-the-fly in the dev server
A Next.js plugin that provides a plug-and-play solution for serving a Chrome DevTools project settings JSON endpoint at /.well-known/appspecific/com.chrome.devtools.json. This plugin enables seamless integration between Chrome DevTools and your Next.js project workspace.
npxnext.config.jssrc/ directory structuresnpx next-plugin-devtools-json
That's it! This single command will:
next.config.js (or create one)Start your Next.js development server and the endpoint will be available at:
/.well-known/appspecific/com.chrome.devtools.json
If you prefer manual setup:
npm install next-plugin-devtools-json
Then update your next.config.js:
const withDevToolsJSON = require('next-plugin-devtools-json');
/** @type {import('next').NextConfig} */
const nextConfig = {
// your existing config
};
module.exports = withDevToolsJSON()(nextConfig);
And create the API route:
npx next-plugin-devtools-json
The plugin:
/.well-known/appspecific/com.chrome.devtools.json to your API route.next/cache/devtools-uuid.jsonconst withDevToolsJSON = require('next-plugin-devtools-json');
module.exports = withDevToolsJSON()(nextConfig);
const withDevToolsJSON = require('next-plugin-devtools-json');
module.exports = withDevToolsJSON({
uuid: 'your-custom-uuid', // Optional: provide a custom UUID
enabled: process.env.NODE_ENV === 'development', // Optional: only enable in development
})(nextConfig);
import withDevToolsJSON from 'next-plugin-devtools-json';
/** @type {import('next').NextConfig} */
const nextConfig = {
// your config
};
export default withDevToolsJSON()(nextConfig);
The plugin automatically detects and supports all common Next.js structures:
your-project/
├── app/api/devtools-json/route.js # Auto-created
└── next.config.js # Auto-updated
your-project/
├── src/app/api/devtools-json/route.js # Auto-created
└── next.config.js # Auto-updated
your-project/
├── pages/api/devtools-json.js # Auto-created
└── next.config.js # Auto-updated
your-project/
├── src/pages/api/devtools-json.js # Auto-created
└── next.config.js # Auto-updated
The endpoint returns a JSON response with your workspace information:
{
"workspace": {
"root": "/path/to/your/project",
"uuid": "generated-or-custom-uuid"
}
}
npm run build
npm test
If you previously set up the plugin manually:
npx next-plugin-devtools-json in your projectuuid dependencies if desired (the plugin includes its own generator)| Feature | Before | After |
|---|---|---|
| Setup steps | 5+ manual steps | 1 command |
| Dependencies | Requires uuid package | Zero dependencies |
| Config updates | Manual editing | Automatic |
| Structure detection | Manual | Automatic |
| File creation | Manual | Automatic |
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
app/api/devtools-json/route.js and pages/api/devtools-json.js patternsFor Pages Router, create pages/api/devtools-json.js:
import fs from 'fs';
import path from 'path';
import { v4, validate } from 'uuid';
async function getOrCreateUUID(projectRoot, providedUuid) {
if (providedUuid) {
return providedUuid;
}
const cacheDir = path.resolve(projectRoot, '.next', 'cache');
const uuidPath = path.resolve(cacheDir, 'devtools-uuid.json');
if (fs.existsSync(uuidPath)) {
try {
const uuidContent = fs.readFileSync(uuidPath, { encoding: 'utf-8' });
const uuid = uuidContent.trim();
if (validate(uuid)) {
return uuid;
}
} catch (error) {
console.warn('Failed to read existing UUID, generating new one:', error);
}
}
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir, { recursive: true });
}
const uuid = v4();
fs.writeFileSync(uuidPath, uuid, { encoding: 'utf-8' });
console.log(\`Generated UUID '\${uuid}' for DevTools project settings.\`);
return uuid;
}
export default async function handler(req, res) {
if (req.method !== 'GET') {
res.setHeader('Allow', ['GET']);
res.status(405).end(\`Method \${req.method} Not Allowed\`);
return;
}
try {
const projectRoot = process.cwd();
const uuid = await getOrCreateUUID(projectRoot);
const devtoolsJson = {
workspace: {
root: projectRoot,
uuid,
},
};
res.setHeader('Content-Type', 'application/json');
res.status(200).json(devtoolsJson);
} catch (error) {
console.error('Error generating DevTools JSON:', error);
res.status(500).json({});
}
}
For App Router, create app/api/devtools-json/route.js:
import fs from 'fs';
import path from 'path';
import { v4, validate } from 'uuid';
import { NextResponse } from 'next/server';
async function getOrCreateUUID(projectRoot, providedUuid) {
if (providedUuid) {
return providedUuid;
}
const cacheDir = path.resolve(projectRoot, '.next', 'cache');
const uuidPath = path.resolve(cacheDir, 'devtools-uuid.json');
if (fs.existsSync(uuidPath)) {
try {
const uuidContent = fs.readFileSync(uuidPath, { encoding: 'utf-8' });
const uuid = uuidContent.trim();
if (validate(uuid)) {
return uuid;
}
} catch (error) {
console.warn('Failed to read existing UUID, generating new one:', error);
}
}
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir, { recursive: true });
}
const uuid = v4();
fs.writeFileSync(uuidPath, uuid, { encoding: 'utf-8' });
console.log(\`Generated UUID '\${uuid}' for DevTools project settings.\`);
return uuid;
}
export async function GET() {
try {
const projectRoot = process.cwd();
const uuid = await getOrCreateUUID(projectRoot);
const devtoolsJson = {
workspace: {
root: projectRoot,
uuid,
},
};
return NextResponse.json(devtoolsJson, {
headers: {
'Content-Type': 'application/json',
},
});
} catch (error) {
console.error('Error generating DevTools JSON:', error);
return NextResponse.json({}, { status: 500 });
}
}
Don't forget to install the uuid dependency:
npm install uuid
The /.well-known/appspecific/com.chrome.devtools.json endpoint will serve the project settings as JSON with the following structure:
{
"workspace": {
"root": "/path/to/project/root",
"uuid": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"
}
}
where root is the absolute path to your project root folder, and uuid is a random v4 UUID, generated the first time that you start the Next.js dev server with the plugin installed (it is henceforth cached in the Next.js cache folder).
You can customize the plugin behavior:
const withDevToolsJSON = require('next-plugin-devtools-json');
module.exports = withDevToolsJSON({
uuid: 'custom-uuid-here', // Optional: provide a custom UUID
enabled: process.env.NODE_ENV === 'development', // Optional: control when enabled
})(nextConfig);
uuid (string, optional): Provide a custom UUID instead of auto-generating oneenabled (boolean, optional): Control when the plugin is active (defaults to development mode only)The package provides multiple ways to set up the API route:
npx next-plugin-devtools-json@latest
npm install next-plugin-devtools-json
npx setup-devtools-json
Both commands will:
src/ directory layoutsnext.config.jsThe UUID is stored in .next/cache/devtools-uuid.json. If this file gets deleted (e.g., when clearing the Next.js cache), a new UUID will be generated. You can provide a custom UUID in the plugin options to prevent this.
This is intentional! The plugin is designed for development use only. If you need it in production, set enabled: true in the plugin options.
MIT
FAQs
Next.js plugin for Chrome DevTools project settings - seamless development integration with rewrites and standalone server
The npm package next-plugin-devtools-json receives a total of 92 weekly downloads. As such, next-plugin-devtools-json popularity was classified as not popular.
We found that next-plugin-devtools-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.