Connecting Shopify is a one-time per-store action. After OAuth, every project on the same account inherits the connection unless overridden, and deploys automatically receive the right env vars.Documentation Index
Fetch the complete documentation index at: https://docs.hiveku.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
A Shopify store
A live or development Shopify store. Hiveku works with any plan (Basic and up). For native subscriptions you’ll also need Shopify Payments turned on — see Subscriptions.
Owner or admin role on the Hiveku account
Connecting a store writes account-scoped credentials. Member-role users can’t initiate the OAuth flow.
The OAuth flow
Click "Connect a store"
A modal asks for two inputs:
- Shop domain — the permanent
*.myshopify.comdomain (not your custom domain). Example:acme.myshopify.com. - OAuth app — picked from the apps you registered in Hiveku settings. If you only have one, it’s preselected.
Authorize on Shopify
Hiveku opens a popup pointing at
https://{shop}.myshopify.com/admin/oauth/authorize. The merchant approves the requested scopes (read_products, write_products, read_orders, read_customers, etc.).Hiveku finishes the handshake
The popup closes automatically. Behind the scenes:
- Hiveku exchanges the OAuth code for an Admin API access token.
- A Storefront API token is minted via Admin GraphQL
storefrontAccessTokenCreate. - Both tokens are encrypted at rest with
SHOPIFY_TOKEN_ENCRYPTION_KEY(AES-256-GCM envelope). - Webhook subscriptions are registered for the topics Hiveku needs (orders, products, subscription events, GDPR compliance).
- The connection appears as Active in the settings UI.
The shop domain you enter must match what Shopify’s OAuth callback returns. The builder verifies the
?shop= query param against the domain you submitted to defend against shop-substitution attacks.Account-default vs project-override
Hiveku’s Shopify connections follow a two-level model that’s optimized for agency users.Account default (the common case)
The first store you connect on an account becomes the account default. Every project under that account automatically uses this connection — no per-project setup needed.Project override (multi-shop agencies)
When a Hiveku account manages multiple brands, you can override the connection at the project level:
You can also set a project to Disabled — useful when one project in a multi-shop account shouldn’t have any Shopify connection (a marketing site, for example).
What gets stored
Hiveku stores the bare minimum to operate the integration:| Field | Storage |
|---|---|
| Admin API access token | Encrypted at rest (SHOPIFY_TOKEN_ENCRYPTION_KEY) |
| Storefront API token | Encrypted at rest |
| Webhook secret | Encrypted at rest |
| Shop domain, shop id, shop name | Plain (used for routing webhooks + UI display) |
| Granted OAuth scopes | Plain (compared against required scopes to detect drift) |
installed_at, disconnected_at, last_synced_at | Plain (lifecycle tracking) |
/api/builder/shopify/connections) deliberately omits encrypted columns even from its select.
Multiple stores on one account
You can connect any number of Shopify stores. Only one can be the account default at a time; the rest are flaggedpurpose: 'project_override' and selectable as overrides.
To swap defaults: disconnect the current default, then reconnect the store you want as the new default. Or connect both, then update purpose via admin tooling.
Disconnecting
Disconnect from Hiveku
Click Disconnect on the connection in
/dashboard/commerce/settings/shopify. Hiveku marks the row disconnected_at = now(), stops registering webhook events, and clears the credentials from the next deploy. The Admin token is not force-revoked at Shopify — your Shopify admin can also un-install the app to be thorough.Reconnecting
If a store was previously connected, disconnecting and re-running OAuth updates the same row (matched byshop_domain) — webhook subscriptions, encrypted tokens, and timestamps all refresh in place. Project-level overrides survive.
What’s next
Build the storefront
What the AI agent scaffolds after a connection is active.
Adding to an existing Next.js project
Pre-flight compat check + dry-run for retrofits.