> ## Documentation Index
> Fetch the complete documentation index at: https://docs.loremstock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Course Orientation and Setup Checklist

> Get your development environment ready for SWDBD401. Install Node.js, npm, VS Code, Postman, and a database in under 10 minutes.

Before the first lab session, every student needs a working development environment. This page is a checklist you can walk through in class or assign as pre-work. Every tool here is used somewhere in the four Learning Outcomes.

## Prerequisites

| Requirement  | Minimum                                | Purpose                                     |
| ------------ | -------------------------------------- | ------------------------------------------- |
| OS           | Windows 10, macOS 10.14, Ubuntu 18.04+ | Node.js compatibility                       |
| RAM          | 4 GB                                   | Run Node.js, VS Code, and database together |
| Disk         | 2 GB free                              | Packages and databases                      |
| Admin rights | Required                               | Software installation                       |

## Step-by-Step Setup

<Steps>
  <Step title="Install Node.js (LTS version)">
    Visit [nodejs.org](https://nodejs.org) and download the **LTS** version. LTS is stable and supported long-term. Avoid "Current."

    ```bash theme={null}
    # Verify after install
    node --version   # Should show v18.x or higher
    npm --version    # Should show v9.x or higher
    ```

    **Alternative using nvm (recommended for managing multiple versions):**

    ```bash theme={null}
    # macOS/Linux
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
    nvm install 18
    nvm use 18
    ```
  </Step>

  <Step title="Initialize a project">
    ```bash theme={null}
    mkdir my-backend
    cd my-backend
    npm init -y        # Creates package.json with defaults
    ```
  </Step>

  <Step title="Install VS Code and key extensions">
    Download from [code.visualstudio.com](https://code.visualstudio.com), then install these extensions:

    | Extension   | Publisher   | Use                                  |
    | ----------- | ----------- | ------------------------------------ |
    | ESLint      | Microsoft   | Catch JS errors automatically        |
    | Prettier    | Prettier    | Auto-format code on save             |
    | REST Client | Huachao Mao | Test APIs from VS Code               |
    | MySQL       | Weijan Chen | Browse MySQL databases in the editor |

    Enable format-on-save: Settings > search "format on save" > check the box.
  </Step>

  <Step title="Install Postman">
    Download from [postman.com/downloads](https://www.postman.com/downloads). Create a free account and make a collection called "SWDBD401 APIs."
  </Step>

  <Step title="Install a database (choose one or both)">
    This course uses **MySQL** for all database examples.

    ```bash theme={null}
    # macOS
    brew install mysql
    brew services start mysql

    # Ubuntu / WSL
    sudo apt-get install mysql-server
    sudo systemctl start mysql
    sudo systemctl enable mysql

    # Verify
    mysql --version
    ```

    Secure the installation and set a root password:

    ```bash theme={null}
    sudo mysql_secure_installation
    ```

    Connect and create the course databases:

    ```sql theme={null}
    CREATE DATABASE swdbd_app;
    CREATE DATABASE swdbd_test;
    SHOW DATABASES;
    ```

    Install **MySQL Workbench** from [dev.mysql.com/downloads/workbench](https://dev.mysql.com/downloads/workbench) for a visual interface.
  </Step>

  <Step title="Install Git">
    ```bash theme={null}
    # macOS
    brew install git
    # Ubuntu
    sudo apt-get install git
    # Configure
    git config --global user.name "Your Name"
    git config --global user.email "your@email.com"
    git --version
    ```
  </Step>
</Steps>

## Verify Everything Works

Run this in a terminal. Every line should print a version number:

```bash theme={null}
echo "Node: $(node --version)"
echo "npm:  $(npm --version)"
echo "Git:  $(git --version)"
```

## npm vs yarn Quick Reference

<CodeGroup>
  ```bash npm theme={null}
  npm init -y
  npm install express
  npm install --save-dev jest
  npm start
  npm test
  npm install          # install all from package.json
  ```

  ```bash yarn theme={null}
  yarn init -y
  yarn add express
  yarn add --dev jest
  yarn start
  yarn test
  yarn install
  ```
</CodeGroup>

<Note>
  This course uses npm in all examples. Yarn works the same way; just swap the commands.
</Note>

## Key Terms

| Term              | Simple Definition                                                                 |
| ----------------- | --------------------------------------------------------------------------------- |
| **Node.js**       | JavaScript runtime built on Chrome's V8 engine. Runs JS outside the browser.      |
| **npm**           | Node Package Manager. Downloads and manages third-party code packages.            |
| **package.json**  | The project manifest. Lists name, version, scripts, and dependencies.             |
| **Dependency**    | A package your app needs to run (e.g., express). Goes in `dependencies`.          |
| **devDependency** | A package only needed during development (e.g., jest). Goes in `devDependencies`. |
| **node\_modules** | Folder where all installed packages are stored. Never commit this to git.         |

<Warning>
  Always add `node_modules` and `.env` to your `.gitignore` file before the first commit.
</Warning>
