Initialize a new Node.js project with package.json

📦 Node.js-> Command Line
✨ The Prompt Phrase
npm init

💻 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>npm init - Initialize a new Node.js project with package.json - 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-yellow: #f59e0b;
            --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%);
            --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-1);
            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: 2.5rem;
            margin: 30px 0;
            border: 2px solid rgba(255, 255, 255, 0.2);
            animation: pulse 2s ease-in-out infinite;
        }

        @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;
        }

        /* 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-1);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            font-weight: 700;
        }

        .step h3 {
            color: var(--accent-blue);
            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;
        }

        .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;
        }

        .terminal-prompt {
            color: var(--accent-green);
        }

        .terminal-command {
            color: var(--accent-blue);
        }

        .terminal-output {
            color: var(--text-secondary);
            margin-top: 10px;
        }

        .demo-button {
            background: var(--gradient-1);
            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;
        }

        .demo-button:hover {
            transform: scale(1.05);
            box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4);
        }

        .demo-button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* 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-1);
        }

        .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;
        }

        /* 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-1);
            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-green);
            font-weight: 600;
        }

        /* 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;
            background: var(--accent-purple);
            position: absolute;
            animation: confetti-fall 3s linear forwards;
        }

        @keyframes confetti-fall {
            to {
                transform: translateY(100vh) rotate(360deg);
                opacity: 0;
            }
        }

        /* Responsive */
        @media (max-width: 768px) {
            .hero h1 {
                font-size: 2rem;
            }

            .command-display {
                font-size: 1.5rem;
                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;
            }
        }

        .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-blue);
            font-weight: 600;
        }

        .comparison-table tr:hover {
            background: rgba(255, 255, 255, 0.05);
        }
    </style>
