Hello Shopify Friends,
When it comes to modern web development, Shopify and Remix are great ways to develop powerful and performant web applications. By combining the power of Shopify’s e-commerce functionalities with Remix’s developer-first philosophy, you will be able to provide a seamless shopping experience for your users.
In this post, we’ll be looking at Remix first, its various features, and then how to create a Shopify Remix App.
What is Remix?
Remix is a React-based web framework that aims to build fast and optimized applications. It separates data fetching from rendering which increases load and parse times. By default, Remix is server-side rendered but allows for seamless client navigation while improving performance and SEO. It utilizes file-based routing with a clear folder structure for developers to follow. Remix has a lot of other features including layouts, partials, CSS modules, global styles, authentication, and intelligent caching.
Benefits of using Remix JS in Shopify
Developer Familiarity
If developers are already using Remix.js and have found it useful for making web apps, they may choose to use Remix for making a Shopify app.
Performance and Server-Side Rendering (SSR)
Remix.js focuses on Server-side-rendering and can increase initial page load performance as well as create a better user experience. Remix.js can also be used if performance is a major element to a Shopify app.
Data Loading Optimization
Remix.js abstracts data loading from component rendering giving the possibility of doing data fetching optimization. This could help with optimally loading your data in a Shopify application.
Client-Side Navigation
Remix.js supports client-side navigation allowing for a smoother, more responsive user interface when it comes to navigating your Shopify application.
Modern Web Development Practices
Remix.js uses modern web development practices and has modern tools, so it’s possible that some developers will select it simply for the features and developer experience it gives them.
Steps to Create Shopify Remix App:
Prerequisites:
Before we dive in, make sure that you have the following:
- A Shopify Partner Account: If you don’t already have a Shopify Partner Account then sign-up at Shopify Partners.
- A Development Store: Once you’ve established your Partner Account, you’ll need to establish a development store in your Shopify Partner Dashboard.
- Node.js and npm: Have the newest version of Node.js (which includes npm) installed on your computer.
- Shopify CLI: The Shopify Command Line Interface (CLI), will assist you in administering your app. We’ll talk about installing the CLI further down.
- A Modern Browser: Ensure you have installed the most updated version of Chrome or Firefox, which you can use to test your code.
- Basic Understanding of JavaScript and React: You should already know the basic concepts of JavaScript and React so that Remix is not an entirely unknown language to you.
Step 1: Create a New Shopify App
You can make a new app with the Remix template. This template already has the required setup for creating a Shopify app using Remix.
Steps to Your App
- Navigate to Your Project Directory
In your terminal navigate to the folder where you want the app to be created. For example:
cd ~/Desktop/projects
- Initialize a New App
Execute the following command to create a new Shopify app:
shopify app init
- Follow the Prompts
- Enter a name for your app: Choose a unique name (e.g., my-shopify-app).
- Select the Remix template: Select Build a Remix app. This is likely the best option for most Shopify apps because it gives you a head start to develop your app with the Remix meta-framework
The Shopify CLI will create a new folder with your app’s name in it that will contain the starter code and dependencies to create a Shopify app.
Step 2: Start a Local Development Server
Once you have created your app you will be able to run it locally for previewing and testing.
- Navigate to Your App Directory
Change directory into the newly created app folder.
cd my-shopify-app
Replace my-shopify-app with your chosen name.
- Run the Development Server
Start the local server with this command:
shopify app dev
Shopify CLI will:
- Prompt you to log in to your Shopify Partner account (or a merchant account with app development permissions).
- Create an app record in your Shopify Partner Dashboard.
- Set up a Prisma SQLite database for your app.
- Create a secure HTTPS tunnel using Cloudflare, allowing you to access your app from a public URL.
- Access Your App
When the server is running, the Shopify CLI will present you with a preview URL (e.g. https://xxxx.cloudflare.com). You can press p in the terminal to open this URL in your browser.
Step 3: Install Your App on a Development Store
If you wish to test your app, you will have to install it in a Shopify development store.
- Open the Preview URL
When you open the URL that the Shopify CLI presented you, you will have a prompt asking you to install the app on your development store.
- Log in to Your Development Store
You can log in to your development store using your credentials (be sure you are either the store owner or a staff account with privileges).
- Install the App
Install the app according to the on-screen instructions. Shopify CLI will automatically seed your development store with some sample products for you to test.
- Verify the Installation
At this point the app should have installed successfully and you should see your app’s screen from the Shopify admin, If you observe a page similar to “example domain” or simply a blank screen, please verify:
- You are using the correct preview URL.
- You have installed your development store in the right manner.
- Shopify CLI is running with no warning/error.
Step 4: Create a Sample Product
To verify that your app works, you can make a sample product in your development store.
- Access Your App in the Shopify Admin
Once you have installed, you should be able to select your app from the Shopify admin (Apps).
- Create a Product
If you are using the Remix template of your app, your app may include a sample feature to create a product. You can attempt to click any prompts or buttons the app presented to you in order to create the product. If there is not such a feature, you can create a product manually from your Shopify admin:
- From the Shopify admin select Products.
- Click Add product and enter any details (example: name, price, description…).
- Click Save.
- Test Your App
You can try out your app to verify that it works as you have intended. If your app shows products, verify that the product you made does show and render correctly.
Troubleshooting Common Issues
- “Example Domain” or Blank Page: Might be due to the URL of the app not being properly set up or the server not being running.
- Environment Variables Not Loading: If the variables in your .env file are not loading, you can try restarting the dev server or saving a file.
- Permission Errors: Ensure that you are the storeowner or you possess a staff account that has app development permissions in the store.
Conclusion:
This way, you can successfully create a Shopify Remix App. If you have any doubts, mention them in the comment section, and I will be happy to solve them. Otherwise, you can also connect with experienced developers who will help you build Shopify Remix App.
Share the article with your friends to help them learn about Shopify Remix App.
Happy Coding!
FAQ
What is a Shopify Remix App?
A Shopify Remix app is a custom application built using the Remix framework and Shopify’s official app tooling. It allows developers to integrate custom features, extend store functionalities, and build fast, modern Shopify apps with server-side rendering (SSR) and React-based UI.
What are the prerequisites for creating a Shopify Remix app?
Before creating a Remix app, ensure you have:
- A Shopify Partner Account
- Node.js (v18 or higher)
- npm, yarn, or pnpm installed
- Shopify CLI installed (npm install -g @shopify/cli @shopify/app)
- A development store for testing
How do I create a new Shopify Remix app?
Run the following command in your terminal:
shopify app create remix