← 返回
开发者工具

Node Auto Debugger

Scan Node.js/Express/Next.js projects for bugs, security issues, and anti-patterns. Use when debugging a Node.js web app, running code audits, fixing client-...
扫描 Node.js/Express/Next.js 项目中的错误、安全漏洞与反模式。适用于调试 Node.js 应用、执行代码审计及修复问题。
jengajojo
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 781
下载
💾 44
安装
1
版本
#latest

概述

Node.js Auto Debugger

Automated scanner for Node.js projects — finds bugs across backend, frontend, and config.

Quick Start

node scripts/auto-debug.js <project-dir>

Options:

  • --build — Also run npm run build and capture compilation errors

What It Checks

Backend (Express/Fastify)

  • Undefined variables.push() on undeclared variables
  • Missing try/catch — async route handlers without error handling
  • Hardcoded secrets — API keys, private keys, passwords in source

Frontend (Next.js/React)

  • Missing 'use client' — hooks or browser APIs without directive
  • Hydration risksDate.now(), Math.random() in render (should be in useEffect or useState)
  • SSR crasheswindow/document access outside useEffect
  • Missing loading states — wagmi hooks without isLoading/isFetching

Config

  • Missing next.config.js — defaults warning
  • Missing build script — package.json validation

Output

Report saved to /AUTO-DEBUG-REPORT.md with issues grouped by severity:

  • 🔴 Critical — will crash or leak secrets
  • 🟠 High — likely runtime errors
  • 🟡 Medium — hydration mismatches, missing loading states
  • 🟢 Low — minor issues

Exit code: 1 if any critical issues found, 0 otherwise.

Fixing Hydration Issues (Next.js)

Date.now()/new Date() in render:

// ❌ Bad — causes hydration mismatch
const now = Math.floor(Date.now() / 1000);

// ✅ Good — guard with isMounted
const [isMounted, setIsMounted] = useState(false);
useEffect(() => { setIsMounted(true); }, []);
const now = isMounted ? Math.floor(Date.now() / 1000) : 0;

Math.random() in render:

// ❌ Bad — different on server vs client
<div style={{ left: `${Math.random() * 100}%` }} />

// ✅ Good — pre-generate in useState (runs once)
const [particles] = useState(() =>
  Array.from({ length: 10 }, () => ({
    left: `${Math.random() * 100}%`,
  }))
);

window/document access:

// ❌ Bad — crashes during SSR
const width = window.innerWidth;

// ✅ Good — only after mount
const [width, setWidth] = useState(0);
useEffect(() => setWidth(window.innerWidth), []);

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-20 06:53 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 920 📥 185,727
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 65 📥 179,842
security-compliance

Auto Bug Finder

jengajojo
使用Hardhat和Slither迭代扫描、分析、修复并验证Solidity合约,直至消除所有关键、高危及中危安全漏洞或达到上限
★ 0 📥 627