Hello Shopify Developer Community,
I’m currently developing features for my Next.js application that require integration with a seller’s Shopify API. According to Shopify Support, I need to create a Public App to gain access to the Storefront API to meet my project’s requirements. However, I’m finding the documentation for this use case to be somewhat unclear and would appreciate guidance from those who have experience with similar setups.
Project Context:
- The app I’m building will sync a seller’s Shopify inventory with our marketplace.
- In the initial phase, our marketplace redirects customers to the seller’s Shopify product pages. Eventually, we plan to facilitate purchases directly on our platform using Shopify’s checkout system.
- APIs we will need access to: Products, Inventory, Cart, Checkout, Orders.
- The app is built with Next.js, and I’ve already set up a Shopify Partner Account, Development Store, and Public App.
Questions:
-
File Structure:
During the setup of the Public Shopify App, the Shopify CLI created a separate directory within my existing Next.js project. Should I keep these directories separate, or is it better to integrate them into the main project structure? What’s considered best practice in this scenario? -
Minimum Implementation for API Access:
My application primarily needs the ability to interact with the Shopify API. This includes acquiring a client_id, secret_key, and an authorization_token obtained through OAuth for each seller. Has anyone here implemented a similar setup? If so, any advice on the best approach would be greatly appreciated. -
OAuth Implementation with Next.js:
What are the best practices for securely implementing OAuth in a Next.js environment to obtain and store Shopify access tokens? Are there any resources or examples that demonstrate how to achieve this?
Additional Info:
Support informed me that all public app merchants must go through an OAuth permissions page to install the app. I’m trying to understand how best to integrate this flow within the Next.js framework.
I’d greatly appreciate any insights, resources, or examples that could assist me in navigating these challenges. If additional details are needed to provide accurate guidance, I’m happy to share more.
Thank you in advance for your help!
Best regards,
Taylor