# Step-by-Step Local + Hosting Guide

## Local setup quick commands

```bash
cd laravel-realtime-quiz-app
composer install
npm install
cp .env.example .env
php artisan key:generate
php artisan migrate --seed
```

Open three terminals:

```bash
php artisan serve
```

```bash
php artisan reverb:start
```

```bash
npm run dev
```

Open:

```text
Admin: http://127.0.0.1:8000/admin
Participant: http://127.0.0.1:8000/join
```

## Mobile testing on same Wi-Fi

Find your laptop IP address.

Windows:

```bash
ipconfig
```

Example IP:

```text
192.168.1.10
```

Update `.env`:

```env
APP_URL=http://192.168.1.10:8000
REVERB_HOST=192.168.1.10
REVERB_PORT=8080
REVERB_SCHEME=http
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"
```

Then restart all three terminals and open on mobile:

```text
http://192.168.1.10:8000/join
```

## Hosting recommendation

Best option:

- VPS with Ubuntu
- Nginx
- PHP 8.2+
- MySQL
- Supervisor for Reverb process
- SSL certificate

Avoid normal shared hosting if it does not allow long-running WebSocket processes.
