# BasketLoot cPanel Deployment

This package contains the complete Laravel application, compiled assets and
production Composer dependencies. It intentionally contains no `.env`, local
database, demo users, logs, tests, Git history, Node modules, private face
verification files, public uploads, or database backups.

## 1. Upload and extract

Upload the ZIP with SFTP/FTPES to `/home/CPANEL_USERNAME` and extract it. It
creates a `basketloot` directory. In **cPanel → Domains**, set BasketLoot's
document root to `/home/CPANEL_USERNAME/basketloot/public`. This is the safest
layout because application code and `.env` stay outside the web root.

If cPanel does not permit changing the document root, extract all application
contents into `public_html` and use the included root `.htaccess`. In that
fallback layout set `APP_PUBLIC_PATH=/home/CPANEL_USERNAME/public_html/public`.

## 2. Create `.env`

Copy `.env.production.example` to `.env`, fill the MySQL/SMTP/secrets, and keep:

```dotenv
APP_ENV=production
APP_DEBUG=false
APP_URL=https://basketloot.com
DB_CONNECTION=mysql
SEED_DEMO_DATA=false
```

Never reuse or publish the local development `.env`.

If this database came from an existing live Basketloot installation, copy that
site's existing `APP_KEY` into the new `.env`; changing it would make encrypted
2FA secrets unreadable. For a genuinely new installation with no previous key,
run `php artisan key:generate --force` once after creating `.env`.

## 3. Prepare MySQL

Create the database/user in cPanel, grant ALL PRIVILEGES, then run:

```bash
cd /home/CPANEL_USERNAME/public_html
php artisan config:clear
php artisan migrate --force
```

For a fresh launch this creates empty production tables; it does not create demo
users. For an upgrade, back up the existing database and retain its `.env` and
`APP_KEY`, then run the same migration command without wiping or replacing data.

## 4. Finish Laravel setup

```bash
php artisan storage:link
chmod -R 755 storage bootstrap/cache
php artisan optimize:clear
php artisan optimize
php artisan app:production-check
curl -fsS https://basketloot.com/api/health
```

Add the cPanel cron (every minute when allowed; otherwise every five minutes):

```cron
*/5 * * * * cd /home/CPANEL_USERNAME/public_html && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1
```

See `CPANEL_DEPLOYMENT.md` for the complete checklist and postback tests.
