The Rails Shopify app with some tools for quick starting developing shopify app.
This template combines a number of third party open source tools:
i18next
and related libraries are used to internationalize the frontend.
react-i18next
is used for React-specific i18n functionality.i18next-resources-to-backend
is used to dynamically load app translations.@formatjs/intl-localematcher
is used to match the user locale with supported app locales.@formatjs/intl-locale
is used as a polyfill for Intl.Locale
if necessary.@formatjs/intl-pluralrules
is used as a polyfill for Intl.PluralRules
if necessary.PostgreSQL
These third party tools are complemented by Shopify specific tools to ease app development:
@shopify/i18next-shopify
is a plugin for i18next
that allows translation files to follow the same JSON schema used by Shopify app extensions and themes.This includes gems like:
git clone [email protected]:remy727/rails-shopify-app-starter-kit.git your-app-name
cd your-app-name
cd web
bundle install
bin/rails app:template LOCATION=./template.rb
SHOPIFY_API_KEY
in heroku.yml
.And your Rails app is ready to run! You can now switch back to your app's root folder to continue:
cd ..
The Shopify CLI connects to an app in your Partners dashboard. It provides environment variables, runs commands in parallel, and updates application URLs for easier development.
You can develop locally using your preferred Node.js package manager. Run one of the following commands from the root of your app:
Using yarn:
yarn dev
Using npm:
npm run dev
Using pnpm:
pnpm run dev
Open the URL generated in your console. Once you grant permission to the app, you can start development.
cd my-app
heroku login
heroku container:login
heroku create -a <my-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_SCOPES |
string | The app's access scopes, 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
HOST
environment variable./api/auth/callback
appended.The following are examples of URLs that you might set for Heroku:
https://my-app.herokuapp.com
https://my-app.herokuapp.com/api/auth/callback