# Imprint Logic – Deployment Guide

This document describes what to change when deploying the Imprint Logic backend from local development to a hosted environment.

---

## 1. Backend (Laravel)

### Environment (`.env`)

- **APP_URL** → Your production URL (e.g. `https://api.yourdomain.com`)
- **APP_ENV** → `production`
- **APP_DEBUG** → `false`
- **Database, cache, queue, etc.** → Configure for your hosting provider

### CORS

Current config (`allowed_origins: ['*']`, Shopify domain patterns) works in production. No changes needed unless you want to restrict origins.

### Deployment steps

- Run migrations: `php artisan migrate --force`
- Cache config: `php artisan config:cache`
- Cache routes: `php artisan route:cache`
- Set up queue workers, scheduler, etc. if used

---

## 2. Frontend (Shopify app)

### Environment (`.env`)

- **BACKEND_URL** → Production API base URL (e.g. `https://api.yourdomain.com`)
- **VITE_BACKEND_URL** → Same value (used at build time)

### Config (`app/config.js`)

Update `DEFAULT_BACKEND_URL` if you use a hardcoded fallback, or rely on env vars.

---

## 3. Theme extension (product-imprint-pricing block)

The block has a “Backend API URL” setting. In production:

- **Direct API**: Merchants enter `https://api.yourdomain.com` (no trailing slash).
- **App Proxy (recommended)**: Configure the proxy in Shopify Partners; the block uses a path like `/apps/imprint-pricing/...` instead of a full URL.

---

## 4. ngrok header

The `ngrok-skip-browser-warning` header in the product block is only needed for ngrok. On production hosting it has no effect. You can remove it or leave it in place.

---

## 5. Shopify app configuration

- **App URL** → Production app/frontend URL
- **Allowed redirect URLs** → Include your production URLs
- **App Proxy** (if used):
  - Subpath prefix: e.g. `apps/imprint-pricing`
  - Proxy URL: e.g. `https://api.yourdomain.com`

---

## 6. Deployment checklist

| Item | Change |
|------|--------|
| Laravel `APP_URL` | Production URL |
| Laravel DB, cache, etc. | Production credentials |
| Frontend `BACKEND_URL` | Production API URL |
| Frontend `VITE_BACKEND_URL` | Same as above |
| Block “Backend API URL” | Production API URL or App Proxy path |
| `ngrok-skip-browser-warning` | Optional: remove in production |
| Shopify app URLs | Production URLs |
