# Moving Company System — Setup Guide

## Part 1: Database Setup (PHP Installer)

1. Upload `installer/install.php` to cPanel public_html
2. Visit https://yourdomain.com/install.php
3. Step 1: Click "Start Installation"
4. Step 2: Requirements will show all green ✓
5. Step 3: Enter database credentials:
   - Host: localhost
   - User: (from cPanel MySQL Databases)
   - Password: (your DB password)
   - Name: moving_company
6. Step 4: Installation runs automatically
7. Delete install.php after success (security)

## Part 2: API Setup (Node.js)

1. Upload api/ folder contents to server
2. SSH in and run:
   ```bash
   cp .env.example .env
   nano .env   # fill in your values
   npm install
   npm start
   ```
3. Test: curl https://yourdomain.com/api/health

## Part 3: Dashboard Setup (React)

1. Upload dashboard/ files to a public folder
2. Update API_URL in App.jsx to point to your API
3. Build: npx react-scripts build
4. Upload build/ folder contents

## Part 4: Mobile App (React Native)

1. Install Expo: npm install -g expo-cli
2. cd mobile/
3. Update API_URL in MobileApp.js
4. npm install
5. npx expo start
6. Scan QR code with Expo Go app (iOS/Android)

## Environment Variables (.env)

```
DB_HOST=localhost
DB_USER=uaegym5_moving
DB_PASS=your_password
DB_NAME=moving_company
PORT=3000
JWT_SECRET=random_string_here
GOOGLE_MAPS_KEY=optional
FRONTEND_URL=https://yourdomain.com
```

## Database Tables Created

- employees
- yard_locations
- jobs
- job_assignments
- time_entries
- travel_entries
- job_charges
- monthly_payroll
- monthly_invoices

## Troubleshooting

Q: Installer button doesn't work?
A: Use install.php — it's purely server-side, no JS needed

Q: API returns 401?
A: Login first to get a token, pass as Bearer header

Q: Database connection failed?
A: Check credentials in cPanel → MySQL Databases

Q: Mobile app can't connect?
A: Update API_URL in MobileApp.js to your domain
