March 31, 2020
Build a Rails App With the Shopify Gem in Five Minutes | Shopify Partners

Build a Rails App With the Shopify Gem in Five Minutes | Shopify Partners

In this video we will show you how to start
up an app with the shopify_gem in five mins. This assumes that you have already authorized
with your Heroku account and have a base familiarity with rails 5.1.4 and ruby 2.4.1 To start we going to create our new rails project in our terminal by typing “rails new shopify_app“ Next we will move into our app’s directory Check this into version control with git From here we’ll create our heroku app server with “heroku create“ This creates and initializes a Heroku app that we can push our code to. Make note of the heroku app URL we’re provided, by pasting it somewhere you will find it when needed From here we move into our partner dashboard and click create app in the app section Add the app name and add the URL that was provided by heroku earlier Then click create app Go to app info tab to update whitelisted redirection url to add /auth/shopify/callback to our Heroku url and save changes The shopify_app creates a route by default at the URL we just whitelisted on which itwill exchange our oauth code for permanent access token. Shopify checks to ensure that this url matches that which is provided by the app in its initial oauth request. Move to the extensions tab to confirm that
our app is an embedded app If the embedded app feature is not enabled,
click enable An embedded app pulls your app interface into an iframe within the admin to create a more seamless experience for the merchant. Move back into terminal and open your project with our preferred text editor and open your gem file Move the sqlite3 gem into our development test group Create a new group called production and add pg gem Add the gem shopify_app above our rails gem Run bundle install Run rails generate shopify_app Provide our app credentials which we can get
in the partner dashboard under the app info tab This adds the functionality needed to run an app that interfaces with Shopify Now check our changes into version control Deploy our app to heroku with
“git push heroku master“ Before we can access our app successfully
we have to run with our rails generate function “Heroku rails run db:migrate“ From there we can visit the app url that we grabbed earlier and add our shop url and install app We can already see that the app by default grabs some shop data via the api For more info with what you can do with the Shopify gem visit the repo at New to Shopify app development? Click the link below to create a free account! Thanks for watching!

14 thoughts on “Build a Rails App With the Shopify Gem in Five Minutes | Shopify Partners

  1. Why do I get the following error after I generate the shopify app and provide the api key and secret key:

    conflict config/initializers/shopify_app.rb
    <zers/shopify_app.rb? (enter "h" for help) [Ynaqdh]

  2. Would be super if for us non coders [ uber-techie ] peeps, you could throw out some use case examples of what a simple app could do for the (1) store owner & (2) customer in some capacity. Kind of like a Jobs to be done story. Thxs

  3. I followed all the steps. but at the end after launching the app it gave me an error which is
    The page you were looking for doesn't exist.

    You may have mistyped the address or the page may have moved.
    If you are the application owner check the logs for more information.

  4. Hi, I followed all the steps, but after the installation of my domain, the website said "this shop is currently unavailable."

  5. can someone, please, give me an answer on the question i am being stuck, on 4:13 the browser redirected to render a page with the app only, and then it get back to the admin, and load an app within a frame, is this possible at all to fix it somehow, i mean to get a seamless work in the admin frame?

Leave a Reply

Your email address will not be published. Required fields are marked *