# BigCommerce

The WarpSearch app for BigCommerce syncs your catalog into a WarpSearch collection and injects a search widget into your storefront. Coming soon: the app is awaiting BigCommerce App Marketplace review.

## How it works

- Connecting the app registers webhooks and runs an initial catalog sync. Later events enqueue durable jobs to re-fetch products; daily reconciliation repairs missed changes.
- A loader script is added through Script Manager and loads the shared search widget: a search box, results, multi-select facets, sorting and paging.
- The widget searches through the app's `/api/search` proxy, which holds the WarpSearch key, so the key never reaches the browser.

## Running it yourself

WarpSearch operators deploy the managed backend and register the platform app. Once enabled,
merchants use **Console > Integrations**, authorize BigCommerce and confirm their WarpSearch
organization as an organization admin. Onboarding provisions a dedicated collection and server-held
key, and installs the Stencil search script. Merchants do not host a service. The connection uses
the organization's current plan and collection limits.

The console provides status, resync and disconnect. Disconnect removes indexed products, hooks,
the storefront script and credentials, leaving the empty collection. Channel/locale-specific
catalog overrides and customer-specific prices are not implemented.

For development, the repository also includes a standalone file-backed Node server. It does not
provide the managed service's durable jobs or organization onboarding. It needs the
[shared setup](integrations.md) and a draft app in the BigCommerce Developer Portal:

1. Create the draft app with these callbacks, where `PUBLIC_URL` is where you host the service: auth `{PUBLIC_URL}/auth`, load `{PUBLIC_URL}/load`, uninstall `{PUBLIC_URL}/uninstall`, remove user `{PUBLIC_URL}/remove_user`.
2. Set scopes to Products read-only, Information & Settings read-only, and Content modify.
3. Set the environment: `PUBLIC_URL`, `BC_CLIENT_ID`, `BC_CLIENT_SECRET`, `WARP_API_URL`, `WARP_WRITER_KEY`, `WARP_COLLECTION` and `WEBHOOK_SECRET_MASTER`.
4. Run it behind HTTPS on port 443 and install it on a sandbox store.
