# 🖥️ NEUROBRO V6.0 - WEB DASHBOARD DEPLOYMENT GUIDE

Dark Trading Terminal UI with Real-time Stock Screening for cPanel Shared Hosting

## 🌟 Features

- **Real-time Screening Progress** - Live updates via Server-Sent Events
- **Dark Terminal UI** - Bloomberg-style trading interface
- **Interactive Charts** - Chart.js visualizations
- **ARA Detection** - Auto-Rejection Atas monitoring
- **Single Stock Analysis** - Quick stock lookup
- **History Tracking** - Past screening results
- **Mobile Responsive** - Works on all devices
- **Keyboard Shortcuts** - Power user features

## 📋 Requirements

- Python 3.8+
- cPanel Shared Hosting with Python support
- WSGI module enabled
- 500MB+ RAM recommended

## 🚀 Deployment Guide (cPanel Shared Hosting)

### Method 1: cPanel Python Setup (Recommended)

1. **Upload Files**
   ```bash
   # Upload all files to public_html directory
   public_html/
   ├── app.py
   ├── neurobroV6.py
   ├── wsgi.py
   ├── requirements.txt
   ├── templates/
   │   ├── dashboard.html
   │   ├── results.html
   │   └── analysis.html
   └── static/
       ├── css/
       │   └── terminal.css
       └── js/
           └── app.js
   ```

2. **Setup Python in cPanel**
   - Log in to cPanel
   - Go to "Setup Python App"
   - Create application:
     - Python version: 3.9 or higher
     - Application root: `/home/username/public_html`
     - Application URL: `/`
     - Application startup file: `wsgi.py`
     - Passenger WSGI: enabled

3. **Install Dependencies**
   - In cPanel terminal:
   ```bash
   cd ~/public_html
   pip install -r requirements.txt
   ```

4. **Configure .htaccess**
   - Edit `.htaccess` file
   - Replace `USERNAME` with your cPanel username
   ```apache
   <IfModule mod_wsgi.c>
       WSGIScriptAlias / /home/USERNAME/public_html/wsgi.py
       WSGIDaemonProcess neurobro python-path=/home/USERNAME/public_html
       WSGIProcessGroup neurobro
   </IfModule>
   ```

5. **Restart Application**
   - In cPanel: "Setup Python App" → Restart app

### Method 2: Gunicorn (Alternative)

1. **Install Gunicorn**
   ```bash
   pip install gunicorn
   ```

2. **Create .htaccess for Gunicorn**
   ```apache
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ http://localhost:5000/$1 [P,L]
   ```

3. **Start Gunicorn**
   ```bash
   # In cPanel Cron Jobs:
   cd ~/public_html && gunicorn -w 3 -b 0.0.0.0:5000 app:application
   ```

## 🔧 Configuration

### Environment Variables
Create `.env` file in project root:
```env
FLASK_SECRET_KEY=your-secret-key-here
MIN_SCORE=70
MIN_FREE_FLOAT_PCT=15
MAX_FREE_FLOAT_PCT=50
```

## 📱 Usage

### Web Interface
1. Navigate to your domain
2. Click "RUN FULL SCREENING" for complete scan
3. Use "SINGLE STOCK" for quick analysis
4. View "HISTORY" for past results

### Keyboard Shortcuts
- **F** - Run full screening
- **S** - Open single stock analysis
- **H** - View history
- **ESC** - Close modal

## 🗄️ File Structure

```
neurobroV6/
├── app.py                    # Main Flask application
├── neurobroV6.py             # Stock screening logic
├── wsgi.py                   # WSGI entry point
├── requirements.txt           # Python dependencies
├── .htaccess                 # Apache configuration
├── templates/
│   ├── dashboard.html        # Main dashboard UI
│   ├── results.html          # Results display
│   └── analysis.html         # Single stock analysis
├── static/
│   ├── css/
│   │   └── terminal.css     # Dark terminal styles
│   └── js/
│       ├── app.js            # Main frontend logic
│       └── charts.js         # Chart configurations
├── tickers_idx.txt           # Stock list
├── free_float_idx.csv       # Free float data
└── screening-*.md           # History results
```

## 🐛 Troubleshooting

### 500 Internal Server Error
```bash
# Check Python error logs
tail -f ~/logs/error_log

# Restart Python app in cPanel
# cPanel → Setup Python App → Restart
```

### SSE Not Working
- Verify mod_wsgi is enabled
- Check firewall allows EventSource
- Try HTTPS instead of HTTP

## 🔒 Security

- Change `FLASK_SECRET_KEY` in production
- Use HTTPS for all connections
- Set up password protection
- Regularly update dependencies

## 📊 Performance

- Screening 947 stocks: ~3-5 minutes
- Single stock analysis: ~5 seconds
- Memory usage: ~150-200MB
- CPU usage: Moderate during screening

---

**Built with ❤️ for Indonesian Stock Market**
*Dark Terminal Edition*
