{"id":17799118,"url":"https://github.com/asjas/fastify-shopify-graphql-proxy","last_synced_at":"2025-03-17T05:32:15.751Z","repository":{"id":37067676,"uuid":"264318493","full_name":"Asjas/fastify-shopify-graphql-proxy","owner":"Asjas","description":"A Fastify plugin to proxy requests to the Shopify GraphQL API","archived":true,"fork":false,"pushed_at":"2025-02-04T01:50:31.000Z","size":2566,"stargazers_count":6,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T22:49:32.876Z","etag":null,"topics":["fastify","fastify-plugin","shopify","shopify-graphql-proxy"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Asjas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-15T23:14:43.000Z","updated_at":"2025-02-06T11:21:08.000Z","dependencies_parsed_at":"2023-12-19T22:27:46.339Z","dependency_job_id":"b0021caa-b7ba-40c1-b5fc-3b46e9dce5ff","html_url":"https://github.com/Asjas/fastify-shopify-graphql-proxy","commit_stats":{"total_commits":667,"total_committers":5,"mean_commits":133.4,"dds":0.5997001499250375,"last_synced_commit":"201d9e02a9059a6a3f68cbac580ab7f05c6a4493"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asjas%2Ffastify-shopify-graphql-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asjas%2Ffastify-shopify-graphql-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asjas%2Ffastify-shopify-graphql-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asjas%2Ffastify-shopify-graphql-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Asjas","download_url":"https://codeload.github.com/Asjas/fastify-shopify-graphql-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243981331,"owners_count":20378557,"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":["fastify","fastify-plugin","shopify","shopify-graphql-proxy"],"created_at":"2024-10-27T12:05:23.595Z","updated_at":"2025-03-17T05:32:15.070Z","avatar_url":"https://github.com/Asjas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `fastify-shopify-graphql-proxy`\n\n[![License: Hippocratic 3.0](https://img.shields.io/badge/License-Hippocratic_3.0-lightgrey.svg)](https://firstdonoharm.dev)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![npm version](https://badge.fury.io/js/fastify-shopify-graphql-proxy.svg)](https://badge.fury.io/js/fastify-shopify-graphql-proxy)\n[![codecov](https://codecov.io/gh/Asjas/fastify-shopify-graphql-proxy/branch/master/graph/badge.svg?token=IHWSO9MQ7B)](https://codecov.io/gh/Asjas/fastify-shopify-graphql-proxy)\n[![Main WorkFlow](https://github.com/Asjas/fastify-shopify-graphql-proxy/actions/workflows/main.yml/badge.svg)](https://github.com/Asjas/fastify-shopify-graphql-proxy/actions/workflows/main.yml)\n[![CodeQL WorkFlow](https://github.com/Asjas/fastify-shopify-graphql-proxy/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Asjas/fastify-shopify-graphql-proxy/actions/workflows/codeql-analysis.yml)\n\n`fastify-shopify-graphql-proxy` is a plugin for the [Fastify](https://github.com/fastify/fastify) framework that is\nbased on [koa-shopify-graphql-proxy](https://github.com/Shopify/quilt/tree/master/packages/koa-shopify-graphql-proxy).\nIt allows for proxying of GraphQL requests from an embedded Shopify app to Shopify's GraphQL API.\n\nAny `POST` request made to `/graphql` will be proxied to Shopify's GraphQL API and the response will be returned.\n\n## Supported Fastify versions\n\n- Fastify v4.x\n\n## Supported Node.js versions\n\nThe latest versions of the following Node.js versions are tested and supported.\n\n- 16\n- 18\n\n## Quick Start\n\nInstall the package using `npm`:\n\n```sh\nnpm i --save-exact fastify-shopify-graphql-proxy\n```\n\nor `yarn`:\n\n```sh\nyarn add fastify-shopify-graphql-proxy\n```\n\nor `pnpm`:\n\n```sh\npnpm add --save-exact fastify-shopify-graphql-proxy\n```\n\n## Code Examples\n\n### Custom App\n\nIf you are creating a [Custom Shopify app](https://help.shopify.com/en/manual/apps/custom-apps), you can skip over the\nauth step and provide the `shop` URL and `accessToken`.\n\n```js\nimport shopifyGraphQLProxy, { ApiVersion } from \"fastify-shopify-graphql-proxy\";\nimport Fastify from \"fastify\";\n\nconst server = Fastify({\n  logger: true,\n});\n\nawait server.register(shopifyGraphQLProxy, {\n  shop: \"https://my-shopify-store.myshopify.com\",\n  version: ApiVersion.Stable,\n  accessToken: \"SHOPIFY_API_ACCESS_TOKEN\",\n});\n\nserver.listen({ port: 3000 }, function (err, address) {\n  if (err) {\n    server.log.error(err);\n    process.exit(1);\n  }\n\n  server.log.info(`server listening on ${address}`);\n});\n```\n\n### Public App (Not currently possible)\n\nThis Fastify plugin will get the shop url and AccessToken from the current session of the logged-in store. _Note:_ You\nwill need to use `fastify-session` for this to work.\n\n```js\nimport fastifyCookie from \"fastify-cookie\";\nimport fastifySession from \"@fastify/session\";\nimport createShopifyAuth from \"fastify-shopify-auth\";\nimport shopifyGraphQLProxy, { ApiVersion } from \"fastify-shopify-graphql-proxy\";\nimport Fastify from \"fastify\";\n\nconst server = Fastify({\n  logger: true,\n});\n\nawait server.register(fastifyCookie);\nawait server.register(fastifySession, { secret: \"a secret with a minimum length of 32 characters\" });\n\nawait server.register(\n  await createShopifyAuth({\n    /* your config here */\n  }),\n);\n\nawait server.register(shopifyGraphQLProxy, {\n  version: ApiVersion.Stable, // API Version \"2022-04\"\n});\n\nserver.listen({ port: 3000 }, function (err, address) {\n  if (err) {\n    server.log.error(err);\n    process.exit(1);\n  }\n\n  server.log.info(`server listening on ${address}`);\n});\n```\n\n## API\n\n### `shopifyGraphQLProxy(opts)`\n\nOptions:\n\n- `shop` (Optional): a string value that is the Shopify URL for your store. Gets value from `session` if available.\n- `accessToken` (Optional): a string value that is the Custom App API Key. Gets value from `session` if available.\n- `version` (Optional): Shopify GraphQL version (example: `\"2022-04\"`).\n- `prefix` (Optional): You can set a `custom path` for the shopifyGraphQLProxy GraphQL endpoint by specifying a route\n  prefix.\n\nHere are all the Shopify API GraphQL versions that can be imported from the enum `ApiVersion` and used such as\n`ApiVersion.April22`:\n\n```sh\nOctober22 = \"2022-10\"\nJuly22 = \"2022-07\"\nApril22 = \"2022-04\"\nJanuary22 = \"2022-01\"\nOctober21 = \"2021-10\"\nStable = \"2022-10\"\nUnstable = 'Unstable'\nUnversioned = 'unversioned'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasjas%2Ffastify-shopify-graphql-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasjas%2Ffastify-shopify-graphql-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasjas%2Ffastify-shopify-graphql-proxy/lists"}