# Marhatab Family Pharmacy — cPanel deployment

This package keeps the **exact original frontend, admin panel, routes and payments logic**. Only an additive cPanel start file and hosting instructions were introduced. This is a **dynamic Next.js + PostgreSQL** app, NOT a static/public_html-only site.

## Hosting requirements

- cPanel **Setup Node.js App** / Passenger with Node.js **20.9+ (22 recommended)** and sufficient memory to build Next.js 16, plus npm access.
- A reachable **PostgreSQL database** (local cPanel PostgreSQL if provided, or external managed PostgreSQL); cPanel MySQL alone will NOT work without a separate database migration.
- DNS A record for `marhatabpharmacy.bizzup.llc` points to the cPanel server, subdomain provisioned in cPanel, valid SSL certificate and HTTPS.
- SSH/Terminal access (or a host who will execute the commands) to install/build/migrate.

## Procedure

1. In cPanel create `marhatabpharmacy.bizzup.llc` and enable SSL. Create the PostgreSQL DB and user (or obtain a remote PostgreSQL connection URL).
2. In **Setup Node.js App**, create a **production** app with the application root folder (e.g. `marhatab_app`), application URL `marhatabpharmacy.bizzup.llc` (root `/`), Node.js **22**, application startup file `app.js`.
3. Upload and extract this ZIP **in the application root**, not simply in the subdomain's public_html. Keep `.env` OUTSIDE a publicly served directory. Copy `.env.example` to `.env` and fill real DB credentials; alternatively set environment variables under Setup Node.js App. Never expose database credentials in files downloadable from the website.
4. In the terminal, activate the app's Node environment using the command shown on your cPanel Node app page, then run:
   ```sh
   npm install
   npx drizzle-kit push
   npm run build
   ```
5. Restart the app from Setup Node.js App (startup file: `app.js`). Check `https://marhatabpharmacy.bizzup.llc/api/health` should return `{ "ok": true }`.
6. Visit `https://marhatabpharmacy.bizzup.llc/admin/login` and complete the initial owner-admin setup. Do not enter provider payment secrets until SSL and the database are verified.
7. In **Admin → Payments**, configure sandbox provider credentials and verify full callback + payment status before enabling production payment methods. Test storefront, product add/edit, images, login, cart, checkout, mail, and payment webhooks.

## Troubleshooting

- If **Setup Node.js App** is missing, this dynamic app cannot work as supplied on static PHP-only cPanel. Get Node.js hosting/upgrade or deploy the server component externally and point the subdomain to it.
- If only MySQL/MariaDB is available, arrange PostgreSQL access; replacing the database requires a substantial schema/query migration and regression tests.
- If build crashes due to memory, ask the hosting company for more memory/resources or build on a suitable Node 22 environment and deploy the resulting compiled app.
- If 503, inspect `stderr.log`/Passenger log, confirm `.env`/DB access, Node version, correct root, app.js and build output.
- If payment callback fails, ensure public HTTPS, valid credentials, and provider-specific callback URL config.

## Original application

Original README.md remains included. No design components, admin-panel pages, commerce features or payment handling were changed for this package.
