DevLens is a zero-config runtime error detection toolkit for JavaScript/TypeScript. It catches silent failures — null access, API errors, contract violations, hung promises — and surfaces them instantly with actionable context.
v3.0 "The Lens Update" is the biggest release yet: X-Ray Mode, Plugin Ecosystem, API Contract Guardian, AI Auto-Fix, Session Recording, Async Tracker, and framework-agnostic Web adapter.
npm install @devlens/core @devlens/react # React
npm install @devlens/core @devlens/vue # Vue
npm install @devlens/core @devlens/web # Vanilla / Web Components| Package | Version | Size | Description |
|---|---|---|---|
@devlens/core |
3.0.0 | ~22KB | Detection engine, plugins, interceptors, contract guardian, async tracker |
@devlens/react |
3.0.0 | ~5KB | React provider, error boundary, guarded hooks |
@devlens/vue |
2.0.0 | ~5KB | Vue 3 plugin, guarded composables |
@devlens/ui |
2.0.0 | ~102KB | Visual panel, X-Ray Mode, inspector, session recording |
@devlens/vite |
2.0.0 | — | Vite plugin — embedded dashboard at /__devlens__/ |
@devlens/dashboard |
2.0.0 | — | Standalone dashboard with AI analysis |
@devlens/web |
0.1.0 | ~3KB | Vanilla JS / Web Components adapter |
Hold Alt and hover over any element. DevLens highlights it and shows:
- Component name (React, Vue, or DOM tag)
- Props and state (extracted from React fiber / Vue instance)
- CSS classnames
- Related DevLens issues for that component
No browser extension. No DevTools panel. Just hold Alt and look.
import { createDevLensPanel } from '@devlens/ui';
const { panel, reporter } = createDevLensPanel({
xray: true, // enabled by default
});import { DevLensProvider, DevLensErrorBoundary } from '@devlens/react';
function App() {
return (
<DevLensProvider>
<DevLensErrorBoundary>
<YourApp />
</DevLensErrorBoundary>
</DevLensProvider>
);
}import { createApp } from 'vue';
import { createDevLensPlugin } from '@devlens/vue';
const app = createApp(App);
app.use(createDevLensPlugin());
app.mount('#app');import { initDevLens } from '@devlens/web';
const { engine, destroy } = initDevLens();
// Network interceptor + global catcher auto-installed[NET] DevLens [ERROR] network: POST /api/users returned 500 Internal Server Error
|- Duration: 1234ms
\- Suggestion: Server returned 500 - check server logs
const [user, setUser] = useGuardedState(initialUser, 'UserProfile');
// user.profile.avatar is null → DevLens logs:
// [NULL] DevLens [WARN] null-access: Property "avatar" is null at path "user.profile.avatar"import { createApiContractPlugin } from '@devlens/core';
engine.registerPlugin(createApiContractPlugin({
endpoints: ['/api/*'],
ignoreFields: ['timestamp'],
}));
// Auto-learns response shapes, alerts when fields disappear or change type:
// [CONTRACT] DevLens [WARN] api-contract: Field "avatar" disappeared from GET /api/users responseimport { createAsyncTrackerPlugin } from '@devlens/core';
engine.registerPlugin(createAsyncTrackerPlugin({
timeoutMs: 30000, // alert after 30s
}));
// [REJ] DevLens [WARN] Async operation "fetch GET /api/slow" pending for 31s — possible hung promiseDevLens is now a platform. Register plugins with lifecycle management:
import { createDetectionEngine, createApiContractPlugin, createAsyncTrackerPlugin } from '@devlens/core';
const engine = createDetectionEngine();
engine.registerPlugin(createApiContractPlugin());
engine.registerPlugin(createAsyncTrackerPlugin());
// Query plugins
engine.listPlugins(); // [contractPlugin, asyncPlugin]
engine.getPlugin('api-contract'); // contractPlugin
// Cleanup
engine.unregisterPlugin('async-tracker');
engine.destroy(); // tears down all pluginsWrite your own:
const myPlugin: DevLensPlugin = {
name: 'my-plugin',
version: '1.0.0',
setup(engine) {
// subscribe to issues, register interceptors, etc.
},
teardown() {
// cleanup
},
};
engine.registerPlugin(myPlugin);The dashboard AI doesn't just explain problems — it generates patches:
import { generatePatch } from '@devlens/dashboard';
const patch = await generatePatch(issue, 'gemini-2.5-flash');
// patch.file → "src/components/UserProfile.tsx"
// patch.diff → unified diff you can apply
// patch.explanation → "Add null check before accessing avatar"QA finds a bug. Instead of writing "I clicked the button and it broke", they export a .devlens file. Dev imports it and sees everything.
import { createSessionRecorder, exportSession } from '@devlens/ui';
const recorder = createSessionRecorder('session-123', engine.subscribe);
recorder.start();
// ... QA uses the app, issues are detected ...
// Export for dev team
exportSession(recorder.getSession());
// Downloads: devlens-session-session-123-1741700000.devlensImport in dashboard:
import { parseSessionFile, readFileAsText } from '@devlens/ui';
const text = await readFileAsText(file);
const { success, session, error } = parseSessionFile(text);import { createDevLensPanel } from '@devlens/ui';
const { panel, reporter } = createDevLensPanel({
position: 'bottom-right',
theme: 'dark',
hotkey: 'ctrl+shift+d',
dashboardUrl: '/__devlens__/', // opens full dashboard
xray: true,
});Panel features: Issue list, timeline view, severity/category filtering, search, JSON/CSV export, session persistence, X-Ray Mode.
Dashboard features: Full-screen issue explorer, AI analysis (Gemini/Claude/GPT), source code context, pattern detection.
// vite.config.ts
import devlens from '@devlens/vite';
export default {
plugins: [devlens()],
// Dashboard auto-available at http://localhost:5173/__devlens__/
};<DevLensProvider
config={{
enabled: true,
minSeverity: 'warn',
throttleMs: 1000,
maxIssues: 100,
modules: {
network: { fetch: true, xhr: true, ignoreUrls: ['/health'] },
guardian: { maxDepth: 5 },
catcher: { windowErrors: true, unhandledRejections: true },
},
ignore: { messages: [/ResizeObserver/] },
}}
>
<App />
</DevLensProvider>- Auto-disabled when
NODE_ENV === 'production' sideEffects: false— tree-shakeable- Zero overhead when disabled — provider renders children directly
- No data sent anywhere — everything stays in your browser
| Version | Feature | Status |
|---|---|---|
| v1.0 | Console logging — network, null detection, error boundaries | Done |
| v2.0 | UI panel overlay + Vue support + Inspector + Dashboard | Done |
| v3.0 | X-Ray Mode, Plugin System, API Contract, AI Auto-Fix, Session Recording, Async Tracker, @devlens/web | Current |
| v4.0 | Svelte/Solid/Angular adapters, browser extension, deeper AI integration | Planned |
Contributions welcome. Please open an issue first to discuss what you'd like to change.