</head>
<body>
    <div class="progress-container">
        <div class="progress-bar" id="progressBar"></div>
    </div>

    <div class="hero">
        <div class="hero-content">
            <h1>🚀 Master npm init</h1>
            <div class="command-display">npm init</div>
            <p>Learn how to bootstrap your Node.js projects like a pro! 🎯</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>npm init</strong> is like the <span class="highlight">birth certificate</span> for your Node.js project! 🎂
                </p>
                <p style="margin-bottom: 20px;">
                    It's a command that creates a <code>package.json</code> file - the heart and soul of every Node.js project. This file contains all the metadata about your project: its name, version, dependencies, scripts, and more.
                </p>
                <div class="tip">
                    <strong>Think of it like this:</strong> If your Node.js project were a person, <code>package.json</code> would be their ID card containing all their important information! 🪪
                </div>
                <p style="margin-top: 20px;">
                    When you run <code>npm init</code>, npm (Node Package Manager) asks you a series of questions and generates a <code>package.json</code> file based on your answers. It's the first step in creating any Node.js application!
                </p>
            </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>📦 Dependency Management</h4>
                        <p>Track all the packages your project needs in one place.</p>
                    </div>
                    <div class="cheat-item">
                        <h4>🔄 Version Control</h4>
                        <p>Keep track of your project version and package versions.</p>
                    </div>
                    <div class="cheat-item">
                        <h4>⚡ Scripts Automation</h4>
                        <p>Define custom commands to run tests, build, or start your app.</p>
                    </div>
                    <div class="cheat-item">
                        <h4>🤝 Team Collaboration</h4>
                        <p>Everyone on your team can install the same dependencies with one command.</p>
                    </div>
                    <div class="cheat-item">
                        <h4>📝 Project Documentation</h4>
                        <p>Store important project metadata like description, author, and license.</p>
                    </div>
                    <div class="cheat-item">
                        <h4>🌍 Publishing Ready</h4>
                        <p>Required if you want to publish your package to npm registry.</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- How Does It Work Section -->
        <section class="section" id="how-it-works">
            <h2 class="section-title">⚙️ How Does It Work?</h2>
            <div class="card">
                <p style="margin-bottom: 30px;">Let's break down the magic! ✨</p>
                
                <div class="steps">
                    <div class="step">
                        <h3>Open Your Terminal</h3>
                        <p>Navigate to your project folder using <code>cd your-project-folder</code></p>
                    </div>
                    
                    <div class="step">
                        <h3>Run npm init</h3>
                        <p>Type <code>npm init</code> and press Enter. npm will start asking you questions!</p>
                    </div>
                    
                    <div class="step">
                        <h3>Answer the Questions</h3>
                        <p>npm asks about package name, version, description, entry point, test command, git repository, keywords, author, and license. You can press Enter to accept defaults!</p>
                    </div>
                    
                    <div class="step">
                        <h3>Confirm and Create</h3>
                        <p>npm shows you a preview of the <code>package.json</code> file. Type "yes" to confirm, and voilà! Your file is created! 🎉</p>
                    </div>
                </div>

                <div class="success" style="margin-top: 30px;">
                    <strong>Pro Shortcut:</strong> Use <code>npm init -y</code> or <code>npm init --yes</code> to skip all questions and create a package.json with default values instantly! ⚡
                </div>
            </div>
        </section>

        <!-- Live Demo Section -->
        <section class="section" id="demo">
            <h2 class="section-title">🎮 Interactive Demo</h2>
            <div class="demo-container">
                <h3 style="margin-bottom: 20px;">See npm init in Action!</h3>
                <p style="margin-bottom: 30px;">Click the button to simulate running <code>npm init</code> in your terminal! 👇</p>
                
                <button class="demo-button" onclick="startNpmInitDemo()">
                    <span>▶️</span>
                    <span>Run npm init</span>
                </button>

                <div class="terminal" id="demoTerminal" style="display: none; margin-top: 30px;">
                    <div class="terminal-header">
                        <div class="terminal-dot red"></div>
                        <div class="terminal-dot yellow"></div>
                        <div class="terminal-dot green"></div>
                    </div>
                    <div class="terminal-content" id="terminalContent"></div>
                </div>

                <div id="generatedPackageJson" style="display: none; margin-top: 30px;">
                    <h4 style="color: var(--accent-green); margin-bottom: 15px;">✅ Generated package.json:</h4>
                    <div class="code-block">
                        <div class="code-header">
                            <span class="code-lang">package.json</span>
                            <button class="copy-btn" onclick="copyCode(this, 'generated-json')">📋 Copy</button>
                        </div>
                        <pre><code id="generated-json"></code></pre>
                    </div>
                </div>
            </div>
        </section>

        <!-- Code Breakdown Section -->
        <section class="section" id="code-breakdown">
            <h2 class="section-title">💻 Command Variations</h2>
            <div class="card">
                <p style="margin-bottom: 30px;">npm init comes with different flavors! Let's explore them all! 🍦</p>

                <div class="tabs">
                    <button class="tab active" onclick="switchTab('basic')">Basic</button>
                    <button class="tab" onclick="switchTab('quick')">Quick Mode</button>
                    <button class="tab" onclick="switchTab('scoped')">Scoped Package</button>
                    <button class="tab" onclick="switchTab('initializers')">Initializers</button>
                </div>

                <div id="basic" class="tab-content active">
                    <div class="code-block">
                        <div class="code-header">
                            <span class="code-lang">Terminal</span>
                            <button class="copy-btn" onclick="copyCode(this, 'basic-code')">📋 Copy</button>
                        </div>
                        <pre><code id="basic-code">npm init</code></pre>
                    </div>
                    <p style="margin-top: 15px;">
                        <strong>What it does:</strong> Starts an interactive setup wizard that asks you questions about your project.
                    </p>
                    <p style="margin-top: 10px;">
                        <strong>When to use:</strong> When you want full control over your package.json configuration.
                    </p>
                </div>

                <div id="quick" class="tab-content">
                    <div class="code-block">
                        <div class="code-header">
                            <span class="code-lang">Terminal</span>
                            <button class="copy-btn" onclick="copyCode(this, 'quick-code')">📋 Copy</button>
                        </div>
                        <pre><code id="quick-code">npm init -y
