# Saleor Core Extensions - Rapid Development Setup ## Quick Start for Local Development Instead of the slow Docker → K8s → Saleor cycle, use this rapid development workflow: ### 1. Start Local Development Server with Tunnel ```bash cd /home/unchained/saleor-core-extensions npm run dev:tunnel ``` This will: - Start the Next.js dev server on http://localhost:3000 - Create a public tunnel URL (e.g., https://abc123.loca.lt) - Display the manifest URL to use in Saleor ### 2. Install App in Saleor Dashboard 1. Go to https://dashboard.manoonoils.com 2. Navigate to **Apps → Install external app** 3. Paste the tunnel manifest URL shown in the terminal (e.g., `https://abc123.loca.lt/api/manifest`) 4. Click **Install** ### 3. Test Changes Instantly - Make code changes in `/src/pages/api/` - Changes auto-reload immediately - Saleor sees updates via the tunnel instantly - **No Docker rebuild needed!** ### 4. When Ready for Production Once everything works locally: ```bash # Build and push production image docker build -t ghcr.io/unchainedio/saleor-core-extensions:n8n-webhooks . docker push ghcr.io/unchainedio/saleor-core-extensions:n8n-webhooks # Deploy to K8s (Flux will pick it up automatically) ``` ## How Tunnels Work ``` ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ │ Your Local App │ ←──── │ Tunnel Service │ ←──── │ Saleor Cloud │ │ localhost:3000 │ │ (localtunnel) │ │ Webhooks │ └─────────────────┘ └──────────────────┘ └─────────────────┘ │ │ │ │ Auto-reload on save │ Public HTTPS URL │ Triggers webhooks └────────────────────────────┴────────────────────────────┘ ``` ## Environment Variables for Local Dev Create `.env.local`: ```env # Use tunnel URL for Saleor API APP_IFRAME_BASE_URL=https://YOUR_TUNNEL_URL.loca.lt APP_API_BASE_URL=https://YOUR_TUNNEL_URL.loca.lt # Point to your Saleor instance SALEOR_API_URL=https://api.manoonoils.com/graphql/ # Email settings (optional for testing) RESEND_API_KEY=test FROM_EMAIL=support@mail.manoonoils.com ``` ## Troubleshooting ### Tunnel disconnects - Just restart `npm run dev:tunnel` - Update the manifest URL in Saleor with the new tunnel URL ### "Invalid manifest" error - Check the tunnel URL is accessible: `curl https://YOUR_TUNNEL.loca.lt/api/manifest` - Ensure `allowedSaleorApiUrls` includes your Saleor URL ### Changes not reflecting - The dev server has hot reload - If stuck, press `Ctrl+C` and restart `npm run dev:tunnel` ## Why This Is Better | Method | Feedback Loop | Setup Time | |--------|--------------|------------| | Docker → K8s → Saleor | 5-10 minutes per change | Complex | | Local + Tunnel | **Instant** (seconds) | Simple | ## Current Status The Docker image is already deployed and working. This tunnel setup is for **rapid development and testing** before committing changes.