[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"header-categories":3,"post-debugging-nodejs-applications-pro":73,"parsed-post-58d72280-be9f-423b-8bff-1d3cb19b4780":148},{"success":4,"data":5},true,{"items":6,"pagination":70},[7,16,24,32,40,48,56,63],{"id":8,"name":9,"description":10,"parentId":11,"createdAt":12,"updatedAt":12,"parent":11,"children":13,"_count":14},"ai-future","AI & The Future","Artificial intelligence and emerging technology",null,"2026-07-24T06:02:45.990Z",[],{"posts":15},1,{"id":17,"name":18,"description":19,"parentId":11,"createdAt":20,"updatedAt":20,"parent":11,"children":21,"_count":22},"tools-productivity","Tools & Productivity","Developer tools and workflow optimization","2026-07-24T06:02:45.712Z",[],{"posts":23},7,{"id":25,"name":26,"description":27,"parentId":11,"createdAt":28,"updatedAt":28,"parent":11,"children":29,"_count":30},"career","Career & Growth","Professional development for developers","2026-07-24T06:02:45.486Z",[],{"posts":31},3,{"id":33,"name":34,"description":35,"parentId":11,"createdAt":36,"updatedAt":36,"parent":11,"children":37,"_count":38},"opinion","Opinion & Analysis","Industry analysis and technical opinions","2026-07-24T06:02:45.272Z",[],{"posts":39},6,{"id":41,"name":42,"description":43,"parentId":11,"createdAt":44,"updatedAt":44,"parent":11,"children":45,"_count":46},"tutorials","Tutorials","Step-by-step learning guides","2026-07-24T06:02:44.965Z",[],{"posts":47},21,{"id":49,"name":50,"description":51,"parentId":11,"createdAt":52,"updatedAt":52,"parent":11,"children":53,"_count":54},"software-engineering","Software Engineering","Best practices, patterns, and principles","2026-07-24T06:02:44.689Z",[],{"posts":55},24,{"id":57,"name":58,"description":59,"parentId":11,"createdAt":60,"updatedAt":60,"parent":11,"children":61,"_count":62},"devops-cloud","DevOps & Cloud","Infrastructure, deployment, and cloud computing","2026-07-24T06:02:44.453Z",[],{"posts":39},{"id":64,"name":65,"description":66,"parentId":11,"createdAt":67,"updatedAt":67,"parent":11,"children":68,"_count":69},"web-development","Web Development","Frontend and backend web development tutorials and guides","2026-07-24T06:02:44.169Z",[],{"posts":55},{"page":15,"limit":71,"total":71,"totalPages":15,"hasNext":72,"hasPrev":72},8,false,{"success":4,"data":74},{"id":75,"slug":76,"title":77,"excerpt":78,"content":79,"status":80,"visibility":81,"featuredImage":82,"canonicalUrl":11,"readingTime":83,"viewCount":84,"commentEnabled":4,"publishedAt":85,"scheduledAt":11,"createdAt":86,"updatedAt":87,"seoTitle":88,"seoDescription":78,"seoKeywords":11,"authorId":89,"author":90,"coAuthors":95,"tags":96,"categories":112,"comments":115,"_count":116,"relatedPosts":118},"58d72280-be9f-423b-8bff-1d3cb19b4780","debugging-nodejs-applications-pro","Debugging Node.js Applications Like a Pro","Go beyond console.log. Master the Node.js debugger, memory profiling, async stack traces, and production debugging techniques.","## Beyond console.log\n\nConsole.log debugging works, but it's slow and messy. Professional debugging tools save hours.\n\n## The Built-In Debugger\n\n```bash\n# Start with debugger attached\nnode --inspect server.js\n\n# Break on first line\nnode --inspect-brk server.js\n```\n\nThen open `chrome:\u002F\u002Finspect` in Chrome, or use VS Code's debugger.\n\n## VS Code Launch Config\n\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug Nuxt\",\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"command\": \"pnpm dev\",\n      \"cwd\": \"${workspaceFolder}\",\n      \"console\": \"integratedTerminal\",\n      \"serverReadyAction\": {\n        \"pattern\": \"Local:.*?(https?:\u002F\u002F\\\\S+)\",\n        \"uriFormat\": \"%s\",\n        \"action\": \"debugWithChrome\"\n      }\n    }\n  ]\n}\n```\n\n## Conditional Breakpoints\n\nIn VS Code, right-click the gutter → \"Conditional Breakpoint\":\n\n```\n\u002F\u002F Only break when userId matches\nuserId === \"abc-123\"\n\n\u002F\u002F Only break on the 50th iteration\ni === 49\n\n\u002F\u002F Only break when error occurs\nerror !== null\n```\n\n## Async Stack Traces\n\n```bash\n# Enable long async stack traces\nnode --async-stack-traces server.js\n```\n\n```typescript\n\u002F\u002F Or in code\nError.stackTraceLimit = 50 \u002F\u002F Default is 10\n```\n\n::callout{icon=\"i-lucide-bug\" color=\"primary\"}\nWithout async stack traces, errors in promises just show the immediate location. Enable them to see the full chain of async calls that led to the error.\n::\n\n## Memory Leak Detection\n\n```bash\n# Generate a heap snapshot\nnode --inspect server.js\n# Then in Chrome DevTools: Memory tab → Take Heap Snapshot\n```\n\nCommon leak sources:\n- Event listeners never removed\n- Growing Maps\u002FSets without cleanup\n- Closures capturing large objects\n- Timers\u002Fintervals not cleared\n\n```typescript\n\u002F\u002F Quick leak detector\nfunction trackMemory(label: string) {\n  const usage = process.memoryUsage()\n  console.log(`[${label}] Heap: ${Math.round(usage.heapUsed \u002F 1024 \u002F 1024)}MB`)\n}\n\nsetInterval(() => trackMemory('periodic'), 10000)\n```\n\n## Performance Profiling\n\n```bash\n# CPU profile for 5 seconds\nnode --prof server.js\n# Process the output\nnode --prof-process isolate-*.log > profile.txt\n```\n\nOr use the built-in profiler:\n\n```typescript\nimport { performance, PerformanceObserver } from 'node:perf_hooks'\n\nperformance.mark('start-db')\nconst users = await db.user.findMany()\nperformance.mark('end-db')\nperformance.measure('db-query', 'start-db', 'end-db')\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((entry) => {\n    console.log(`${entry.name}: ${entry.duration.toFixed(2)}ms`)\n  })\n})\nobs.observe({ entryTypes: ['measure'] })\n```\n\n## Production Debugging\n\nWhen you can't attach a debugger:\n\n```typescript\n\u002F\u002F 1. Structured logging with request IDs\nfunction createRequestLogger(requestId: string) {\n  return {\n    info: (msg: string, data?: unknown) =>\n      console.log(JSON.stringify({ requestId, level: 'info', msg, data })),\n    error: (msg: string, error?: Error) =>\n      console.error(JSON.stringify({ requestId, level: 'error', msg, stack: error?.stack })),\n  }\n}\n\n\u002F\u002F 2. Debug endpoint (protected!)\napp.get('\u002Fdebug\u002Fhealth', requireAdmin, (req, res) => {\n  res.json({\n    uptime: process.uptime(),\n    memory: process.memoryUsage(),\n    cpu: process.cpuUsage(),\n    connections: server.connections,\n  })\n})\n```\n\n## Tips\n\n- Use `debugger` statement for quick breakpoints\n- `console.table()` for arrays of objects\n- `console.trace()` for quick stack traces\n- `console.time()` \u002F `console.timeEnd()` for timing\n- `util.inspect(obj, { depth: null })` for deep objects\n\nThe fastest path to fixing a bug is understanding how to reproduce it and inspect the state at the right moment.\n","published","public","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1618477388954-7852f32655ec?w=1200&q=80",9,1038,"2026-04-30T06:04:26.346Z","2026-07-24T06:04:26.348Z","2026-07-28T13:22:15.462Z","Debugging Node.js Applications Like a Pro | BitBlog","fddb5d93-7a2c-4d86-a06a-fa32e73a01c6",{"email":91,"bio":92,"id":89,"name":93,"avatarUrl":94},"mbeahessilfieprince@gmail.com","Fullstack Software Developer ","Mbeah Essilfie","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F93322394?v=4",[],[97,102,107],{"id":98,"name":99,"color":100,"description":101},"javascript","JavaScript","#f7df1e","The language of the web",{"id":103,"name":104,"color":105,"description":106},"nodejs","Node.js","#339933","JavaScript runtime built on V8",{"id":108,"name":109,"color":110,"description":111},"performance","Performance","#e535ab","Web performance optimization",[113,114],{"id":41,"name":42,"description":43},{"id":17,"name":18,"description":19},[],{"comments":117},0,[119,128,138],{"id":120,"slug":121,"title":122,"excerpt":123,"featuredImage":124,"viewCount":125,"readingTime":71,"publishedAt":126,"author":127},"2997028f-4d22-4eb7-9d86-894a54cb559a","building-type-safe-apis-nuxt3-prisma","Building Type-Safe APIs with Nuxt 3 and Prisma","Learn how to build end-to-end type-safe APIs using Nuxt 3 server routes and Prisma ORM for a seamless developer experience.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1498050108023-c5249f4df085?w=1200&q=80",1922,"2026-07-23T06:02:46.910Z",{"id":89,"name":93,"avatarUrl":94},{"id":129,"slug":130,"title":131,"excerpt":132,"featuredImage":133,"viewCount":134,"readingTime":135,"publishedAt":136,"author":137},"da9e4553-8b0d-411e-b4ec-f9684017e163","mastering-tailwind-css-design-systems","Mastering Tailwind CSS: From Utility Classes to Design Systems","Go beyond basic utility classes and learn how to build cohesive, maintainable design systems with Tailwind CSS.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1555066931-4365d14bab8c?w=1200&q=80",257,10,"2026-07-21T06:02:49.268Z",{"id":89,"name":93,"avatarUrl":94},{"id":139,"slug":140,"title":141,"excerpt":142,"featuredImage":143,"viewCount":144,"readingTime":145,"publishedAt":146,"author":147},"50add5fc-4026-4267-b917-7f71ea9e35b0","complete-guide-vue3-composables","The Complete Guide to Vue 3 Composables","Understand the power of Vue 3's Composition API through practical, real-world composable patterns that you can use today.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1517694712202-14dd9538aa97?w=1200&q=80",990,12,"2026-07-19T06:02:51.753Z",{"id":89,"name":93,"avatarUrl":94},{"data":149,"body":151,"toc":455},{"title":150,"description":150},"",{"type":152,"children":153},"root",[154,163,169,175,188,201,207,217,223,228,238,244,252,262,273,279,287,292,317,325,331,339,344,352,358,363,371,377,445,450],{"type":155,"tag":156,"props":157,"children":159},"element","h2",{"id":158},"beyond-consolelog",[160],{"type":161,"value":162},"text","Beyond console.log",{"type":155,"tag":164,"props":165,"children":166},"p",{},[167],{"type":161,"value":168},"Console.log debugging works, but it's slow and messy. Professional debugging tools save hours.",{"type":155,"tag":156,"props":170,"children":172},{"id":171},"the-built-in-debugger",[173],{"type":161,"value":174},"The Built-In Debugger",{"type":155,"tag":176,"props":177,"children":182},"pre",{"className":178,"code":179,"language":180,"meta":150,"style":181},"language-bash","# Start with debugger attached\nnode --inspect server.js\n\n# Break on first line\nnode --inspect-brk server.js\n","bash","undefined",[183],{"type":155,"tag":184,"props":185,"children":186},"code",{"__ignoreMap":150},[187],{"type":161,"value":179},{"type":155,"tag":164,"props":189,"children":190},{},[191,193,199],{"type":161,"value":192},"Then open ",{"type":155,"tag":184,"props":194,"children":196},{"className":195},[],[197],{"type":161,"value":198},"chrome:\u002F\u002Finspect",{"type":161,"value":200}," in Chrome, or use VS Code's debugger.",{"type":155,"tag":156,"props":202,"children":204},{"id":203},"vs-code-launch-config",[205],{"type":161,"value":206},"VS Code Launch Config",{"type":155,"tag":176,"props":208,"children":212},{"className":209,"code":210,"language":211,"meta":150,"style":181},"language-json","{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug Nuxt\",\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"command\": \"pnpm dev\",\n      \"cwd\": \"${workspaceFolder}\",\n      \"console\": \"integratedTerminal\",\n      \"serverReadyAction\": {\n        \"pattern\": \"Local:.*?(https?:\u002F\u002F\\\\S+)\",\n        \"uriFormat\": \"%s\",\n        \"action\": \"debugWithChrome\"\n      }\n    }\n  ]\n}\n","json",[213],{"type":155,"tag":184,"props":214,"children":215},{"__ignoreMap":150},[216],{"type":161,"value":210},{"type":155,"tag":156,"props":218,"children":220},{"id":219},"conditional-breakpoints",[221],{"type":161,"value":222},"Conditional Breakpoints",{"type":155,"tag":164,"props":224,"children":225},{},[226],{"type":161,"value":227},"In VS Code, right-click the gutter → \"Conditional Breakpoint\":",{"type":155,"tag":176,"props":229,"children":233},{"className":230,"code":232,"language":161},[231],"language-text","\u002F\u002F Only break when userId matches\nuserId === \"abc-123\"\n\n\u002F\u002F Only break on the 50th iteration\ni === 49\n\n\u002F\u002F Only break when error occurs\nerror !== null\n",[234],{"type":155,"tag":184,"props":235,"children":236},{"__ignoreMap":150},[237],{"type":161,"value":232},{"type":155,"tag":156,"props":239,"children":241},{"id":240},"async-stack-traces",[242],{"type":161,"value":243},"Async Stack Traces",{"type":155,"tag":176,"props":245,"children":247},{"className":178,"code":246,"language":180,"meta":150,"style":181},"# Enable long async stack traces\nnode --async-stack-traces server.js\n",[248],{"type":155,"tag":184,"props":249,"children":250},{"__ignoreMap":150},[251],{"type":161,"value":246},{"type":155,"tag":176,"props":253,"children":257},{"className":254,"code":255,"language":256,"meta":150,"style":181},"language-typescript","\u002F\u002F Or in code\nError.stackTraceLimit = 50 \u002F\u002F Default is 10\n","typescript",[258],{"type":155,"tag":184,"props":259,"children":260},{"__ignoreMap":150},[261],{"type":161,"value":255},{"type":155,"tag":263,"props":264,"children":267},"callout",{"color":265,"icon":266},"primary","i-lucide-bug",[268],{"type":155,"tag":164,"props":269,"children":270},{},[271],{"type":161,"value":272},"Without async stack traces, errors in promises just show the immediate location. Enable them to see the full chain of async calls that led to the error.",{"type":155,"tag":156,"props":274,"children":276},{"id":275},"memory-leak-detection",[277],{"type":161,"value":278},"Memory Leak Detection",{"type":155,"tag":176,"props":280,"children":282},{"className":178,"code":281,"language":180,"meta":150,"style":181},"# Generate a heap snapshot\nnode --inspect server.js\n# Then in Chrome DevTools: Memory tab → Take Heap Snapshot\n",[283],{"type":155,"tag":184,"props":284,"children":285},{"__ignoreMap":150},[286],{"type":161,"value":281},{"type":155,"tag":164,"props":288,"children":289},{},[290],{"type":161,"value":291},"Common leak sources:",{"type":155,"tag":293,"props":294,"children":295},"ul",{},[296,302,307,312],{"type":155,"tag":297,"props":298,"children":299},"li",{},[300],{"type":161,"value":301},"Event listeners never removed",{"type":155,"tag":297,"props":303,"children":304},{},[305],{"type":161,"value":306},"Growing Maps\u002FSets without cleanup",{"type":155,"tag":297,"props":308,"children":309},{},[310],{"type":161,"value":311},"Closures capturing large objects",{"type":155,"tag":297,"props":313,"children":314},{},[315],{"type":161,"value":316},"Timers\u002Fintervals not cleared",{"type":155,"tag":176,"props":318,"children":320},{"className":254,"code":319,"language":256,"meta":150,"style":181},"\u002F\u002F Quick leak detector\nfunction trackMemory(label: string) {\n  const usage = process.memoryUsage()\n  console.log(`[${label}] Heap: ${Math.round(usage.heapUsed \u002F 1024 \u002F 1024)}MB`)\n}\n\nsetInterval(() => trackMemory('periodic'), 10000)\n",[321],{"type":155,"tag":184,"props":322,"children":323},{"__ignoreMap":150},[324],{"type":161,"value":319},{"type":155,"tag":156,"props":326,"children":328},{"id":327},"performance-profiling",[329],{"type":161,"value":330},"Performance Profiling",{"type":155,"tag":176,"props":332,"children":334},{"className":178,"code":333,"language":180,"meta":150,"style":181},"# CPU profile for 5 seconds\nnode --prof server.js\n# Process the output\nnode --prof-process isolate-*.log > profile.txt\n",[335],{"type":155,"tag":184,"props":336,"children":337},{"__ignoreMap":150},[338],{"type":161,"value":333},{"type":155,"tag":164,"props":340,"children":341},{},[342],{"type":161,"value":343},"Or use the built-in profiler:",{"type":155,"tag":176,"props":345,"children":347},{"className":254,"code":346,"language":256,"meta":150,"style":181},"import { performance, PerformanceObserver } from 'node:perf_hooks'\n\nperformance.mark('start-db')\nconst users = await db.user.findMany()\nperformance.mark('end-db')\nperformance.measure('db-query', 'start-db', 'end-db')\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((entry) => {\n    console.log(`${entry.name}: ${entry.duration.toFixed(2)}ms`)\n  })\n})\nobs.observe({ entryTypes: ['measure'] })\n",[348],{"type":155,"tag":184,"props":349,"children":350},{"__ignoreMap":150},[351],{"type":161,"value":346},{"type":155,"tag":156,"props":353,"children":355},{"id":354},"production-debugging",[356],{"type":161,"value":357},"Production Debugging",{"type":155,"tag":164,"props":359,"children":360},{},[361],{"type":161,"value":362},"When you can't attach a debugger:",{"type":155,"tag":176,"props":364,"children":366},{"className":254,"code":365,"language":256,"meta":150,"style":181},"\u002F\u002F 1. Structured logging with request IDs\nfunction createRequestLogger(requestId: string) {\n  return {\n    info: (msg: string, data?: unknown) =>\n      console.log(JSON.stringify({ requestId, level: 'info', msg, data })),\n    error: (msg: string, error?: Error) =>\n      console.error(JSON.stringify({ requestId, level: 'error', msg, stack: error?.stack })),\n  }\n}\n\n\u002F\u002F 2. Debug endpoint (protected!)\napp.get('\u002Fdebug\u002Fhealth', requireAdmin, (req, res) => {\n  res.json({\n    uptime: process.uptime(),\n    memory: process.memoryUsage(),\n    cpu: process.cpuUsage(),\n    connections: server.connections,\n  })\n})\n",[367],{"type":155,"tag":184,"props":368,"children":369},{"__ignoreMap":150},[370],{"type":161,"value":365},{"type":155,"tag":156,"props":372,"children":374},{"id":373},"tips",[375],{"type":161,"value":376},"Tips",{"type":155,"tag":293,"props":378,"children":379},{},[380,393,404,415,434],{"type":155,"tag":297,"props":381,"children":382},{},[383,385,391],{"type":161,"value":384},"Use ",{"type":155,"tag":184,"props":386,"children":388},{"className":387},[],[389],{"type":161,"value":390},"debugger",{"type":161,"value":392}," statement for quick breakpoints",{"type":155,"tag":297,"props":394,"children":395},{},[396,402],{"type":155,"tag":184,"props":397,"children":399},{"className":398},[],[400],{"type":161,"value":401},"console.table()",{"type":161,"value":403}," for arrays of objects",{"type":155,"tag":297,"props":405,"children":406},{},[407,413],{"type":155,"tag":184,"props":408,"children":410},{"className":409},[],[411],{"type":161,"value":412},"console.trace()",{"type":161,"value":414}," for quick stack traces",{"type":155,"tag":297,"props":416,"children":417},{},[418,424,426,432],{"type":155,"tag":184,"props":419,"children":421},{"className":420},[],[422],{"type":161,"value":423},"console.time()",{"type":161,"value":425}," \u002F ",{"type":155,"tag":184,"props":427,"children":429},{"className":428},[],[430],{"type":161,"value":431},"console.timeEnd()",{"type":161,"value":433}," for timing",{"type":155,"tag":297,"props":435,"children":436},{},[437,443],{"type":155,"tag":184,"props":438,"children":440},{"className":439},[],[441],{"type":161,"value":442},"util.inspect(obj, { depth: null })",{"type":161,"value":444}," for deep objects",{"type":155,"tag":164,"props":446,"children":447},{},[448],{"type":161,"value":449},"The fastest path to fixing a bug is understanding how to reproduce it and inspect the state at the right moment.",{"type":155,"tag":451,"props":452,"children":453},"style",{},[454],{"type":161,"value":150},{"title":150,"searchDepth":456,"depth":456,"links":457},2,[458,459,460,461,462,463,464,465,466],{"id":158,"depth":456,"text":162},{"id":171,"depth":456,"text":174},{"id":203,"depth":456,"text":206},{"id":219,"depth":456,"text":222},{"id":240,"depth":456,"text":243},{"id":275,"depth":456,"text":278},{"id":327,"depth":456,"text":330},{"id":354,"depth":456,"text":357},{"id":373,"depth":456,"text":376}]