# or
npm init --yes</code></pre>
                    </div>
                    <p style="margin-top: 15px;">
                        <strong>What it does:</strong> Creates package.json instantly with default values. No questions asked!
                    </p>
                    <p style="margin-top: 10px;">
                        <strong>When to use:</strong> For quick prototypes or when you'll customize package.json later.
                    </p>
                    <div class="tip" style="margin-top: 20px;">
                        <strong>Time Saver:</strong> This is the most popular option among developers! It creates the file in under a second! ⚡
                    </div>
                </div>

                <div id="scoped" class="tab-content">
                    <div class="code-block">
                        <div class="code-header">
                            <span class="code-lang">Terminal</span>
                            <button class="copy-btn" onclick="copyCode(this, 'scoped-code')">📋 Copy</button>
                        </div>
                        <pre><code id="scoped-code">npm init --scope=@your-username</code></pre>
                    </div>
                    <p style="margin-top: 15px;">
                        <strong>What it does:</strong> Creates a scoped package (e.g., @your-username/package-name).
                    </p>
                    <p style="margin-top: 10px;">
                        <strong>When to use:</strong> When creating packages for organizations or personal namespaces.
                    </p>
                </div>

                <div id="initializers" class="tab-content">
                    <div class="code-block">
                        <div class="code-header">
                            <span class="code-lang">Terminal</span>
                            <button class="copy-btn" onclick="copyCode(this, 'init-code')">📋 Copy</button>
                        </div>
                        <pre><code id="init-code"># Create React App
npm init react-app my-app

# Create Vite project
npm init vite@latest

# Create Next.js app
npm init next-app

