Debug Instructions for BambiSleep Chat

This document provides information on how to run and debug the BambiSleep Chat application.

Prerequisites

  • Node.js (v16+ recommended)
  • Docker and Docker Compose
  • MongoDB (via Docker)

Running the Application

Standard Run

# Start MongoDB container
docker-compose up -d mongodb

# Start the application
npm run start

Development Mode (with auto-restart)

# Start MongoDB container
docker-compose up -d mongodb

# Start the application with nodemon for auto-restart
npm run dev

Debugging Options

Option 1: Using VS Code Debugger

  1. Open the project in VS Code
  2. Set breakpoints in your code
  3. Press F5 or select the "Debug with Nodemon" configuration from the debug panel
  4. The application will start with debugging enabled

Option 2: Using Chrome DevTools

  1. Run the application with the debug flag:
    npm run debug
    
  2. Open Chrome and navigate to chrome://inspect
  3. Click on "Open dedicated DevTools for Node"
  4. Set breakpoints and debug

Option 3: Using PowerShell Script

  1. Run the included PowerShell script:
    .\debug.ps1
    
  2. This will check if MongoDB is running and start the application in debug mode

Debugging with Breakpoint on Start

To pause execution at the beginning of the application:

npm run debug:break

Available Ports

Troubleshooting

  • If you encounter the error "address already in use," check for running instances:

    netstat -ano | findstr :6970
    
  • To kill a process using a specific port:

    Stop-Process -Id <PID> -Force
    
  • To check MongoDB connection:

    docker exec -it bambisleep-mongodb mongosh -u bambisleep -p bambiAppPass456 --authenticationDatabase admin