# Deployment and Sync Guide

This project is prepared for file-based deployment syncs to a web server.

## 1) Prepare production environment file

1. Copy `.env.production.example` to `.env.production`.
2. Fill real production values (database, mail, app URL, keys).
3. Do not commit secrets.

## 2) Build production assets locally (optional)

```powershell
composer install --no-dev --optimize-autoloader
npm ci
npm run build
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

## 3) Sync project files to server path

Use the provided PowerShell script:

```powershell
powershell -ExecutionPolicy Bypass -File .\deploy\sync.ps1 -TargetPath "\\server\wwwroot\your-app"
```

Optional mirror mode (deletes files in target that are not in source):

```powershell
powershell -ExecutionPolicy Bypass -File .\deploy\sync.ps1 -TargetPath "\\server\wwwroot\your-app" -Mirror
```

Exclusions are configured in:

- `deploy/exclude-dirs.txt`
- `deploy/exclude-files.txt`

## 4) Run server-side Laravel commands

After syncing, run these on the server release path:

```bash
php artisan migrate --force
php artisan storage:link
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

## 5) Recommended server writable paths

- `storage/`
- `bootstrap/cache/`

Make sure web server ownership and write permissions are correct.