# Create Express generator
npm init express-generator</code></pre>
                    </div>
                    <p style="margin-top: 15px;">
                        <strong>What it does:</strong> Uses npm initializers to bootstrap projects with specific frameworks!
                    </p>
                    <p style="margin-top: 10px;">
                        <strong>When to use:</strong> When starting a project with a popular framework or template.
                    </p>
                    <div class="success" style="margin-top: 20px;">
                        <strong>Magic Trick:</strong> <code>npm init &lt;initializer&gt;</code> is shorthand for <code>npx create-&lt;initializer&gt;</code>! 🎩✨
                    </div>
                </div>
            </div>
        </section>

        <!-- Package.json Anatomy Section -->
        <section class="section" id="anatomy">
            <h2 class="section-title">🔬 package.json Anatomy</h2>
            <div class="card">
                <p style="margin-bottom: 30px;">Let's dissect a typical package.json file! 🧬</p>

                <div class="code-block">
                    <div class="code-header">
                        <span class="code-lang">package.json</span>
                        <button class="copy-btn" onclick="copyCode(this, 'anatomy-code')">📋 Copy</button>
                    </div>
                    <pre><code id="anatomy-code">{
<span class="code-comment">// The name of your package (required)</span>
<span class="code-keyword">"name"</span>: <span class="code-string">"my-awesome-project"</span>,

<span class="code-comment">// Version following semantic versioning (required)</span>
<span class="code-keyword">"version"</span>: <span class="code-string">"1.0.0"</span>,

<span class="code-comment">// Short description of your project</span>
<span class="code-keyword">"description"</span>: <span class="code-string">"An awesome Node.js project"</span>,

<span class="code-comment">// The entry point of your application</span>
<span class="code-keyword">"main"</span>: <span class="code-string">"index.js"</span>,

<span class="code-comment">// Custom commands you can run with npm run</span>
<span class="code-keyword">"scripts"</span>: {
  <span class="code-keyword">"start"</span>: <span class="code-string">"node index.js"</span>,
  <span class="code-keyword">"test"</span>: <span class="code-string">"jest"</span>,
  <span class="code-keyword">"dev"</span>: <span class="code-string">"nodemon index.js"</span>
},

<span class="code-comment">// Keywords for npm search</span>
<span class="code-keyword">"keywords"</span>: [<span class="code-string">"awesome"</span>, <span class="code-string">"nodejs"</span>, <span class="code-string">"project"</span>],

<span class="code-comment">// Author information</span>
<span class="code-keyword">"author"</span>: <span class="code-string">"Your Name &lt;your.email@example.com&gt;"</span>,

<span class="code-comment">// License type</span>
<span class="code-keyword">"license"</span>: <span class="code-string">"MIT"</span>,

<span class="code-comment">// Production dependencies</span>
<span class="code-keyword">"dependencies"</span>: {
  <span class="code-keyword">"express"</span>: <span class="code-string">"^4.18.2"</span>
},

<span class="code-comment">// Development-only dependencies</span>
<span class="code-keyword">"devDependencies"</span>: {
  <span class="code-keyword">"nodemon"</span>: <span class="code-string">"^2.0.20"</span>
}
}</code></pre>
                </div>

                <div style="margin-top: 30px;">
                    <h3 style="color: var(--accent-blue); margin-bottom: 20px;">📚 Field Explanations</h3>
                    
                    <table class="comparison-table">
                        <thead>
                            <tr>
                                <th>Field</th>
                                <th>Required?</th>
                                <th>Purpose</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><code>name</code></td>
                                <td>✅ Yes</td>
                                <td>Unique identifier for your package</td>
                            </tr>
                            <tr>
                                <td><code>version</code></td>
                                <td>✅ Yes</td>
                                <td>Current version (follows semver)</td>
                            </tr>
                            <tr>
                                <td><code>description</code></td>
                                <td>❌ No</td>
                                <td>Helps people find your package</td>
                            </tr>
                            <tr>
                                <td><code>main</code></td>
                                <td>❌ No</td>
                                <td>Entry point when package is imported</td>
                            </tr>
                            <tr>
                                <td><code>scripts</code></td>
                                <td>❌ No</td>
                                <td>Custom commands for automation</td>
                            </tr>
                            <tr>
                                <td><code>dependencies</code></td>
                                <td>❌ No</td>
                                <td>Packages needed in production</td>
                            </tr>
                            <tr>
                                <td><code>devDependencies</code></td>
                                <td>❌ No</td>
                                <td>Packages needed only for development</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </section>

        <!-- Common Mistakes Section -->
        <section class="section" id="mistakes">
            <h2 class="section-title">❌ Common Mistakes</h2>
            <div class="card">
                <div class="accordion">
                    <div class="accordion-item">
                        <div class="accordion-header" onclick="toggleAccordion(this)">
                            <span><strong>1. Invalid Package Name</strong></span>
                            <span class="accordion-icon">▼</span>
                        </div>
                        <div class="accordion-content">
                            <div class="accordion-body">
                                <div class="warning">
                                    <strong>Don't do this:</strong> Using uppercase letters, spaces, or special characters in package names.
                                </div>
                                <div class="code-block" style="margin-top: 15px;">
                                    <pre><code><span class="code-comment">// ❌ Bad names</span>
"My Awesome Project"  <span class="code-comment">// Has spaces and uppercase</span>
"my_project!"         <span class="code-comment">// Has special character</span>
"MyProject"           <span class="code-comment">// Has uppercase</span>

