Connecting to Shopify is the first big step to building a Shopify app with Gadget.
In addition to standing up a full stack app and the underlying infrastructure, Gadget's Shopify connection also handles Shopify's OAuth, session token management, webhook registration, data syncing and nightly reconciliations for you, and automatically creates data models and APIs for your Shopify resources.
By the end of this quickstart, you'll have a fullstack app set up, connected to Shopify, and installed on a Shopify development store.
Gadget's AI assistant can also guide you through the connection process. Give it a detailed overview of your app's requirements and the
assistant will help you set up the connection.
Step 1: Create a new Gadget app
First, you need to create a new Gadget app.
Create a new Gadget app at gadget.new and select the Shopify app type.
Click Use different connection methods on your app's home page. Alternatively, navigate to Settings > Plugins > Shopify.
If you haven't set up a connection before, you will need to authenticate using the Shopify CLI. This allows Gadget to create and manage apps on your behalf.
CLI authentication tokens might expire after some time, requiring this step to be repeated.
Step 3: Create a Shopify application
Select a Shopify organization to add your app to. This step will not appear if you are only a member of one organization.
Name and create your new Shopify application.
Create a production app?
You need a separate Shopify app for each Gadget environment, for example, development and
production. Gadget can also create a Shopify app for production at this time.
Step 4: Select scopes and models
In order to authenticate with Shopify, it is required to select at least one scope.
You can also select the Shopify data models needed to power your app. Gadget will register and receive webhooks for models that have webhooks.
For this quickstart, select the Products Read scope and Product model.
Select the scopes you'll need for this application.
Click Confirm to move to the next step.
If you don't know what scopes or models you need, don't panic, you can edit this configuration at a later time.
Step 5: Install the app on a Shopify store
The Shopify connection is all set up. Now you can install your app on a Shopify development store.
If you don't have a development store, you can create one by clicking Create a new store. Once the store is created, navigate back to your Gadget app and click Refresh to see the new store.
Select a store and click Install app. This will redirect you to your Shopify store admin.
Click Install to grant your app access to the selected scopes for this store.
Congrats! Your app is now installed on a development store, and you can start building your Shopify app.
Step 6 (Optional): Sync Shopify data
After installing on a store, you can run a data sync to pull that store's existing data into your Gadget app's database. Only data for the models you selected when setting up the connection will be synced.
On the connection page, click Installs. If you have navigated away from the connection page after installing on a store, navigate to Settings > Plugins > Shopify.
Find the store that you've just installed the app on and click the Sync button.
Gadget will automatically manage Shopify's rate limits and sync data in the background. Depending on how much data you have, this process may take some time.
You can see your synced data by navigating to the data page for your selected models, for example, api/models/shopifyProduct/data.
Next steps
Try out some of our other tutorials to learn more about building with Gadget: