# Install — bacobeautyhubcosmetics.com (cPanel)

## Recommended: web installer

1. Upload / extract `baco-beauty-hub-cpanel.zip` and point the domain document root to `public/`.
2. In cPanel MySQL, create an **empty** database + user (grant all on that DB).
3. Open **`https://bacobeautyhubcosmetics.com/install/`**
4. Complete the 4 steps (requirements → database → admin → done).
5. **Delete** `public/install/` when finished.

The installer writes `config/env.php`, imports `sql/schema.sql`, sets your admin password, and seeds legal pages.

## Manual install (optional)

Point the **add-on domain** or subdomain document root to:

```text
baco-beauty-hub/public/
```

1. Create MySQL DB + user in cPanel.
2. Import `sql/schema.sql` via phpMyAdmin.
3. Copy `config/env.example.php` → `config/env.php` and fill DB credentials + `APP_KEY` / `JWT_SECRET`.
4. Create `storage/installed.lock` (empty file) so the storefront does not redirect to `/install/`.

## Admin

- URL: `https://bacobeautyhubcosmetics.com/admin/login.php`
- Credentials: whatever you set in the installer (or seeded admin if manual)

## 4. Live config API (Flutter + web)

`GET https://bacobeautyhubcosmetics.com/api/config.php`

Returns branding, menus, WhatsApp, payment **public** keys, announcement, footer — no secrets.

## 5. Payment webhooks

- Paystack: `https://bacobeautyhubcosmetics.com/api/webhooks/paystack.php`
- Flutterwave: `https://bacobeautyhubcosmetics.com/api/webhooks/flutterwave.php`

## 6. Forms + Auth (app login / register / profile)

Import `sql/migrate_forms_auth.sql` (included in full `schema.sql` for new installs).

- Admin → **Form Builder** — edit registration, login, profile (and custom) forms
- App APIs:
  - `GET /api/forms.php?key=register|login|profile`
  - `POST /api/auth/register.php`
  - `POST /api/auth/login.php`
  - `GET /api/auth/me.php` (Bearer JWT)
  - `POST /api/auth/profile.php` (Bearer JWT)
- Set a strong `JWT_SECRET` in `config/env.php`
- Also import `sql/migrate_skin_type_field.sql` for optional Skin type on register/profile
- Website auth: `/login.php`, `/register.php`, `/account.php` (same CMS forms as the app)

## 7. AI Face Scanner (CMS)

Admin → **AI Face Scanner** controls enable/disable, copy, tips, max results, and whether the Scan tab appears in the app.

Existing DBs: import `sql/migrate_ai_scanner.sql` (or open the admin page once — it auto-seeds missing keys).

App picks settings from `GET /api/config.php` → `scanner` object.

## 8. Product CSV import / export

Admin → **Products → Import / Export CSV**

- Export downloads the full catalog (SKU upsert key)
- Import creates or updates by SKU; unknown category slugs are auto-created
- Sample template available on the same screen

## 9. Legal pages (Terms / Privacy / Refund)

Import `sql/migrate_legal_pages.sql` on existing databases, then open **Admin → Pages → Load legal policies** once to fill content adapted from typical beauty ecommerce policies (BuyMeBeauty-style).

Public URLs:

- `/page.php?slug=terms-of-service`
- `/page.php?slug=privacy-policy`
- `/page.php?slug=refund-policy`
- `/page.php?slug=shipping-returns`

Footer Help links are updated by the same seed action.