<span class="code-comment">// ✅ Good names</span>
"my-awesome-project"
"my-project"
"myproject"</code></pre>
                                </div>
                                <p style="margin-top: 15px;"><strong>Solution:</strong> Use lowercase letters, hyphens, and numbers only. No spaces or special characters!</p>
                            </div>
                        </div>
                    </div>

                    <div class="accordion-item">
                        <div class="accordion-header" onclick="toggleAccordion(this)">
                            <span><strong>2. Forgetting to Run npm init</strong></span>
                            <span class="accordion-icon">▼</span>
                        </div>
                        <div class="accordion-content">
                            <div class="accordion-body">
                                <div class="warning">
                                    <strong>The Problem:</strong> Installing packages without a package.json creates a mess!
                                </div>
                                <p style="margin-top: 15px;">If you run <code>npm install express</code> without a package.json, npm will create one automatically, but it won't have your project metadata.</p>
                                <p style="margin-top: 10px;"><strong>Solution:</strong> Always run <code>npm init</code> BEFORE installing any packages!</p>
                            </div>
                        </div>
                    </div>

                    <div class="accordion-item">
                        <div class="accordion-header" onclick="toggleAccordion(this)">
                            <span><strong>3. Not Using Version Control</strong></span>
                            <span class="accordion-icon">▼</span>
                        </div>
                        <div class="accordion-content">
                            <div class="accordion-body">
                                <div class="warning">
                                    <strong>Rookie Mistake:</strong> Not committing package.json to Git!
                                </div>
                                <p style="margin-top: 15px;">Your package.json is crucial! It tells other developers (and your future self) what dependencies your project needs.</p>
                                <p style="margin-top: 10px;"><strong>Solution:</strong> Always commit package.json and package-lock.json to version control. Add node_modules to .gitignore!</p>
                                <div class="code-block" style="margin-top: 15px;">
                                    <pre><code><span class="code-comment"># .gitignore</span>
node_modules/
.env</code></pre>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="accordion-item">
                        <div class="accordion-header" onclick="toggleAccordion(this)">
                            <span><strong>4. Mixing Up Dependencies and DevDependencies</strong></span>
                            <span class="accordion-icon">▼</span>
                        </div>
                        <div class="accordion-content">
                            <div class="accordion-body">
                                <div class="warning">
                                    <strong>Common Confusion:</strong> Not knowing which packages go where!
                                </div>
                                <p style="margin-top: 15px;"><strong>Rule of thumb:</strong></p>
                                <ul style="margin-left: 20px; margin-top: 10px;">
                                    <li><code>dependencies</code>: Packages needed to RUN your app (express, react, axios)</li>
                                    <li><code>devDependencies</code>: Packages needed to DEVELOP your app (nodemon, jest, eslint)</li>
                                </ul>
                                <div class="tip" style="margin-top: 15px;">
                                    <strong>Pro Tip:</strong> Use <code>npm install --save-dev</code> or <code>npm install -D</code> for dev dependencies!
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="accordion-item">
                        <div class="accordion-header" onclick="toggleAccordion(this)">
                            <span><strong>5. Ignoring Semantic Versioning</strong></span>
                            <span class="accordion-icon">▼</span>
                        </div>
                        <div class="accordion-content">
                            <div class="accordion-body">
                                <div class="warning">
                                    <strong>Version Chaos:</strong> Not understanding version numbers!
                                </div>
                                <p style="margin-top: 15px;"><strong>Semantic Versioning (semver):</strong> MAJOR.MINOR.PATCH</p>
                                <ul style="margin-left: 20px; margin-top: 10px;">
                                    <li><strong>MAJOR</strong> (1.0.0): Breaking changes</li>
                                    <li><strong>MINOR</strong> (0.1.0): New features (backward compatible)</li>
                                    <li><strong>PATCH</strong> (0.0.1): Bug fixes</li>
                                </ul>
                                <div class="code-block" style="margin-top: 15px;">
                                    <pre><code><span class="code-comment">// Version symbols</span>
