The Rails Shopify app starter kit with some tools for quick starting developing shopify app.
- Shopify's ruby template uses Polaris 12 but this starter kit uses Polaris 13.
- Shopify's ruby template uses SQLite but this starter kit uses PostgreSQL.
- This starter kit includes some additional gems and configurations.
This template combines a number of third party open source tools:
- BackEnd
- Ruby:
3.3.6
- Rails:
7.1.3
- Ruby:
- FrontEnd
- Vite
- React
- React Router
- React Query
- i18next
- Database
- PostgreSQL
- Background Job
- Sidekiq
- Redis
This includes gems like:
- You must create a Shopify partner account if you don’t have one.
- You must create a store for testing if you don't have one, either a development store or a Shopify Plus sandbox store.
- You must have Ruby installed.
- You must have Bundler installed.
- You must have Node.js installed.
git clone [email protected]:remy727/rails-shopify-app-starter-kit.git your-app-name
cd your-app-name
- Install the dependencies:
yarn cd web bundle install
- Run the Rails template script.
It will guide you through setting up your database and set up the necessary keys for encrypted credentials.
bin/rails app:template LOCATION=./template.rb
- Navigate to the root of your app and connect to Shopify app.
cd .. shopify app config link
- Launch the app:
shopify app dev
Open the URL generated in your console. Once you grant permission to the app, you can start development.
- Download and install the Heroku CLI.
- Navigate to your app directory:
cd your-app
- If you want to deploy to Heroku, update
SHOPIFY_API_KEY
inheroku.yml
. - Log in to the Heroku CLI:
heroku login
- Log in to the Heroku Container Registry:
heroku container:login
- Create an app in Heroku:
heroku create -a <your-app-name> -s container
The following environment variables need to be provided for all apps:
Variable | Secret? | Required | Value | Description |
---|---|---|---|---|
HOST |
Yes | Yes | string | Heroku App Domain |
RAILS_MASTER_KEY |
Yes | Yes | string | Use value from web/config/master.key or create a new one. |
RAILS_ENV |
Yes | "production" |
||
RAILS_SERVE_STATIC_FILES |
Yes | 1 |
Tells rails to serve the React app from the public folder. | |
RAILS_LOG_TO_STDOUT |
Yes | 1 |
Tells rails to print out logs. | |
SENTRY_CURRENT_ENV |
string | Sentry Environment | ||
SENTRY_DSN |
string | Sentry DSN | ||
SENTRY_TRACES_SAMPLE_RATE |
float | Sentry Sample Rate | ||
SHOPIFY_API_KEY |
string | The client ID of the app, retrieved using Shopify CLI. | ||
SHOPIFY_API_SECRET |
string | The client secret of the app, retrieved using Shopify CLI. | ||
SHOPIFY_APP_NAME |
string | Shopify App Name |
git push heroku main
- From the Partner Dashboard, go to Apps.
- Select the app that you deployed to your hosting provider.
- On the App setup page, in the URLs section, update the App URL and Allowed redirection URL(s) settings.
- App URL: The base URL of your app. This URL should match your
HOST
environment variable. - Allowed redirection URL(s): The callback URL for your app. This is usually the same as the app URL, with
/api/auth/callback
appended.
The following are examples of URLs that you might set for Heroku:
- App URL:
https://your-app.herokuapp.com
- Allowed redirection URL(s):
https://your-app.herokuapp.com/api/auth/callback
Enjoy your app :)