## Deployment notes for Giftly app

This app is different from some of your other Shopify apps because it includes a **JavaScript Shopify Function** (`extensions/auto-add-gift`) that must be compiled to WebAssembly (`function.wasm`) using the Shopify CLI and its `javy` binary.

On your VPS, the global Shopify CLI uses **`javy-7.0.1`**, which requires a newer C++ runtime symbol `GLIBCXX_3.4.30`. The VPS `libstdc++` is older, so whenever the CLI tries to build the function there, you see errors like:

```text
/usr/local/lib/node_modules/@shopify/cli/bin/javy-7.0.1: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.30' not found
Failed to build function.
```

Because of this, you **should NOT rely on the VPS to run `shopify app build` for this project**. Doing so will continue to fail unless you upgrade system libraries or wrap the CLI in Docker.

### Recommended deployment flow (safe, future‑proof)

1. **Build and deploy from a local dev machine or a modern CI runner**, not the VPS.

   On your local machine (macOS/Windows/Linux with a recent toolchain):

   ```bash
   cd /path/to/giftly.expoundenterprise.com

   # Build all extensions (including the JS Function)
   shopify app build

   # Deploy app, theme extension and function to Shopify
   shopify app deploy
   ```

2. The VPS should be treated as a **runtime only** for the Laravel/PHP app:
   - You can still pull/push code there with git, run migrations, queue workers, etc.
   - But do **not** depend on it to compile the `auto-add-gift` function.

3. If you ever see the `GLIBCXX_3.4.30 not found` error again, remember:
   - It is a **server toolchain issue** (old `libstdc++`), not an application bug.
   - The fix is to build from a machine/container with a newer C++ runtime (local dev, CI, or Docker), then deploy from there.

### Alternatives (if you ever want to change this)

If you decide later that you *must* build on the VPS, you have two options (both change the server environment, so use with caution):

- **Docker wrapper for the CLI**  
  Run `shopify app build` inside a modern Docker image (e.g. `node:20-bullseye`) mounted to your project directory so the container’s newer `libstdc++` is used.

- **Upgrade `libstdc++` on the VPS**  
  Only if you control the OS and are comfortable upgrading system libraries (e.g. `sudo dnf upgrade libstdc++`). This may affect other apps on the server, so it’s riskier.

For your setup, the safest and simplest long‑term rule is:

> **Always build and deploy this app (Giftly) from a local/CI machine with a modern toolchain, not from the VPS.**

