{"id":21525827,"url":"https://github.com/bkwld/cloak-shopify","last_synced_at":"2026-05-20T02:42:09.550Z","repository":{"id":37583898,"uuid":"479995968","full_name":"BKWLD/cloak-shopify","owner":"BKWLD","description":"Shopify Storefront API client and related helpers.","archived":false,"fork":false,"pushed_at":"2023-10-11T15:35:44.000Z","size":313,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-05T10:02:03.635Z","etag":null,"topics":["nuxt-module","shopify"],"latest_commit_sha":null,"homepage":"https://cloak-shopify.netlify.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BKWLD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-10T11:24:39.000Z","updated_at":"2022-12-08T00:14:08.000Z","dependencies_parsed_at":"2023-10-11T20:44:13.421Z","dependency_job_id":null,"html_url":"https://github.com/BKWLD/cloak-shopify","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"1d4a7a1589738fbab0099f43f05d032112491fa4"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fcloak-shopify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fcloak-shopify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fcloak-shopify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fcloak-shopify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BKWLD","download_url":"https://codeload.github.com/BKWLD/cloak-shopify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244085008,"owners_count":20395523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nuxt-module","shopify"],"created_at":"2024-11-24T01:38:37.377Z","updated_at":"2026-05-20T02:42:09.488Z","avatar_url":"https://github.com/BKWLD.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @cloak-app/shopify\n\nShopify Storefront API client and related helpers.\n\n- [View demo](https://cloak-shopify.netlify.app)\n- [Edit CodeSandbox](https://githubbox.com/BKWLD/cloak-shopify)\n\n## Install\n\n1. Install with `yarn add @cloak-app/shopify`\n2. Add to `nuxt.config` with `buildModules: ['@cloak-app/shopify']`\n\n### Module Options\n\nSet these properties within `cloak: { shopify: { ... } }` in the nuxt.config.js:\n\n- `url` - Your public Shopify store URL, for example: https://brand.myshopify.com or https://shop.brand.com.  Defaults to `process.env.SHOPIFY_URL`.\n- `storefront:`\n  - `token` - The Storefront API token of your custom app.  Defaults to `process.env.SHOPIFY_STOREFRONT_TOKEN`.\n  - `language` - A Storefront API recognized [LanguageCode](https://shopify.dev/api/storefront/2022-10/enums/LanguageCode).  Defaults to the 1st part of `process.env.CMS_SITE` if it is ISO-like (ex: if `en_US` or `en-US` then `EN`).\n  - `country` - A Storefront API recognized [CountryCode](https://shopify.dev/api/storefront/2022-10/enums/CountryCode).  Defaults to the 2nd part of `process.env.CMS_SITE` if it is ISO-like (ex: if `en_US` or `en-US` then `US`).\n  - `injectClient` - Boolean for whether to inject the `$storefront` client globally.  Defaults to `true`.  You would set this to `false` when this module is a depedency of another module (like [@cloak-app/algolia](https://github.com/BKWLD/cloak-algolia)) that is creating `$storefront` a different way.\n- `mocks` - An array of objects for use with [`mockAxiosGql`](https://github.com/BKWLD/cloak-utils/blob/main/src/axios.js).\n\n## Usage\n\n### Inside of Nuxt app\n\nThe [`storefront` Nuxt plugin](./plugins/storefront.js) injects `$storefront` globally.  This is an Axios instance with it's `baseUrl` set to `cloak.shopify.endpoint`.  In addition, you can call:\n\n- `$storefront.execute({ query, variables })` - Executes a GraphQL request that automatically adds a `site` GraphQL variable with the value from the `cloak.craft.site` value.\n\n### Inside of Nuxt module\n\nYou can use the `makeModuleStorefrontClient()` factory method within a Nuxt module to build a `$storefront` instance.  In a module, we can't use the instance that is injected by the `storefront-client` plugin because that is constructed later in the lifecycle.\n\n```js\n// A Nuxt module\nimport { makeModuleStorefrontClient } from '@cloak-app/shopify/factories'\nexport default function() {\n  const $storefront = makeModuleStorefrontClient(this)\n}\n```\n\n### Outside of Nuxt\n\nYou can make an instance of the Storefront Axios client when outside of Nuxt (like in a Shopify JS entry point) as follows:\n\n```js\nimport { makeStorefrontClient } from '@cloak-app/shopify/factories'\nimport mergeClientHelpers from '@cloak-app/shopify/factories/merge-helpers'\nconst storefront = mergeClientHelpers(makeStorefrontClient({\n  url: process.env.SHOPIFY_URL,\n  token: process.env.SHOPIFY_STOREFRONT_TOKEN,\n}))\n\n// Optional, inject it globally into Vue components\nimport Vue from 'vue'\nVue.prototype.$storefront = storefront\n```\n\n## Contributing\n\nRun `yarn dev` to open a Nuxt dev build of [the demo directory](./demo).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fcloak-shopify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkwld%2Fcloak-shopify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fcloak-shopify/lists"}