Start Node.js in debug mode and break before user code starts
π¦ Node.js-> Command Line
β¨ The Prompt Phrase
node --inspect-brk app.js
π» Code Preview
π¦ All-in-One Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>node --inspect-brk app.js - Start Node.js in debug mode and break before user code starts - Interactive Tutorial</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&family=Fira+Code:wght@400;500&display=swap" rel="stylesheet">
<style>
:root {
--bg-primary: #0a0e27;
--bg-secondary: #151932;
--bg-card: #1e2139;
--accent-purple: #a855f7;
--accent-blue: #3b82f6;
--accent-green: #10b981;
--accent-red: #ef4444;
--accent-yellow: #f59e0b;
--accent-orange: #f97316;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
--gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
--gradient-debug: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
--shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
line-height: 1.6;
overflow-x: hidden;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* Hero Section */
.hero {
text-align: center;
padding: 100px 20px;
background: var(--gradient-debug);
position: relative;
overflow: hidden;
}
.hero::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>');
animation: float 20s linear infinite;
}
@keyframes float {
from { transform: translateY(0); }
to { transform: translateY(-100px); }
}
.hero-content {
position: relative;
z-index: 1;
}
.command-display {
display: inline-block;
background: rgba(0, 0, 0, 0.3);
padding: 20px 40px;
border-radius: 15px;
font-family: 'Fira Code', monospace;
font-size: 1.8rem;
margin: 30px 0;
border: 2px solid rgba(255, 255, 255, 0.2);
animation: pulse 2s ease-in-out infinite;
word-break: break-all;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.hero h1 {
font-size: 3rem;
font-weight: 700;
margin-bottom: 20px;
animation: slideDown 0.8s ease-out;
}
.hero p {
font-size: 1.3rem;
opacity: 0.95;
animation: slideUp 0.8s ease-out;
}
@keyframes slideDown {
from { transform: translateY(-50px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes slideUp {
from { transform: translateY(50px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
/* Progress Bar */
.progress-container {
position: sticky;
top: 0;
width: 100%;
height: 5px;
background: var(--bg-secondary);
z-index: 1000;
}
.progress-bar {
height: 100%;
background: var(--gradient-3);
width: 0%;
transition: width 0.3s ease;
}
/* Section Styles */
.section {
margin: 60px 0;
animation: fadeIn 0.8s ease-out;
animation-fill-mode: both;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
.section-title {
font-size: 2.5rem;
margin-bottom: 30px;
background: var(--gradient-3);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
display: inline-block;
}
.card {
background: var(--bg-card);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
box-shadow: var(--shadow);
border: 1px solid rgba(255, 255, 255, 0.05);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
}
/* Code Block */
.code-block {
background: #1e1e1e;
border-radius: 15px;
padding: 25px;
margin: 20px 0;
position: relative;
overflow: hidden;
font-family: 'Fira Code', monospace;
}
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.code-lang {
color: var(--accent-green);
font-weight: 600;
}
.copy-btn {
background: var(--accent-purple);
color: white;
border: none;
padding: 8px 16px;
border-radius: 8px;
cursor: pointer;
font-size: 0.9rem;
transition: all 0.3s ease;
}
.copy-btn:hover {
background: var(--accent-blue);
transform: scale(1.05);
}
.copy-btn.copied {
background: var(--accent-green);
}
pre {
margin: 0;
overflow-x: auto;
}
code {
color: #e0e0e0;
font-size: 0.95rem;
line-height: 1.6;
}
.code-comment {
color: #6a9955;
}
.code-keyword {
color: #569cd6;
}
.code-string {
color: #ce9178;
}
.code-function {
color: #dcdcaa;
}
.code-number {
color: #b5cea8;
}
/* Steps */
.steps {
counter-reset: step-counter;
}
.step {
background: var(--bg-secondary);
border-radius: 15px;
padding: 30px;
margin: 20px 0;
position: relative;
padding-left: 80px;
transition: all 0.3s ease;
}
.step:hover {
background: var(--bg-card);
transform: translateX(10px);
}
.step::before {
counter-increment: step-counter;
content: counter(step-counter);
position: absolute;
left: 20px;
top: 50%;
transform: translateY(-50%);
width: 50px;
height: 50px;
background: var(--gradient-debug);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
font-weight: 700;
}
.step h3 {
color: var(--accent-orange);
margin-bottom: 10px;
}
/* Interactive Demo */
.demo-container {
background: var(--bg-secondary);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
}
.terminal {
background: #1e1e1e;
border-radius: 15px;
padding: 20px;
font-family: 'Fira Code', monospace;
margin: 20px 0;
min-height: 150px;
}
.terminal-header {
display: flex;
gap: 8px;
margin-bottom: 15px;
}
.terminal-dot {
width: 12px;
height: 12px;
border-radius: 50%;
}
.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }
.terminal-content {
color: #e0e0e0;
line-height: 1.8;
}
.terminal-prompt {
color: var(--accent-green);
}
.terminal-command {
color: var(--accent-blue);
}
.demo-button {
background: var(--gradient-debug);
color: white;
border: none;
padding: 15px 40px;
border-radius: 50px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 10px;
margin: 10px;
}
.demo-button:hover {
transform: scale(1.05);
box-shadow: 0 10px 30px rgba(249, 115, 22, 0.4);
}
/* Tabs */
.tabs {
display: flex;
gap: 10px;
margin-bottom: 20px;
flex-wrap: wrap;
}
.tab {
padding: 12px 24px;
background: var(--bg-secondary);
border: none;
border-radius: 10px;
color: var(--text-primary);
cursor: pointer;
transition: all 0.3s ease;
font-size: 1rem;
}
.tab:hover {
background: var(--bg-card);
}
.tab.active {
background: var(--gradient-debug);
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
animation: fadeIn 0.5s ease-out;
}
/* Accordion */
.accordion-header {
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
background: var(--bg-secondary);
border-radius: 12px;
margin: 15px 0;
transition: all 0.3s ease;
}
.accordion-header:hover {
background: var(--bg-card);
}
.accordion-icon {
transition: transform 0.3s ease;
font-size: 1.2rem;
}
.accordion-icon.active {
transform: rotate(180deg);
}
.accordion-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease;
}
.accordion-content.active {
max-height: 2000px;
}
.accordion-body {
padding: 20px;
background: var(--bg-secondary);
border-radius: 12px;
margin-top: 5px;
}
/* Tips */
.tip {
background: rgba(59, 130, 246, 0.1);
border-left: 4px solid var(--accent-blue);
padding: 20px;
border-radius: 10px;
margin: 20px 0;
}
.tip::before {
content: 'π‘ ';
font-size: 1.5rem;
}
.warning {
background: rgba(239, 68, 68, 0.1);
border-left: 4px solid #ef4444;
padding: 20px;
border-radius: 10px;
margin: 20px 0;
}
.warning::before {
content: 'β οΈ ';
font-size: 1.5rem;
}
.success {
background: rgba(16, 185, 129, 0.1);
border-left: 4px solid var(--accent-green);
padding: 20px;
border-radius: 10px;
margin: 20px 0;
}
.success::before {
content: 'β
';
font-size: 1.5rem;
}
.info {
background: rgba(249, 115, 22, 0.1);
border-left: 4px solid var(--accent-orange);
padding: 20px;
border-radius: 10px;
margin: 20px 0;
}
.info::before {
content: 'π ';
font-size: 1.5rem;
}
/* Quiz */
.quiz-container {
background: var(--bg-card);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
}
.quiz-question {
margin: 30px 0;
}
.quiz-question h3 {
color: var(--accent-purple);
margin-bottom: 20px;
}
.quiz-options {
display: flex;
flex-direction: column;
gap: 15px;
}
.quiz-option {
background: var(--bg-secondary);
padding: 20px;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
border: 2px solid transparent;
}
.quiz-option:hover {
border-color: var(--accent-blue);
transform: translateX(10px);
}
.quiz-option.correct {
border-color: var(--accent-green);
background: rgba(16, 185, 129, 0.1);
}
.quiz-option.incorrect {
border-color: #ef4444;
background: rgba(239, 68, 68, 0.1);
}
.quiz-feedback {
margin-top: 15px;
padding: 15px;
border-radius: 10px;
display: none;
}
.quiz-feedback.show {
display: block;
animation: slideIn 0.5s ease-out;
}
@keyframes slideIn {
from { opacity: 0; transform: translateX(-20px); }
to { opacity: 1; transform: translateX(0); }
}
.quiz-feedback.correct {
background: rgba(16, 185, 129, 0.1);
border-left: 4px solid var(--accent-green);
}
.quiz-feedback.incorrect {
background: rgba(239, 68, 68, 0.1);
border-left: 4px solid #ef4444;
}
/* Cheat Sheet */
.cheat-sheet {
background: var(--gradient-debug);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
}
.cheat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-top: 30px;
}
.cheat-item {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
padding: 20px;
border-radius: 15px;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.cheat-item h4 {
color: var(--accent-green);
margin-bottom: 10px;
}
.badge {
display: inline-block;
padding: 5px 15px;
background: var(--gradient-2);
border-radius: 20px;
font-size: 0.85rem;
font-weight: 600;
margin: 5px;
}
.highlight {
color: var(--accent-orange);
font-weight: 600;
}
.comparison-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
.comparison-table th,
.comparison-table td {
padding: 15px;
text-align: left;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.comparison-table th {
background: var(--bg-secondary);
color: var(--accent-orange);
font-weight: 600;
}
.comparison-table tr:hover {
background: rgba(255, 255, 255, 0.05);
}
/* Footer */
.footer {
text-align: center;
padding: 40px 20px;
background: var(--bg-secondary);
margin-top: 80px;
}
.footer p {
color: var(--text-secondary);
margin: 10px 0;
}
/* Confetti */
.confetti {
position: fixed;
width: 10px;
height: 10px;
z-index: 9999;
}
@keyframes confetti-fall {
to {
transform: translateY(100vh) rotate(360deg);
opacity: 0;
}
}
/* Debugger Visual */
.debugger-visual {
background: var(--bg-secondary);
border-radius: 15px;
padding: 30px;
margin: 30px 0;
border: 2px solid var(--accent-orange);
}
.breakpoint {
display: inline-block;
width: 20px;
height: 20px;
background: var(--accent-red);
border-radius: 50%;
margin-right: 10px;
animation: blink 1.5s infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
/* Responsive */
@media (max-width: 768px) {
.hero h1 {
font-size: 2rem;
}
.command-display {
font-size: 1.2rem;
padding: 15px 25px;
}
.hero p {
font-size: 1rem;
}
.section-title {
font-size: 1.8rem;
}
.card {
padding: 25px;
}
.step {
padding-left: 70px;
}
.step::before {
width: 40px;
height: 40px;
font-size: 1.2rem;
}
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="progressBar"></div>
</div>
<div class="hero">
<div class="hero-content">
<h1>π Master Node.js Debugging</h1>
<div class="command-display">node --inspect-brk app.js</div>
<p>Debug like a pro with breakpoints from the start! π</p>
</div>
</div>
<div class="container">
<!-- What Is It Section -->
<section class="section" id="what-is-it">
<h2 class="section-title">π€ What Is It?</h2>
<div class="card">
<p style="font-size: 1.2rem; margin-bottom: 20px;">
<strong>node --inspect-brk app.js</strong> is like having a <span class="highlight">pause button</span> at the very beginning of your code! βΈοΈ
</p>
<p style="margin-bottom: 20px;">
This command starts your Node.js application in <strong>debug mode</strong> with the debugger <strong>paused at the first line</strong> of your code. It's perfect for catching bugs that happen early in your application's lifecycle!
</p>
<div class="info">
<strong>Think of it like this:</strong> Imagine watching a movie frame-by-frame from the very first scene. That's what <code>--inspect-brk</code> does for your code! π¬
</div>
<p style="margin-top: 20px;">
The <code>--inspect-brk</code> flag combines two powerful features:
</p>
<ul style="margin-left: 30px; margin-top: 15px; line-height: 2;">
<li><strong>--inspect</strong>: Enables the debugger (connects to Chrome DevTools)</li>
<li><strong>brk</strong> (break): Pauses execution before your code starts running</li>
</ul>
</div>
</section>
<!-- Why Use It Section -->
<section class="section" id="why-use-it">
<h2 class="section-title">β¨ Why Use It?</h2>
<div class="card">
<div class="cheat-grid">
<div class="cheat-item">
<h4>π― Catch Early Bugs</h4>
<p>Debug issues that happen during initialization before they cause problems!</p>
</div>
<div class="cheat-item">
<h4>π Step Through Code</h4>
<p>Execute your code line-by-line to understand exactly what's happening.</p>
</div>
<div class="cheat-item">
<h4>π Inspect Variables</h4>
<p>See the values of variables at any point in your code's execution.</p>
</div>
<div class="cheat-item">
<h4>
Live Preview