🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

shopify-graphql

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shopify-graphql

Add your description here

0.1.0
Maintainers
1

shopagent

GIF of generating a Shopify agent

Generate a Shopify agent on the fly thanks to Llama and LSD.

Contents

Getting started

GIF of generating a Shopify agent

  • Clone the repo

  • Run uv run main.py

  • Answer prompt

  • Now you have an agent.rb file

Why

Shopify LSD diagram

Gumroad recently went open source to support AI writing Ruby code. In order to assist the initiative towards a more AI-infused world, we gathered the Shopify GraphQL spec plus code examples to make it easy to generate Shopify agents.

Why only the admin API?

The official Shopify MCP server explicitly prompts to not interact with the storefront or functions APIs. If there is a specific dataset you're interested in that wouldn't bother Shopify, then feel free to file an issue.

Gimme the data

If you're interested in the Shopify GraphQL being programmatically accessible, the two files you'd be most interested in are:

Pretty printing the data

  • Clone this repository.
$ git clone https://github.com/lsd-so/Shopify-GraphQL-Spec.git
  • Update the main.py file file to print_data() instead of gen_agent()
def main():
-    # get_data()
+     get_data()
-     get_data()
+    # gen_agent()
    # print_data()
$ uv run main.py

Getting the data yourself

If you'd like to get the data yourself or update to match a new version of the Shopify API, then continue reading to learn how.

Help me vibe code this

Screenshot of Cursor generating code using the Shopify GraphQL API

LLMs are already familiar with GraphQL so this gives them the ability to understand Shopify's GraphQL specifically.

  • Download the JSON file and Python models
  • Place both the JSON file and Python file in your repo
    • Make sure you are using the models.py file in api/!
  • Go to Cursor, click "New chat", click "Add context", click "Files & folders", and add both files to your context
  • Vibe code with Cursor now understanding how to use the Shopify GraphQL API
    • If something doesn't work, try checking the option for longer context

Mining Shopify GraphQL yourself

$ export LSD_USER='your@email.domain'
$ export LSD_API_KEY='<api key from profile>'
  • Clone this repository.
$ git clone https://github.com/lsd-so/Shopify-GraphQL-Spec.git
  • And update the main.py file file to get_data() instead of gen_agent()
def main():
-    # get_data()
+     get_data()
-     gen_agent()
+    # gen_agent()
    # print_data()
$ uv run main.py

And there ya go.

LSD Cache

When running this python project, it involves querying the same page more than once for different groups of elements (such as in here or here). To prevent overloading Shopify's servers, pages in distinct states (whether statically off a public URL or following a sequence of deterministic interactions) are specifically cached for up to 15 minutes on LSD for scenarios like this.

Think of LSD as a language with caching that provides a more developer friendly Wayback machine. Follow us on Twitter to stay tuned!

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts