Listed below are the generators currently offered by the Shopify App gem. To learn more about how this gem creates an embedded app, start with the default Shopify App generator.
The default generator will run the install
, shop_model
, authenticated_controller
, and home_controller
generators. This is the recommended way to start a new app from scratch.
[Optional] Specify this environment variable if your app uses sprockets with Rails 6 or to generate a Shopify App without webpacker.
Example:
Run:
$ SHOPIFY_APP_DISABLE_WEBPACKER=1 rails generate shopify_app
Add the following code to your ShopifyApp configuration block:
ShopifyApp.configure do |config|
config.disable_webpacker = true
end
This generator adds ShopifyApp and the required initializers to the host Rails application. You can update any of these settings later.
The name of your app. The flag can be supplied with or without double-quotes.
Example: --application_name "My Shopify App"
The OAuth access scope(s) required by your app. Delimit multiple access scopes using a comma-space. The flag can be supplied with or without double-quotes.
Example: --scope read_products, write_orders
Example: --scope "read_products, write_orders"
Specify whether the app is an embedded app. Apps are embedded by default.
Example: --embedded false
[Not recommended] Specify whether the app uses cookies to authenticate. By default, the app is configured to use session tokens.
Example: --with-cookie-authentication true
This generator creates a Shop
model and a migration to store shop installation records. See Shop-based token strategy to learn more.
This generator creates a User
model and a migration to store user records. See User-based token strategy to learn more.
This generator creates a sample authenticated controller. By default, inheriting from this controller protects your app controllers using session tokens. See Authentication to learn more.
This generator creates a sample home controller with a view that displays a shop's products. This generator also runs the products_controller
generator.
[Not recommended] This flag generates an authenticated home controller. Use this flag only if your app uses cookies to authenticate. By default, the home controller is unauthenticated.
This generator creates a sample products API controller to fetch products using the Shopify REST API.
[Optional] This generator creates a skeleton job that runs after the OAuth authorization flow. See Run jobs after the OAuth flow for more information.
[Optional] This generator creates the app proxy controller to handle proxy requests to the app from your shop storefront. It also modifies 'config/routes.rb' with a namespace route and creates a sample view that displays current shop information using the LiquidAPI. See Verify HTTP requests sent via an app proxy for more information.
[Optional] This generator creates a controller with the endpoints required to build a marketing activities extension. The extension is generated with the base URL /marketing_activities
. This URL would need to be configured in the Shopify Partners dashboard.
[Optional] This generator is for your convenience. Run this generator if you would like to override code that is part of the Shopify App Rails engine.
Example: The Shopify App Rails engine provides a sample SessionsController
. Running this generator copies this controller to your app so you can begin extending it. Routes and views follow the same pattern.