# Deployment Checklist

Use this checklist to ensure your Invoice Generator application is ready for deployment.

## Pre-Deployment

### Files Ready
- [x] Production assets built (`npm run build`)
- [x] `.env.example` file present
- [x] All migrations ready
- [x] Error pages created
- [x] Documentation included

### Code Quality
- [ ] All tests passing (if applicable)
- [ ] Code reviewed
- [ ] Security vulnerabilities checked
- [ ] No debug code left in production

### Configuration
- [ ] `APP_ENV=production` set in `.env.example`
- [ ] `APP_DEBUG=false` set in `.env.example`
- [ ] Database configuration ready in `.env.example`
- [ ] Mail configuration ready in `.env.example`

## Deployment Package Contents

The deployment zip should include:

### Included
- ✅ All application code (`app/`, `routes/`, `resources/`, etc.)
- ✅ Configuration files (`config/`, `composer.json`, etc.)
- ✅ Database migrations (`database/migrations/`)
- ✅ Public assets and compiled builds (`public/`)
- ✅ Documentation files (`DEPLOYMENT.md`, `README.md`, etc.)
- ✅ Vendor dependencies (`vendor/`) - optional, can be installed via composer

### Excluded
- ❌ `node_modules/` (reinstall with `npm install`)
- ❌ `.env` file (copy from `.env.example` on server)
- ❌ Cache files (`storage/framework/cache`, `bootstrap/cache`)
- ❌ Log files (`storage/logs`)
- ❌ Session files (`storage/framework/sessions`)
- ❌ Compiled views (`storage/framework/views`)
- ❌ `.git/` folder
- ❌ IDE files (`.idea/`, `.vscode/`, etc.)

## Post-Deployment on Server

### Initial Setup
- [ ] Upload and extract zip file
- [ ] Copy `.env.example` to `.env`
- [ ] Set `APP_KEY` with `php artisan key:generate`
- [ ] Configure database settings in `.env`
- [ ] Set file permissions (storage, bootstrap/cache)
- [ ] Run `composer install --optimize-autoloader --no-dev`
- [ ] Run `php artisan migrate`
- [ ] Run `php artisan storage:link`
- [ ] Build assets if needed: `npm install && npm run build`

### Optimization
- [ ] Cache config: `php artisan config:cache`
- [ ] Cache routes: `php artisan route:cache`
- [ ] Cache views: `php artisan view:cache`

### Verification
- [ ] Test homepage loads
- [ ] Test user registration
- [ ] Test user login
- [ ] Test invoice creation
- [ ] Test PDF generation
- [ ] Test file uploads (company logo)
- [ ] Test all error pages (404, 500, etc.)

### Security
- [ ] `APP_DEBUG=false` verified
- [ ] SSL/HTTPS enabled
- [ ] `.env` file permissions secure (600 or 640)
- [ ] File permissions set correctly
- [ ] Firewall rules configured
- [ ] Regular backup schedule set up

## Creating the Deployment Zip

### Option 1: Using PowerShell (Windows)
```powershell
.\create-deployment-zip.ps1
```

### Option 2: Using Bash Script (Linux/Mac/Git Bash)
```bash
chmod +x create-deployment-zip.sh
./create-deployment-zip.sh
```

### Option 3: Manual Creation
1. Use 7-Zip, WinRAR, or similar tool
2. Select all files in the project folder
3. Exclude:
   - `node_modules/`
   - `.git/`
   - `.env`
   - `storage/logs/`
   - `storage/framework/cache/data/`
   - `storage/framework/sessions/`
   - `storage/framework/views/`
   - `bootstrap/cache/`
   - `*.log` files
4. Create zip file named `Invoice-generator-deployment.zip`

## File Sizes Expected

- **Full project**: ~50-100 MB (with vendor)
- **Without vendor**: ~5-10 MB (install with composer on server)
- **Compressed zip**: ~10-30 MB (varies)

## Notes

- The `vendor/` folder can be included or excluded:
  - **Include**: Faster deployment, no composer needed on server
  - **Exclude**: Smaller zip, ensures fresh dependencies on server

- The `node_modules/` should always be excluded (too large)

- Make sure to stop any running Laravel development servers before creating the zip

