# Absolute Restoration Health — cPanel Deployment Package

This zip contains a static build of the website plus PHP scripts to handle the
three forms (Contact, Assessment, Job Application). It is designed to drop
straight into a cPanel hosting account.

## Folder layout once unzipped

    public_html/
    ├─ index.html                 ← React app entry
    ├─ assets/                    ← JS/CSS/fonts/images (hashed)
    ├─ favicon.ico, robots.txt …
    ├─ .htaccess                  ← SPA fallback + caching + security
    └─ api/
       ├─ config.php              ← EDIT THIS (recipient email + reCAPTCHA secret)
       ├─ _helpers.php            ← Shared helpers (do not delete)
       ├─ contact.php
       ├─ assessment.php
       └─ job-application.php

## Deploy in 4 steps

1. **Upload.** In cPanel → File Manager, open `public_html/`. Upload this zip
   and use "Extract" so all files land directly in `public_html/` (NOT in a
   nested folder).

2. **Configure email + reCAPTCHA.** Open `api/config.php` and edit:
   - `RECIPIENT_EMAIL` — where form submissions are sent.
   - `FROM_EMAIL` / `FROM_NAME` — must be an address on your own domain
     (most hosts reject mail "From" external addresses).
   - `RECAPTCHA_SECRET` — your reCAPTCHA v2 **secret** key from
     https://www.google.com/recaptcha/admin

3. **Add your reCAPTCHA site key to the frontend (if changed).**
   The build was made with Google's universal TEST site key, which always
   passes. To use real keys, set `VITE_RECAPTCHA_SITE_KEY` in `.env` and
   rebuild before zipping. (See "Rebuilding" below.)

4. **Test.** Visit your domain, submit each form, and confirm you receive
   the emails. If you don't, see "Troubleshooting".

## How it works

- `index.html` + `assets/*` are the static React app. The `.htaccess`
  rewrite rule sends every URL that isn't a real file, real folder, or
  `/api/*` request to `index.html` so React Router handles deep links
  like `/services/skilled-nursing`.
- Each form POSTs to its PHP endpoint as `multipart/form-data`. The PHP
  script:
  1. Validates required fields,
  2. Verifies the Google reCAPTCHA token server-side,
  3. Sends the data via PHP `mail()` to `RECIPIENT_EMAIL`,
  4. For job applications, attaches the uploaded resume (PDF/DOC/DOCX,
     ≤ 5 MB) to the email.

## Troubleshooting

- **No email arrives** — most cPanel hosts only deliver mail when the
  `From:` header is on your own domain. Edit `FROM_EMAIL` in
  `api/config.php` to e.g. `noreply@yourdomain.com`.
- **"reCAPTCHA verification failed"** — the secret key in `config.php`
  must match the site key compiled into the frontend. Both come from
  the same reCAPTCHA admin entry.
- **Deep links 404 (e.g. /contact reloads to a 404)** — `.htaccess` was
  not uploaded, or `mod_rewrite` is disabled. In cPanel, enable "Show
  hidden files" in File Manager and confirm `.htaccess` is present.
- **Resume upload rejected** — your host's `upload_max_filesize` /
  `post_max_size` may be lower than 5 MB. Raise them in cPanel →
  "MultiPHP INI Editor".

## Rebuilding (optional)

If you change site content or the reCAPTCHA site key:

    # 1. Set the live site key in .env
    echo "VITE_RECAPTCHA_SITE_KEY=your-site-key-here" > .env

    # 2. Build the static site
    bun install
    bun run build

    # 3. Re-zip the contents of dist/ together with the api/ folder
    #    and .htaccess from this package, and re-upload.

---

Built for: **Absolute Restoration Health Services**