"express": "4.18.2"    <span class="code-comment">// Exact version</span>
"express": "^4.18.2"   <span class="code-comment">// Compatible with 4.x.x</span>
"express": "~4.18.2"   <span class="code-comment">// Compatible with 4.18.x</span>
"express": "*"         <span class="code-comment">// Any version (dangerous!)</span></code></pre>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Pro Tips Section -->
        <section class="section" id="pro-tips">
            <h2 class="section-title">🚀 Pro Tips</h2>
            <div class="card">
                <div class="cheat-grid">
                    <div class="cheat-item">
                        <h4>⚡ Quick Start</h4>
                        <p>Use <code>npm init -y</code> for instant setup. You can always edit package.json later!</p>
                    </div>
                    <div class="cheat-item">
                        <h4>🎯 Custom Defaults</h4>
                        <p>Set default values with <code>npm config set init-author-name "Your Name"</code></p>
                    </div>
                    <div class="cheat-item">
                        <h4>📝 Add Scripts Early</h4>
                        <p>Define scripts like "start", "test", "dev" right after init. Saves time later!</p>
                    </div>
                    <div class="cheat-item">
                        <h4>🔒 Use Exact Versions</h4>
                        <p>For critical projects, use exact versions instead of ranges to avoid surprises.</p>
                    </div>
                    <div class="cheat-item">
                        <h4>📦 Private Packages</h4>
                        <p>Add <code>"private": true</code> to prevent accidental publishing to npm!</p>
                    </div>
                    <div class="cheat-item">
                        <h4>🎨 Add Metadata</h4>
                        <p>Include repository, bugs, and homepage URLs. Makes your package professional!</p>
                    </div>
                </div>

                <div class="tip" style="margin-top: 30px;">
                    <strong>🎓 Advanced Technique:</strong> Create a custom npm initializer! Make a package called <code>create-my-template</code> and use <code>npm init my-template</code> to bootstrap projects with your preferred setup!
                </div>

                <div class="success" style="margin-top: 20px;">
                    <strong>💡 Workflow Tip:</strong> Create a template package.json and copy it to new projects. Faster than running npm init every time!
                </div>
            </div>
        </section>

        <!-- Quiz Section -->
        <section class="section" id="quiz">
            <h2 class="section-title">🎯 Knowledge Check Quiz</h2>
            <div class="quiz-container">
                <p style="margin-bottom: 30px;">Test your npm init mastery! Click on the correct answer. 🧠</p>

                <div class="quiz-question">
                    <h3>Question 1: What does npm init create?</h3>
                    <div class="quiz-options">
                        <div class="quiz-option" onclick="checkAnswer(this, false, 1)">
                            A) A new Node.js installation
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, true, 1)">
                            B) A package.json file
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, false, 1)">
                            C) A node_modules folder
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, false, 1)">
                            D) A new npm account
                        </div>
                    </div>
                    <div class="quiz-feedback" id="feedback1"></div>
                </div>

                <div class="quiz-question">
                    <h3>Question 2: What flag skips all questions in npm init?</h3>
                    <div class="quiz-options">
                        <div class="quiz-option" onclick="checkAnswer(this, false, 2)">
                            A) npm init --skip
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, true, 2)">
                            B) npm init -y
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, false, 2)">
                            C) npm init --fast
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, false, 2)">
                            D) npm init --auto
                        </div>
                    </div>
                    <div class="quiz-feedback" id="feedback2"></div>
                </div>

                <div class="quiz-question">
                    <h3>Question 3: Which fields are REQUIRED in package.json?</h3>
                    <div class="quiz-options">
                        <div class="quiz-option" onclick="checkAnswer(this, false, 3)">
                            A) name, version, description
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, true, 3)">
                            B) name and version
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, false, 3)">
                            C) name, version, author, license
                        </div>
                        <div class="quiz-option" onclick="checkAnswer(this, false, 3)">
                            D) All fields are required
                        </div>
                    </div>
                    <div class="quiz-feedback" id="feedback3"></div>
                </div>

                <div id="quizScore" style="margin-top: 30px; padding: 20px; background: var(--bg-secondary); border-radius: 12px; display: none;">
                    <h3 style="color: var(--accent-green);">🎉 Quiz Complete!</h3>
                    <p id="scoreText" style="font-size: 1.2rem; margin-top: 10px;"></p>
                </div>
            </div>
        </section>

        <!-- Cheat Sheet Section -->
        <section class="section" id="cheat-sheet">
            <h2 class="section-title">📚 Quick Reference Cheat Sheet</h2>
            <div class="cheat-sheet">
                <h3 style="margin-bottom: 20px;">Save this for later! 🔖</h3>
                
                <div class="cheat-grid">
                    <div class="cheat-item">
                        <h4>🎯 Basic Commands</h4>
                        <p><code>npm init</code> - Interactive setup</p>
                        <p><code>npm init -y</code> - Quick setup</p>
                        <p><code>npm init --scope=@user</code> - Scoped package</p>
                    </div>

                    <div class="cheat-item">
                        <h4>📦 Initializers</h4>
                        <p><code>npm init react-app</code> - React</p>
                        <p><code>npm init vite</code> - Vite</p>
                        <p><code>npm init next-app</code> - Next.js</p>
                    </div>

                    <div class="cheat-item">
                        <h4>🔧 Config Commands</h4>
                        <p><code>npm config set init-author-name "Name"</code></p>
                        <p><code>npm config set init-license "MIT"</code></p>
                        <p><code>npm config list</code></p>
                    </div>

                    <div class="cheat-item">
                        <h4>📝 Required Fields</h4>
                        <p>✅ name</p>
                        <p>✅ version</p>
                        <p>❌ Everything else is optional!</p>
                    </div>

                    <div class="cheat-item">
                        <h4>🎨 Useful Fields</h4>
                        <p><code>main</code> - Entry point</p>
                        <p><code>scripts</code> - Custom commands</p>
                        <p><code>dependencies</code> - Production packages</p>
                        <p><code>devDependencies</code> - Dev packages</p>
                    </div>

                    <div class="cheat-item">
                        <h4>🔢 Version Symbols</h4>
                        <p><code>^</code> - Compatible (^1.2.3 = 1.x.x)</p>
                        <p><code>~</code> - Approximately (~1.2.3 = 1.2.x)</p>
                        <p>No symbol - Exact version</p>
                    </div>
                </div>

                <div style="margin-top: 30px; padding: 20px; background: rgba(255,255,255,0.1); border-radius: 12px;">
                    <h4 style="color: var(--accent-green); margin-bottom: 15px;">🎯 Typical Workflow</h4>
                    <p>1️⃣ Create project folder: <code>mkdir my-project && cd my-project</code></p>
                    <p>2️⃣ Initialize npm: <code>npm init -y</code></p>
                    <p>3️⃣ Install packages: <code>npm install express</code></p>
                    <p>4️⃣ Add scripts to package.json</p>
                    <p>5️⃣ Start coding! 🚀</p>
                </div>
            </div>
        </section>

        <!-- Summary Section -->
        <section class="section" id="summary">
            <h2 class="section-title">🎓 What You've Learned</h2>
            <div class="card">
                <h3 style="margin-bottom: 20px;">Congratulations! You're now an npm init expert! 🏆</h3>
                
                <div style="display: grid; gap: 20px;">
                    <div style="display: flex; align-items: start; gap: 15px;">
                        <span style="font-size: 2rem;">✅</span>
                        <div>
                            <strong>What npm init does</strong> - Creates package.json, the heart of every Node.js project
                        </div>
                    </div>
                    <div style="display: flex; align-items: start; gap: 15px;">
                        <span style="font-size: 2rem;">✅</span>
                        <div>
                            <strong>Different ways to use it</strong> - Interactive mode, quick mode, and initializers
                        </div>
                    </div>
                    <div style="display: flex; align-items: start; gap: 15px;">
                        <span style="font-size: 2rem;">✅</span>
                        <div>
                            <strong>Package.json structure</strong> - All the important fields and what they mean
                        </div>
                    </div>
                    <div style="display: flex; align-items: start; gap: 15px;">
                        <span style="font-size: 2rem;">✅</span>
                        <div>
                            <strong>Common mistakes</strong> - What to avoid and how to fix issues
                        </div>
                    </div>
                    <div style="display: flex; align-items: start; gap: 15px;">
                        <span style="font-size: 2rem;">✅</span>
                        <div>
                            <strong>Pro tips and tricks</strong> - Advanced techniques for efficient workflows
                        </div>
                    </div>
                </div>

                <div style="margin-top: 40px; padding: 30px; background: var(--gradient-1); border-radius: 15px; text-align: center;">
                    <h3 style="margin-bottom: 15px;">🚀 Ready to Start Your Next Project?</h3>
                    <p style="font-size: 1.1rem;">You now have all the knowledge to initialize Node.js projects like a pro!</p>
                    <div style="margin-top: 20px;">
                        <span class="badge">🎖️ npm init Master</span>
                        <span class="badge">📦 Package.json Expert</span>
                        <span class="badge">⚡ Node.js Pro</span>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <div class="footer">
        <h3 style="margin-bottom: 15px;">✨ Tutorial Complete! ✨</h3>
        <p>Generated by <strong>AI Prompt Dictionary</strong> 🤖</p>
        <p style="margin-top: 10px;">Made with ❤️ and lots of ☕</p>
        <p style="margin-top: 20px; color: var(--text-secondary); font-size: 0.9rem;">
            © 2026 | Keep learning, keep building! 🚀
        </p>
    </div>

    <script>
        // Progress Bar
        window.addEventListener('scroll', () => {
            const winScroll = document.body.scrollTop || document.documentElement.scrollTop;
            const height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
            const scrolled = (winScroll / height) * 100;
            document.getElementById('progressBar').style.width = scrolled + '%';
        });

        // Animate sections on scroll
        const observerOptions = {
            threshold: 0.1,
            rootMargin: '0px 0px -100px 0px'
        };

        const observer = new IntersectionObserver((entries) => {
            entries.forEach((entry, index) => {
                if (entry.isIntersecting) {
                    entry.target.style.animationDelay = `${index * 0.1}s`;
                    entry.target.classList.add('visible');
                }
            });
        }, observerOptions);

        document.querySelectorAll('.section').forEach(section => {
            observer.observe(section);
        });

        // npm init Demo
        function startNpmInitDemo() {
            const terminal = document.getElementById('demoTerminal');
            const content = document.getElementById('terminalContent');
            const packageJsonDiv = document.getElementById('generatedPackageJson');
            const jsonCode = document.getElementById('generated-json');
            
            terminal.style.display = 'block';
            packageJsonDiv.style.display = 'none';
            content.innerHTML = '';

            const steps = [
                { text: '<span class="terminal-prompt">$</span> <span class="terminal-command">npm init</span>', delay: 500 },
                { text: 'This utility will walk you through creating a package.json file.', delay: 1000 },
                { text: 'It only covers the most common items, and tries to guess sensible defaults.\n', delay: 1500 },
                { text: 'Press ^C at any time to quit.', delay: 2000 },
                { text: 'package name: (my-project) <span style="color: var(--accent-yellow);">my-awesome-app</span>', delay: 3000 },
                { text: 'version: (1.0.0) <span style="color: var(--accent-yellow);">1.0.0</span>', delay: 3500 },
                { text: 'description: <span style="color: var(--accent-yellow);">A cool Node.js application</span>', delay: 4000 },
                { text: 'entry point: (index.js) <span style="color: var(--accent-yellow);">index.js</span>', delay: 4500 },
                { text: 'test command: <span style="color: var(--accent-yellow);">jest</span>', delay: 5000 },
                { text: 'git repository: <span style="color: var(--accent-yellow);">https://github.com/user/my-awesome-app</span>', delay: 5500 },
                { text: 'keywords: <span style="color: var(--accent-yellow);">nodejs, awesome, app</span>', delay: 6000 },
                { text: 'author: <span style="color: var(--accent-yellow);">Your Name</span>', delay: 6500 },
                { text: 'license: (ISC) <span style="color: var(--accent-yellow);">MIT</span>', delay: 7000 },
                { text: '\nAbout to write to package.json:\n', delay: 7500 },
                { text: 'Is this OK? (yes) <span style="color: var(--accent-yellow);">yes</span>', delay: 8000 },
                { text: '<span style="color: var(--accent-green);">✓ package.json created successfully!</span>', delay: 8500 }
            ];

            steps.forEach((step, index) => {
                setTimeout(() => {
                    const line = document.createElement('div');
                    line.innerHTML = step.text;
                    line.style.marginBottom = '5px';
                    content.appendChild(line);
                    terminal.scrollTop = terminal.scrollHeight;

                    if (index === steps.length - 1) {
                        setTimeout(() => {
                            packageJsonDiv.style.display =
Live Preview