ASTHERAFI DASHBOARD - CPANEL NODE.JS DEPLOYMENT GUIDE
=====================================================

PREREQUISITES
=============
- cPanel hosting with Node.js support (version 18 or higher)
- PostgreSQL database (optional, for user accounts)
- DeepSeek API key (for AI token analysis)

STEP 1: BUILD THE APPLICATION
=============================
On your development machine (or Replit), run:
  npm run build

This creates the 'dist/' folder with:
  - index.cjs (compiled server)
  - public/ (frontend assets)

STEP 2: PREPARE FILES FOR UPLOAD
================================
Copy these files to your standalone folder:
  - dist/index.cjs -> standalone/index.cjs
  - dist/public/* -> standalone/public/*

Or use the provided deploy script:
  npm run deploy:cpanel

STEP 3: UPLOAD TO CPANEL
========================
1. Upload ALL files from the 'standalone/' folder to cPanel
2. Put them in: /home/yourusername/astherafi/

File structure should be:
  /home/yourusername/astherafi/
  ├── index.cjs         (Node.js server - compiled)
  ├── package.json      (Dependencies)
  ├── .htaccess         (Apache config for Passenger)
  ├── .env              (Environment variables - create this!)
  └── public/
      ├── index.html
      └── assets/

STEP 4: CREATE ENVIRONMENT FILE
===============================
Create a file named '.env' in your app folder with:

  NODE_ENV=production
  PORT=3000
  DEEPSEEK_API_KEY=your_deepseek_api_key_here
  DATABASE_URL=postgresql://user:password@host:5432/database  (optional)
  SESSION_SECRET=your_random_secret_string_here

IMPORTANT: Replace values with your actual credentials!

STEP 5: SETUP NODE.JS IN CPANEL
===============================
1. Go to cPanel > Software > Setup Node.js App
2. Click "Create Application"
3. Configure:
   - Node.js version: 18.x or 20.x
   - Application mode: Production
   - Application root: /home/yourusername/astherafi
   - Application URL: your domain or subdomain
   - Application startup file: index.cjs

STEP 6: INSTALL DEPENDENCIES
============================
1. In the cPanel Node.js app page, click "Run NPM Install"
2. Or use SSH terminal:
   cd /home/yourusername/astherafi
   source /home/yourusername/nodevenv/astherafi/18/bin/activate
   npm install

STEP 7: CONFIGURE .HTACCESS
===========================
Edit the .htaccess file and replace 'username' with your cPanel username:
  PassengerAppRoot "/home/YOUR_USERNAME/astherafi"

STEP 8: START THE APPLICATION
=============================
1. In cPanel Node.js app, click "Restart"
2. Your app should now be live at your configured URL!

TROUBLESHOOTING
===============
- Check Node.js app logs in cPanel for errors
- Verify all environment variables are set correctly
- Make sure PostgreSQL connection string is valid (if using database)
- Ensure DeepSeek API key is valid for AI features

FEATURES THAT REQUIRE API KEYS
==============================
- Token AI Analysis: Requires DEEPSEEK_API_KEY
- User Authentication: Requires DATABASE_URL (PostgreSQL)

FEATURES THAT WORK WITHOUT KEYS
===============================
- Token Security Check (uses free GoPlus API)
- Bundle Checker
- Password Score
- Website Builder (local generation)
- Token Generator (requires wallet connection)
- Staking Interface

SUPPORT
=======
For issues, check the application logs in cPanel.
