|
| 1 | +# Local Development Setup Guide - macOS/Ubuntu |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | +- macOS 10.15 or later / Ubuntu 22.04/24.04 LTS |
| 5 | +- Terminal access |
| 6 | +- Homebrew package manager |
| 7 | + |
| 8 | +## Installation Steps |
| 9 | + |
| 10 | +### 1. Install [Homebrew](https://brew.sh/) (if not installed) (macOS only) |
| 11 | +```bash |
| 12 | +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 13 | +``` |
| 14 | + |
| 15 | +### 2. Install MongoDB |
| 16 | + |
| 17 | +[macOS](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/): |
| 18 | + |
| 19 | +```bash |
| 20 | +brew tap mongodb/brew |
| 21 | +brew install mongodb-community |
| 22 | +brew services start mongodb-community |
| 23 | +``` |
| 24 | + |
| 25 | +[Ubuntu](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/): |
| 26 | + |
| 27 | +```bash |
| 28 | +# Install required packages |
| 29 | +sudo apt-get install -y gnupg curl unzip |
| 30 | + |
| 31 | +# Import MongoDB public GPG key |
| 32 | +curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \ |
| 33 | + sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ |
| 34 | + --dearmor |
| 35 | + |
| 36 | +# Create list file for MongoDB |
| 37 | +echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | \ |
| 38 | + sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list |
| 39 | + |
| 40 | +# Update and install MongoDB |
| 41 | +sudo apt-get update |
| 42 | +sudo apt-get install -y mongodb-org |
| 43 | + |
| 44 | +# Start and enable MongoDB service |
| 45 | +sudo systemctl start mongod |
| 46 | +sudo systemctl enable mongod |
| 47 | +``` |
| 48 | + |
| 49 | +### 3. Install [Fast Node Manager (fnm)](https://github.com/Schniz/fnm) (if no Node.js version manager is installed) |
| 50 | +```bash |
| 51 | +curl -fsSL https://fnm.vercel.app/install | bash |
| 52 | +``` |
| 53 | + |
| 54 | +Add fnm to your shell configuration: |
| 55 | + |
| 56 | +macOS: |
| 57 | + |
| 58 | +```bash |
| 59 | +echo 'eval "$(fnm env --use-on-cd)"' >> ~/.zshrc |
| 60 | +source ~/.zshrc |
| 61 | +``` |
| 62 | +Ubuntu: |
| 63 | + |
| 64 | +```bash |
| 65 | +echo 'eval "$(fnm env --use-on-cd)"' >> ~/.bashrc |
| 66 | +source ~/.bashrc |
| 67 | +``` |
| 68 | + |
| 69 | +### 4. Install Node.js |
| 70 | +```bash |
| 71 | +fnm install 22 |
| 72 | +fnm use 22 |
| 73 | +``` |
| 74 | + |
| 75 | +Verify the installation: |
| 76 | +```bash |
| 77 | +node --version |
| 78 | +npm --version |
| 79 | +``` |
| 80 | + |
| 81 | +### 5. Run Development Setup Script |
| 82 | + |
| 83 | +Copy the `devsetup.sh` script from `.vscode/devsetup.sh` to your project directory (script clones the repo automatically). |
| 84 | +1. Navigate to your project directory |
| 85 | +2. Make the setup script executable: |
| 86 | +```bash |
| 87 | +chmod +x ./devsetup.sh |
| 88 | +``` |
| 89 | + |
| 90 | +1. Run the setup script: |
| 91 | +```bash |
| 92 | +./devsetup.sh |
| 93 | +``` |
| 94 | + |
| 95 | +The script will: |
| 96 | +- Clone the repository |
| 97 | +- Install dependencies |
| 98 | +- Configure the development environment |
| 99 | + |
| 100 | +### 6. Start the Development of Server/Client |
| 101 | + |
| 102 | +Use the debug configuration(server/client) in VS Code to run the code. |
| 103 | + |
| 104 | +By default client runs on `locahost:6001` and server runs on `localhost:3001` |
| 105 | + |
| 106 | + |
| 107 | +## Verification |
| 108 | +After installation, verify all components: |
| 109 | + |
| 110 | +- MongoDB: |
| 111 | + |
| 112 | +macOS: |
| 113 | + |
| 114 | +```bash |
| 115 | +brew services list | grep mongodb |
| 116 | +``` |
| 117 | + |
| 118 | +Ubuntu: |
| 119 | + |
| 120 | +```bash |
| 121 | +sudo systemctl status mongod |
| 122 | +``` |
| 123 | + |
| 124 | +- Node.js: |
| 125 | +```bash |
| 126 | +node --version |
| 127 | +``` |
| 128 | + |
| 129 | +## Troubleshooting |
| 130 | +- If MongoDB fails to start, try: |
| 131 | + |
| 132 | +macOS: |
| 133 | + |
| 134 | +```bash |
| 135 | +brew services restart mongodb-community |
| 136 | +``` |
| 137 | + |
| 138 | +Ubuntu: |
| 139 | + |
| 140 | +```bash |
| 141 | +sudo systemctl restart mongod |
| 142 | +sudo systemctl status mongod |
| 143 | +``` |
| 144 | + |
| 145 | +- If the setup script fails, check the generated log file in the current directory named \`setup_YYYYMMDD_HHMMSS.log\` |
0 commit comments