SDKs overview
Shopify offers a range of Software Development Kits (SDKs) and client libraries designed to help developers build applications, themes, and integrations for its ecommerce platform. These SDKs abstract away the complexities of direct HTTP requests and API authentication, providing language-specific interfaces for interacting with Shopify's Admin API and Storefront API. The available SDKs support various programming languages, enabling developers to choose tools that align with their existing technology stacks. These libraries typically handle tasks like OAuth authentication flows, GraphQL query construction, and response parsing.
Developers primarily use Shopify SDKs for:
- Building custom Shopify Apps: Both public and private apps can extend Shopify's core functionality, often requiring deep integration with the Admin API.
- Developing custom storefronts: The Storefront API and associated SDKs allow for headless commerce implementations, giving developers full control over the buyer's experience.
- Automating merchant tasks: SDKs can facilitate programmatic management of products, orders, customers, and other store data.
- Integrating with external systems: Connecting Shopify stores with third-party inventory management, CRM, or marketing platforms.
The SDK ecosystem includes officially maintained libraries and a selection of community-contributed tools, each catering to specific use cases and development preferences. Shopify's comprehensive developer documentation provides guides, API references, and tutorials for working with these SDKs.
Official SDKs by language
Shopify officially supports and maintains SDKs for several popular programming languages, facilitating development across different environments. These official libraries are designed to be robust, secure, and kept up-to-date with API changes. They typically provide structured ways to interact with the Admin API (for managing store resources) and the Storefront API (for fetching public shop data for buyer experiences).
| Language | Package/SDK Name | Primary API Focus | Maturity | Key Features |
|---|---|---|---|---|
| JavaScript | @shopify/shopify-api |
Admin API, Storefront API | Stable | OAuth, GraphQL client, REST client, session management, webhook handling (Node.js) |
| Node.js | @shopify/shopify-api |
Admin API, Storefront API | Stable | Built for Node.js environments, includes Express.js middleware for authentication |
| Ruby | shopify_api (Admin API), shopify_app (framework) |
Admin API, Storefront API | Stable | Rails integration, OAuth, GraphQL client, webhook verification, session tokens |
| PHP | shopify/shopify-api |
Admin API, Storefront API | Stable | OAuth, REST and GraphQL clients, webhook handling, session persistence |
| Python | shopifyapi |
Admin API, Storefront API | Stable | OAuth support, REST client, GraphQL client integration |
| Go | shopify/shopify-api-go |
Admin API, Storefront API | Beta/Active Development | GraphQL client, OAuth helpers, webhook validation |
Installation
Installation methods for Shopify SDKs vary by programming language and package manager. The following examples cover the most common official SDKs:
JavaScript / Node.js
The @shopify/shopify-api package is installed via npm or yarn. This SDK is designed for server-side Node.js applications and provides functionality for both the Admin and Storefront APIs, including OAuth, session management, and webhook handling.
npm install @shopify/shopify-api
# or
yarn add @shopify/shopify-api
Ruby
For Ruby applications, particularly those built with Ruby on Rails, the shopify_api gem provides access to the Admin API, while shopify_app is a Rails engine that simplifies building Shopify apps by providing a framework for authentication, webhook registration, and more.
gem install shopify_api
# Add to your Gemfile for Rails projects:
gem 'shopify_api'
gem 'shopify_app'
PHP
The official PHP SDK is distributed via Composer, the PHP dependency manager. It supports various PHP environments and includes tools for OAuth, API requests, and webhook processing.
composer require shopify/shopify-api
Python
The Python SDK is available through pip, the Python package installer. It enables Python applications to interact with the Shopify Admin API.
pip install ShopifyAPI
Go
The Go SDK is integrated into Go modules. It is primarily used for building server-side applications that interact with the Shopify GraphQL APIs.
go get github.com/Shopify/shopify-api-go/v2
Quickstart example
The following quickstart demonstrates initializing the Node.js @shopify/shopify-api SDK and making a simple API call to fetch shop details. This example assumes a basic Express.js server setup and pre-configured environment variables for API keys and scopes.
Example: Fetching Shop Name (Node.js)
This snippet initializes the Shopify API client and performs a GraphQL query to retrieve the shop's name. For a full application, detailed OAuth setup would precede this.
import { shopifyApi, LATEST_API_VERSION } from '@shopify/shopify-api';
import 'dotenv/config'; // For loading environment variables
// Basic initialization (full app would include session storage, webhook handlers, etc.)
const shopify = shopifyApi({
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET,
scopes: ['read_products', 'read_orders', 'read_content'], // Example scopes
hostName: process.env.SHOPIFY_APP_HOST.replace(/https?:///, ''),
apiVersion: LATEST_API_VERSION,
is