# Local Development Setup (Mac + XAMPP)

## Prerequisites

- XAMPP installed (MySQL at `/Applications/XAMPP/xamppfiles/bin/mysql`)
- PHP 8.2+ (shared hosting compatible)
- Composer
- Node.js + npm

## Database

1. Start **XAMPP** → MySQL
2. Database `autotrade` should already exist
3. `.env` is configured:

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=autotrade
DB_USERNAME=root
DB_PASSWORD=
```

## First-time setup

```bash
cd /Users/vishal/Desktop/AutoTrade-FlatTrade
composer install
php artisan key:generate
php artisan migrate:fresh --seed
npm install && npm run build
php artisan serve
```

## Dev workers (optional, separate terminals)

```bash
php artisan flattrade:websocket    # live ticks (admin feed required)
php artisan bot:scan --once        # single scan cycle
php artisan bot:monitor --once       # single exit check
php artisan market:sync            # refresh scan universe (admin OAuth required)
php artisan test                   # run test suite (uses FLATTRADE_MOCK in phpunit.xml)
```

Open: **http://localhost:8000**

## Login credentials

| Role  | Email                   | Password  |
|-------|-------------------------|-----------|
| Admin | admin@autotrade.local   | password  |
| User  | trader@autotrade.local  | password  |

## Shared hosting note

- **This Laravel app** → deploy to shared hosting
- **WebSocket + bot workers** → run on VPS with static IP (FlatTrade API v2 requirement)
- See `BUILD_CHECKLIST.md` for full build progress

## XAMPP MySQL CLI

```bash
/Applications/XAMPP/xamppfiles/bin/mysql -u root autotrade
```
