# MyWebsite — Technical Specification Sheet

> **Project Type:** Corporate Website + Admin Dashboard (CMS)  
> **Framework:** Laravel 12

---

## 1. Server Requirements

| Requirement         | Minimum                          | Recommended                      |
|---------------------|----------------------------------|----------------------------------|
| **OS**              | Ubuntu 22.04 LTS / CentOS 8+    | Ubuntu 24.04 LTS                 |
| **Web Server**      | Apache 2.4+ or Nginx 1.18+      | Nginx 1.24+                      |
| **PHP Version**     | PHP 8.2                          | PHP 8.3+                         |
| **Database**        | MySQL 8.0+ / MariaDB 10.6+      | MySQL 8.0+                       |
| **Node.js**         | 18.x (build only)               | 20.x LTS (build only)           |
| **Composer**        | 2.x                             | 2.7+                             |
| **RAM**             | 1 GB                            | 2 GB+                            |
| **Disk Space**      | 2 GB (excl. uploads)            | 5 GB+                            |
| **SSL Certificate** | Required                         | Required (Let's Encrypt / paid)  |

---

## 2. Required PHP Extensions

| Extension        | Purpose                                   |
|------------------|-------------------------------------------|
| `pdo_mysql`      | MySQL database driver                     |
| `mbstring`       | Multi-byte string support (Arabic, etc.)  |
| `openssl`        | Encryption & HTTPS                        |
| `tokenizer`      | Laravel framework                         |
| `xml`            | Sitemap generation                        |
| `ctype`          | Laravel framework                         |
| `json`           | API responses & data handling             |
| `bcmath`         | Math operations                           |
| `fileinfo`       | File upload validation                    |
| `gd` or `imagick`| Image processing (Intervention Image)    |
| `curl`           | External API calls (AI, mail, etc.)       |
| `zip`            | PhpSpreadsheet (Excel import/export)      |
| `intl`           | Internationalization (i18n)               |
| `dom`            | HTML/XML parsing                          |

---

## 3. Technology Stack

| Layer              | Technology                                          |
|--------------------|-----------------------------------------------------|
| **Backend**        | Laravel 12 (PHP 8.2+)                               |
| **Frontend**       | Blade Templates + Bootstrap 5 + Tailwind CSS 3      |
| **Build Tool**     | Vite 6                                               |
| **CSS Preprocessor** | Sass (SCSS)                                       |
| **JavaScript**     | Vanilla JS + Axios                                   |
| **Database**       | MySQL 8.0+ (utf8mb4_unicode_ci)                      |
| **Session Driver** | Database                                              |
| **Cache Driver**   | Array (configurable to Redis/File)                    |
| **File Storage**   | Local disk (public storage with symlink)              |
| **Authentication** | Laravel Auth (Admin guard — separate admin table)     |
| **Authorization**  | Spatie Laravel Permission (Roles & Permissions)       |
| **Localization**   | mcamara/laravel-localization                          |
| **Image Processing** | Intervention Image v3                              |
| **Excel/Spreadsheet** | PhpOffice/PhpSpreadsheet v5                       |
| **Rich Text Editor** | TinyMCE v7                                         |
| **Sitemap**        | Spatie Laravel Sitemap v7                             |
| **PWA**            | Custom Service Worker (sw.js)                         |
| **Encryption**     | AES-256-CBC                                           |

---

## 4. Supported Languages (Multilingual)

| Language | Code |
|----------|------|
| English  | `en` |
| Arabic   | `ar` |


> The site is fully multilingual with RTL support for Arabic.

---

## 5. Application Modules / Features

### 5.1 Public Website (Frontend)
- **Home Page** — Dynamic sliders, sections, statistics, clients, testimonials
- **About Us** — Company info with structured content
- **Services** — Service listing + detail pages with image galleries
- **Products** — Product catalog with categories, sub-products, PDF downloads
- **Brands** — Brand listing with sub-brands and detail pages
- **Projects / Portfolio** — Project showcase with image galleries
- **Blog** — Blog with categories, authors, and detail pages
- **FAQs** — Frequently asked questions
- **Contact Us** — Contact form (rate-limited)
- **Careers** — Job listings + application form with CV upload
- **Finance Applications** — Individual & Company finance application forms with document uploads
- **Partners** — Partner listing
- **Gallery** — Photo albums + Video gallery
- **Team** — Team members page
- **Search** — Site-wide search functionality
- **Categories** — Category listing with detail pages

### 5.2 Admin Dashboard (Backend CMS)
- **Dashboard Home** — Overview statistics
- **Settings** — Global site settings (name, contact, social media, etc.)
- **Configurations** — Language-specific content configurations
- **Content Management:**
  - Services, Products, Projects, Blogs, Categories, Brands
  - Sliders, Sections, FAQs, Benefits, Testimonials, Statistics
  - Clients, Partners, Team Members, Before/After comparisons
  - Albums, Galleries (Photos & Videos), Pages
  - Job Positions, Working Hours, Phones, Site Addresses, Emails
- **User Management:**
  - Admins management
  - Roles & Permissions (Spatie)
- **Applications Management:**
  - Contact messages
  - Career applications (with CV download)
  - Finance applications (approve/reject/assign workflow)
- **Bulk Operations:**
  - Bulk upload (images, data)
  - Excel import/export with templates
  - Bulk delete, status toggle
- **SEO Tools:**
  - SEO Assistants
  - SEO Testing (comprehensive & quick tests)
  - SEO AI Generation (Claude/OpenAI integration)
  - Sitemap generation (XML)
  - Redirect management (301/302)
  - robots.txt (dynamic)
- **AI Content Generation:**
  - AI-powered content generation (Claude AI / OpenAI)
  - AI image generation (Stability AI / OpenAI DALL-E)
- **Performance Monitoring**
- **PWA Settings** — Progressive Web App configuration & icon generation
- **Email Testing** — Send test emails

---

## 6. Database Details

| Property       | Value                             |
|----------------|-----------------------------------|
| **Engine**     | MySQL 8.0+ / MariaDB 10.6+       |
| **Charset**    | `utf8mb4`                         |
| **Collation**  | `utf8mb4_unicode_ci`              |
| **Tables**     | ~87 migration files               |
| **Strict Mode**| Enabled                           |

> JSON columns are used for multilingual content storage (translations stored as JSON objects).

---

## 7. Environment Variables (.env)

The following environment variables need to be configured on the server:

### Core
```
APP_NAME=MyWebsite
APP_ENV=production
APP_KEY=              # Generate with: php artisan key:generate
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=https://your-domain.com
```

### Database
```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mh_tech
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
```

### Session & Cache
```
SESSION_DRIVER=database
SESSION_LIFETIME=120
CACHE_STORE=file          # or redis
```

### Mail (SMTP)
```
MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host
MAIL_PORT=587
MAIL_USERNAME=your-email@domain.com
MAIL_PASSWORD=your-mail-password
MAIL_FROM_ADDRESS=info@your-domain.com
MAIL_FROM_NAME="MyWebsite"
```

### File Storage
```
FILESYSTEM_DISK=local
```

### Optional — AI Services
```
CLAUDE_API_KEY=           # For AI content generation
OPENAI_API_KEY=           # For AI content & image generation
STABILITY_API_KEY=        # For AI image generation
```

### Optional — reCAPTCHA
```
NOCAPTCHA_SECRET=
NOCAPTCHA_SITEKEY=
```

---

## 8. Deployment Steps

```bash
# 1. Clone the repository
git clone <repository-url> /var/www/MyWebsite
cd /var/www/MyWebsite

# 2. Install PHP dependencies
composer install --optimize-autoloader --no-dev

# 3. Copy environment file and configure
cp .env.example .env
# Edit .env with production values

# 4. Generate application key
php artisan key:generate

# 5. Install Node.js dependencies & build assets
npm install
npm run build

# 6. Run database migrations
php artisan migrate --force

# 7. Seed the database (if needed for initial data)
php artisan db:seed --force

# 8. Create storage symlink
php artisan storage:link

# 9. Optimize for production
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache

# 10. Set permissions
chown -R www-data:www-data /var/www/MyWebsite
chmod -R 755 /var/www/MyWebsite
chmod -R 775 /var/www/MyWebsite/storage
chmod -R 775 /var/www/MyWebsite/bootstrap/cache
```

---

## 9. Web Server Configuration

### Nginx (Recommended)

```nginx
server {
    listen 80;
    listen [::]:80;
    server_name your-domain.com www.your-domain.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name your-domain.com www.your-domain.com;
    root /var/www/MyWebsite/public;

    ssl_certificate /path/to/ssl/certificate.crt;
    ssl_certificate_key /path/to/ssl/private.key;

    index index.php;
    charset utf-8;

    # Max upload size
    client_max_body_size 50M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_hide_header X-Powered-By;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

    # Cache static assets
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg|webp)$ {
        expires 30d;
        add_header Cache-Control "public, no-transform";
    }
}
```

### Apache (.htaccess included in Laravel)

Enable these modules:
```
a2enmod rewrite
a2enmod headers
a2enmod ssl
```

---

## 10. File Upload & Storage

| Item                    | Path                              | Notes                                |
|-------------------------|-----------------------------------|--------------------------------------|
| **Public uploads**      | `storage/app/public/`             | Symlinked to `public/storage`        |
| **Career CVs**          | `storage/app/public/`             | PDF/DOC files                        |
| **Finance documents**   | `storage/app/public/`             | Uploaded application documents       |
| **Product PDFs**        | `storage/app/public/`             | Downloadable product specs           |
| **Catalog PDF**         | `storage/app/public/configurations/` | Company catalog file              |
| **Images**              | `storage/app/public/`             | All media images                     |
| **Max upload size**     | Recommended: 50MB                 | Configure in php.ini + web server    |

### PHP Upload Settings (php.ini)
```ini
upload_max_filesize = 50M
post_max_size = 55M
max_execution_time = 300
memory_limit = 256M
```

---

## 11. Security Features

- **CSRF Protection** — All forms protected with CSRF tokens
- **XSS Protection** — Blade templating auto-escapes output
- **SQL Injection** — Eloquent ORM with prepared statements
- **Rate Limiting** — Contact form throttled (2 requests/min)
- **Security Headers** — Custom middleware for security headers (X-Frame-Options, X-Content-Type-Options, etc.)
- **No-Cache Middleware** — Prevents caching of sensitive dashboard pages
- **Secure Cookies** — Configurable HTTPS-only cookies
- **Authentication** — Separate admin guard with dedicated admin table
- **Role-Based Access** — Spatie Permission for granular role/permission control
- **Signed URLs** — Used for secure document downloads
- **Encryption** — AES-256-CBC for all encrypted data

---

## 12. Cron Jobs (Scheduled Tasks)

Add to server crontab:
```cron
* * * * * cd /var/www/MyWebsite && php artisan schedule:run >> /dev/null 2>&1
```

---

## 13. Ports & Firewall

| Port  | Service     | Required |
|-------|-------------|----------|
| 80    | HTTP        | Yes      |
| 443   | HTTPS       | Yes      |
| 3306  | MySQL       | Internal only (block external) |
| 22    | SSH         | For deployment only             |

---

## 14. Backup Recommendations

- **Database:** Daily automated MySQL dump
- **Storage files:** Daily backup of `storage/app/public/`
- **Environment file:** Secure backup of `.env`
- **Retention:** Keep at least 7 days of backups

