DHUA QURBAN - cPanel deployment (Node.js app) ============================================= 1. CREATE THE DATABASE - cPanel > MySQL Databases: create database + user, grant ALL on it. - Note the DB name/user/password. 2. SET UP THE NODE.JS APP (cPanel > Setup Node.js App) - Node version: 20 or 22 (LTS). Recommend 22. - Application root: the folder you uploaded this zip into (e.g. /dhuha-qurban). - Application URL: https://yourdomain.com (or a subdomain). - Startup file: server.js - Application startup file / entry point: server.js - Run NPM Install: CHECKED (this zip intentionally has NO node_modules - CloudLinux NodeJS Selector requires it to create its own virtualenv symlink; the shipped package.json is cleaned for this: runtime deps only, no postinstall scripts). - Save, then cPanel runs npm install and generates a PORT - note it. 3. ENVIRONMENT VARIABLES (cPanel > Setup Node.js App > edit > Environment variables) Add these (REPLACE values with your own - NO quotes around values): - DATABASE_URL=mysql://DB_USER:DB_PASS@localhost/DB_NAME - SESSION_SECRET= - APP_URL=https://yourdomain.com - STRIPE_SECRET_KEY=sk_live_... or sk_test_... - STRIPE_PUBLISHABLE_KEY=pk_live_... or pk_test_... - STRIPE_WEBHOOK_SECRET=whsec_... (from Stripe dashboard webhook) - STRIPE_MODE=test (or live) - STORAGE_PROVIDER=local - UPLOAD_DIR=./uploads - DO NOT upload a .env file - env vars live here in cPanel. - DO NOT put quotes around values - the app reads them raw. 4. CREATE THE TABLES - Open "Run JS script" / terminal in cPanel OR run locally: npx prisma migrate deploy - Local equivalent (from project folder, with .env pointing at the cPanel DB): npm run db:deploy 5. CREATE THE INITIAL ADMIN (run once, from the project folder with .env set to the cPanel DB) npm run init:prod - Default: admin@dhuha.dev / admin123 - CHANGE THE PASSWORD RIGHT AFTER FIRST LOGIN: Admin > sidebar bottom > "Change password". 6. START THE APP - Back in cPanel > Setup Node.js App > click "Restart" (or Start). - The app listens on the PORT cPanel assigned - nothing else needed. 7. HTTPS - cPanel > SSL/TLS Status > run AutoSSL (Let's Encrypt) for your domain. 8. STRIPE WEBHOOK (production) - Stripe Dashboard > Developers > Webhooks > Add endpoint: URL: https://yourdomain.com/api/payment/webhook Events: checkout.session.completed, checkout.session.async_payment_failed, checkout.session.expired - Copy the signing secret (whsec_...) into the STRIPE_WEBHOOK_SECRET env var above, then restart the Node.js app. - Test order status in Admin > Orders after a real payment. 9. VERIFY - Open https://yourdomain.com - homepage loads. - Open https://yourdomain.com/admin - login works. - Upload an image in Admin > Media Library - it appears in /uploads/. NOTES - The /uploads folder must stay writable (cPanel default is fine). - Back up the database before any schema change (prisma migrate deploy). - Never upload .env with real secrets.