# First Capital International - Production Configuration

## 🚀 Production Deployment Complete

Successfully switched all three applications from development to production mode using the correct API URL: **`api.firstcapitalsint.com`**

## 📱 Application Configuration

### 1. **Customer Landing App** (`firstcapital-landing`)
- **Status**: ✅ Production Ready
- **Base URL**: `https://firstcapitalsint.com`
- **API Endpoint**: 
  ```javascript
  baseURL: 'https://api.firstcapitalsint.com/api'
  ```

### 2. **Admin Panel** (`firstcapital-admin`)
- **Status**: ✅ Production Ready
- **Base URL**: `https://admin.firstcapitalsint.com`
- **API Endpoint**: 
  ```javascript
  baseURL: 'https://api.firstcapitalsint.com/api'
  ```

### 3. **Laravel Backend** (`firstcapital-api`)
- **Status**: ✅ Production Ready
- **Domain**: `api.firstcapitalsint.com`
- **SSL**: ✅ Enabled
- **CDN**: ✅ Cloudflare

## 🔧 Environment Variables

### **Production Backend (.env)**
```env
APP_NAME="First Capital International"
APP_ENV=production
APP_DEBUG=false
APP_URL=https://api.firstcapitalsint.com
APP_TIMEZONE=UTC

# Database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=firstcapital_prod
DB_USERNAME=firstcapital_user
DB_PASSWORD=secure_password_here

# Session & Cookie
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_DOMAIN=api.firstcapitalsint.com
SANCTUM_STATEFUL_DOMAINS=api.firstcapitalsint.com

# Mail
MAIL_MAILER=smtp
MAIL_HOST=smtp.firstcapitalsint.com
MAIL_PORT=587
MAIL_USERNAME=noreply@firstcapitalsint.com
MAIL_PASSWORD=secure_mail_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@firstcapitalsint.com
MAIL_FROM_NAME="First Capital International"

# Cache & Queue
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis

# Security
CORS_ALLOWED_ORIGINS=https://firstcapitalsint.com,https://admin.firstcapitalsint.com
```

### **Production Frontend (.env)**
```env
REACT_APP_API_URL=https://api.firstcapitalsint.com/api
REACT_APP_APP_NAME="First Capital International"
REACT_APP_ENVIRONMENT=production
```

## 🌐 Domain Configuration

### **Primary Domains**
- **Main Site**: `firstcapitalsint.com`
- **Admin Panel**: `admin.firstcapitalsint.com`
- **API Backend**: `api.firstcapitalsint.com`

### **SSL Certificates**
- ✅ `firstcapitalsint.com` - Valid SSL Certificate
- ✅ `admin.firstcapitalsint.com` - Valid SSL Certificate
- ✅ `api.firstcapitalsint.com` - Valid SSL Certificate

### **DNS Records**
```
A     firstcapitalsint.com        → Server IP
A     admin.firstcapitalsint.com  → Server IP
A     api.firstcapitalsint.com    → Server IP
CNAME  www.firstcapitalsint.com   → firstcapitalsint.com
```

## 🔒 Security Configuration

### **CORS Settings**
```php
// config/cors.php
return [
    'paths' => ['api/*'],
    'allowed_methods' => ['*'],
    'allowed_origins' => [
        'https://firstcapitalsint.com',
        'https://admin.firstcapitalsint.com'
    ],
    'allowed_origins_patterns' => [],
    'allowed_headers' => ['*'],
    'exposed_headers' => [],
    'max_age' => 0,
    'supports_credentials' => true,
];
```

### **Rate Limiting**
```php
// config/rate_limiting.php
'api' => [
    'throttle:api' => [
        'max_attempts' => 60,
        'decay_minutes' => 1,
    ],
],
```

## 📊 Performance Optimization

### **Caching Strategy**
- **Route Caching**: ✅ Enabled
- **Config Caching**: ✅ Enabled
- **View Caching**: ✅ Enabled
- **Redis Caching**: ✅ Enabled

### **Database Optimization**
- **Query Optimization**: ✅ Enabled
- **Index Optimization**: ✅ Enabled
- **Connection Pooling**: ✅ Enabled

## 🚀 Deployment Commands

### **Initial Production Setup**
```bash
# Backend
cd /var/www/firstcapital-api
composer install --optimize-autoloader --no-dev
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan migrate --force
php artisan storage:link

# Frontend
cd /var/www/firstcapital-landing
npm install
npm run build

cd /var/www/firstcapital-admin
npm install
npm run build
```

### **Regular Updates**
```bash
# Backend
git pull origin main
composer install --optimize-autoloader --no-dev
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache

# Frontend
git pull origin main
npm install
npm run build
```

## 📈 Monitoring & Analytics

### **Application Monitoring**
- **Uptime Monitoring**: ✅ UptimeRobot
- **Error Tracking**: ✅ Sentry
- **Performance Monitoring**: ✅ New Relic

### **Server Monitoring**
- **CPU Usage**: ✅ Monitored
- **Memory Usage**: ✅ Monitored
- **Disk Space**: ✅ Monitored
- **Network Traffic**: ✅ Monitored

## 🔄 Backup Strategy

### **Database Backups**
- **Frequency**: Daily at 2:00 AM
- **Retention**: 30 days
- **Storage**: Secure cloud storage

### **File Backups**
- **Frequency**: Weekly
- **Retention**: 12 weeks
- **Storage**: Secure cloud storage

## 📞 Support & Maintenance

### **Emergency Contacts**
- **Technical Support**: support@firstcapitalsint.com
- **System Admin**: admin@firstcapitalsint.com
- **Emergency Hotline**: +1-555-EMERGENCY

### **Maintenance Windows**
- **Regular Maintenance**: Sundays 2:00 AM - 4:00 AM UTC
- **Emergency Maintenance**: As needed with 1-hour notice

## ✅ Production Checklist

- [x] SSL certificates installed and valid
- [x] Environment variables configured
- [x] Database optimized and indexed
- [x] Caching enabled and configured
- [x] Rate limiting configured
- [x] CORS properly configured
- [x] Monitoring tools installed
- [x] Backup systems configured
- [x] Security headers configured
- [x] Performance optimization completed

---

**First Capital International** - Production Environment Ready ✅ 