# Quick Start Guide - WA Gateway

## 🚀 Fast Setup (Windows)

### Step 1: Start XAMPP
1. Open **XAMPP Control Panel**
2. Click **Start** for **Apache**
3. Click **Start** for **MySQL**

### Step 2: Run Database Setup
Open Command Prompt and run:
```cmd
cd C:\xampp\htdocs\wa
db-setup.bat
```

That's it! The script will:
- ✅ Create the database
- ✅ Run all migrations
- ✅ Seed default data
- ✅ Clear cache

### Step 3: Start the Application
```cmd
php artisan serve
```

### Step 4: Login
Visit **http://localhost:8000** and login with:

| Role  | Email                  | Password |
|-------|------------------------|----------|
| Admin | admin@wagateway.com    | password |
| User  | user@wagateway.com     | password |

## 🎯 First Steps

### 1. Create a Device
1. Go to **My Devices** → **Add Device**
2. Enter device name (e.g., "My WhatsApp")
3. Click **Create Device**
4. You'll see a QR code (Demo Mode)

### 2. Generate API Key
1. Go to **API Keys**
2. Click **Generate New Key**
3. Enter key name (e.g., "Production")
4. Copy the generated key

### 3. Test the API
```bash
curl -X POST http://localhost:8000/api/send/text \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "device_id": 1,
    "number": "628123456789",
    "message": "Hello!"
  }'
```

## 🔧 Configuration

### Enable Real WhatsApp (Optional)

To connect real WhatsApp accounts:

1. **Install Evolution API** (see README.md)

2. **Update .env file**:
   ```env
   EVOLUTION_API_URL=http://localhost:8080
   EVOLUTION_API_KEY=global_api_key_change_me
   EVOLUTION_DEMO_MODE=false
   ```

3. **Clear cache**:
   ```cmd
   php artisan config:clear
   ```

## 📊 Database Management

### Reset Database
```cmd
php artisan db:setup --fresh --seed
```

### Backup Database
```cmd
mysqldump -u root wa_gateway > backup.sql
```

### Restore Database
```cmd
mysql -u root wa_gateway < backup.sql
```

## 🆘 Common Issues

### "MySQL is not running"
- Open XAMPP Control Panel
- Start MySQL service

### "Database connection failed"
- Check `.env` file database settings
- Ensure database `wa_gateway` exists

### "Port 8000 already in use"
- Use different port: `php artisan serve --port=8001`

### "Evolution API Not Connected"
- This is normal in Demo Mode
- Install Evolution API for real WhatsApp

## 📚 Next Steps

1. **Explore the Dashboard**
   - Devices management
   - Message history
   - Campaigns
   - Webhooks

2. **Read API Documentation**
   - See README.md for full API docs
   - Test endpoints with Postman

3. **Customize for Production**
   - Change default passwords
   - Configure email settings
   - Set up payment gateway
   - Deploy to production server

## 🎉 You're Ready!

Your WA Gateway is now running. Start creating devices and sending messages!

For detailed documentation, see **README.md**.
