# First Capital International - Production Deployment Guide

## 🚀 Production Configuration Updated

### **Frontend API URLs Updated**

Both frontend applications now point to the production API:

#### **Customer Dashboard** (`firstcapital-new-landing-dashboard`)
- ✅ **API URL**: `https://api.firstcapitalsint.com/api`
- ✅ **File Updated**: `src/services/api.js`

#### **Admin Panel** (`firstcapital-new-admin`)
- ✅ **API URL**: `https://api.firstcapitalsint.com/api`
- ✅ **File Updated**: `src/services/api.js`

### **Backend Configuration**

#### **Email URLs Updated**
- ✅ **Password Reset Links**: Now use `https://firstcapitalsint.com`
- ✅ **File Updated**: `app/Mail/PasswordResetEmail.php`

## 📋 Deployment Checklist

### **Backend API (Laravel) - `api.firstcapitalsint.com`**

1. **Environment Configuration** (`.env`):
```env
APP_NAME="First Capital International API"
APP_ENV=production
APP_KEY=base64:YOUR_32_CHARACTER_SECRET_KEY
APP_DEBUG=false
APP_URL=https://api.firstcapitalsint.com

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=firstcapitalsint_api
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password

# Email Configuration
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=noreply@firstcapitalsint.com
MAIL_PASSWORD=your_email_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@firstcapitalsint.com
MAIL_FROM_NAME="First Capital International"

# Frontend URLs
FRONTEND_URL=https://firstcapitalsint.com
ADMIN_FRONTEND_URL=https://admin.firstcapitalsint.com

# CORS Configuration
SANCTUM_STATEFUL_DOMAINS=firstcapitalsint.com,admin.firstcapitalsint.com
SESSION_DOMAIN=.firstcapitalsint.com
```

2. **Deploy Commands**:
```bash
# Upload files to server
# Run migrations
php artisan migrate --force

# Clear caches
php artisan config:cache
php artisan route:cache
php artisan view:cache

# Set permissions
chmod -R 755 storage/
chmod -R 755 bootstrap/cache/
```

3. **Web Server Configuration** (Apache/Nginx):
   - Point document root to `public/` directory
   - Enable HTTPS with SSL certificate
   - Configure domain: `api.firstcapitalsint.com`

### **Customer Dashboard - `firstcapitalsint.com`**

1. **Build for Production**:
```bash
cd /path/to/firstcapital-new-landing-dashboard
npm run build
```

2. **Deploy**:
   - Upload `build/` folder contents to web server
   - Configure domain: `firstcapitalsint.com`
   - Enable HTTPS with SSL certificate

### **Admin Panel - `admin.firstcapitalsint.com`**

1. **Build for Production**:
```bash
cd /path/to/firstcapital-new-admin
npm run build
```

2. **Deploy**:
   - Upload `build/` folder contents to web server
   - Configure domain: `admin.firstcapitalsint.com`
   - Enable HTTPS with SSL certificate

## 🔧 Domain Configuration

### **DNS Settings**
Configure these DNS records:

```
A    firstcapitalsint.com           → Your Server IP
A    api.firstcapitalsint.com      → Your Server IP  
A    admin.firstcapitalsint.com    → Your Server IP
CNAME www.firstcapitalsint.com     → firstcapitalsint.com
```

### **SSL Certificates**
Obtain SSL certificates for:
- `firstcapitalsint.com`
- `api.firstcapitalsint.com`
- `admin.firstcapitalsint.com`

## 🛡️ Security Configuration

### **API Security**
1. **CORS**: Configured for production domains
2. **HTTPS**: Required for all communications
3. **Authentication**: JWT tokens with secure storage
4. **Rate Limiting**: API throttling enabled

### **Frontend Security**
1. **HTTPS**: All traffic encrypted
2. **Token Storage**: Secure localStorage usage
3. **API Calls**: All authenticated requests

## 📊 Production URLs

### **Live Applications**
- **Customer App**: `https://firstcapitalsint.com`
- **Admin Panel**: `https://admin.firstcapitalsint.com`
- **API Backend**: `https://api.firstcapitalsint.com`

### **API Endpoints**
- **Auth**: `https://api.firstcapitalsint.com/api/login`
- **Registration**: `https://api.firstcapitalsint.com/api/register`
- **OTP**: `https://api.firstcapitalsint.com/api/verify-otp`
- **Password Reset**: `https://api.firstcapitalsint.com/api/forgot-password`

## ✅ Features Ready for Production

### **Authentication System**
- ✅ Account number + password login
- ✅ OTP verification (enabled by default)
- ✅ Password reset functionality
- ✅ JWT token authentication

### **Admin Management**
- ✅ User management interface
- ✅ OTP status control per user
- ✅ Account management
- ✅ Security monitoring

### **Email System**
- ✅ Welcome emails
- ✅ OTP delivery
- ✅ Password reset links
- ✅ Security notifications
- ✅ Professional branded templates

### **Security Features**
- ✅ OTP rate limiting (3 attempts)
- ✅ Password reset tokens (5-minute expiry)
- ✅ Account lockout protection
- ✅ Audit logging
- ✅ HTTPS required

## 🧪 Testing in Production

### **Pre-Launch Tests**
1. **User Registration**: Test complete signup flow
2. **Login with OTP**: Verify 2FA working
3. **Password Reset**: Test email delivery and reset
4. **Admin Panel**: Verify user management
5. **Email Delivery**: Test all email templates

### **Post-Launch Monitoring**
1. **API Response Times**: Monitor performance
2. **Email Delivery**: Track success rates
3. **OTP Success**: Monitor verification rates
4. **Error Logging**: Watch for issues

## 🎯 Go-Live Steps

1. **Deploy Backend API** to `api.firstcapitalsint.com`
2. **Deploy Customer App** to `firstcapitalsint.com`
3. **Deploy Admin Panel** to `admin.firstcapitalsint.com`
4. **Test All Workflows** with production URLs
5. **Monitor System Health** for first 24 hours

---

**Deployment Status**: ✅ **READY FOR PRODUCTION**  
**Configuration**: ✅ **COMPLETE**  
**Security Level**: 🔒 **BANKING GRADE**  

*All applications are now configured for production deployment with proper domain routing and security measures.*
