# Structure Summary

## Current Structure

```
/var/www/html/mh.maint-data.dev/
├── config/                # Configuration files
│   └── database.php       # Database connection
├── classes/               # PHP classes
│   └── Generator.php      # PageGenerator class
├── templates/             # PHP templates
│   ├── _header.php
│   ├── _footer.php
│   ├── _navigation.php
│   ├── simple_page.php
│   ├── product_category.php
│   └── product_detail.php
├── source_assets/         # Development assets
│   ├── css/
│   ├── js/
│   └── images/
├── generated/             # Apache DocumentRoot
│   ├── assets/            # Public CSS/JS/images
│   ├── buy-models/        # Generated product pages
│   │   └── {category}/{product}/
│   │       ├── index.html
│   │       ├── images...
│   │       ├── *.stl
│   │       └── *.svg
│   ├── products/          # CRUD admin (excluded from deployment)
│   │   ├── index.php      # Admin interface
│   │   └── uploads/       # Product file uploads
│   │       ├── *.jpg
│   │       ├── *.png
│   │       ├── *.stl
│   │       └── *.svg
│   └── *.html             # Simple pages
├── deployments/           # Deployment archives
├── SiteGenerator.php      # Generation script
└── deployment.sh          # Deployment script
```

## Key Features

1. **Root Level Organization**
   - All files at root level (no mds_cms subdirectory)
   - Cleaner structure and simpler paths

2. **generated/** → Apache DocumentRoot
   - vHost points directly to generated/
   - Public site served from here

3. **products/** → CRUD Admin & File Uploads
   - CRUD admin at generated/products/
   - File uploads at generated/products/uploads/
   - Excluded from deployment via deployment_exclude.conf

4. **deployment.sh** → Automated Deployment
   - Creates tarball of generated/
   - Excludes products/ directory from production

## File Flow

1. **Upload**: Files uploaded via CRUD admin → `generated/products/uploads/`
2. **Database**: Filenames saved to database tables
3. **Generation**: `SiteGenerator.php` copies files from uploads → `generated/buy-models/{category}/{product}/`
4. **Deployment**: `deployment.sh` archives `generated/` (excluding `products/`)

## Benefits

✅ **Simpler Paths** - No nested directories
✅ **Direct Serving** - Apache serves generated/ directly
✅ **Database-Driven** - All content and file references in database
✅ **Protected Admin** - CRUD excluded from production deployment
✅ **Automated Deployment** - deployment.sh handles everything
✅ **Single File Source** - All product files in one uploads directory

## Access Points

- **Public Site**: https://dev.handlingdevices.net/
- **Admin CRUD**: https://dev.handlingdevices.net/products/
- **Generated Output**: `/var/www/html/mh.maint-data.dev/generated/`
- **Product Uploads**: `/var/www/html/mh.maint-data.dev/generated/products/uploads/`

## Commands

**Generate Site:**
```bash
cd /var/www/html/mh.maint-data.dev
php SiteGenerator.php
```

**Deploy to Production:**
```bash
cd /var/www/html/mh.maint-data.dev
./deployment.sh
```
