<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tomisin Owolabi</title>
    <description>The latest articles on DEV Community by Tomisin Owolabi (@teetomania).</description>
    <link>https://dev.to/teetomania</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F585889%2F22560d11-2098-4280-8c19-d06fdd0cca31.jpg</url>
      <title>DEV Community: Tomisin Owolabi</title>
      <link>https://dev.to/teetomania</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/teetomania"/>
    <language>en</language>
    <item>
      <title>How to Build A Shopify Embed App with VueJs, Tailwind CSS, NodeJs and Laravel</title>
      <dc:creator>Tomisin Owolabi</dc:creator>
      <pubDate>Thu, 11 Aug 2022 10:45:00 +0000</pubDate>
      <link>https://dev.to/teetomania/how-to-build-a-shopify-embed-app-with-vuejs-tailwind-css-nodejs-and-laravel-3j7d</link>
      <guid>https://dev.to/teetomania/how-to-build-a-shopify-embed-app-with-vuejs-tailwind-css-nodejs-and-laravel-3j7d</guid>
      <description>&lt;p&gt;Building a Shopify App with anything outside &lt;a href="https://github.com/Shopify/shopify-app-template-node" rel="noopener noreferrer"&gt;React&lt;/a&gt; or &lt;a href="https://github.com/Shopify/shopify_app" rel="noopener noreferrer"&gt;Rails&lt;/a&gt; can be daunting; you’re on your own for the most part. Since I figured it out with my crew using VueJs: we’ve decided to Open Source the template. &lt;/p&gt;

&lt;p&gt;The template is so flexible you can either use NodeJs or Laravel PHP as your backend. And for those who love to use, and preach the gospel of Tailwind CSS…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7dzq58zusblak566h1q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7dzq58zusblak566h1q.jpg" alt="TailwindCSS Christ"&gt;&lt;/a&gt; Courtesy: &lt;a href="https://twitter.com/iamaponte" rel="noopener noreferrer"&gt;iamaponte&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Tailwind CSS is already installed!&lt;/p&gt;

&lt;p&gt;This post walks you through the setup process. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shopify &lt;a href="https://www.shopify.com/partners" rel="noopener noreferrer"&gt;partner account&lt;/a&gt; and a &lt;a href="https://shopify.dev/apps/tools/development-stores#create-a-development-store-to-test-your-app" rel="noopener noreferrer"&gt;development store&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You’ve installed &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;NodeJs&lt;/a&gt; 14.13.1 or higher.&lt;/li&gt;
&lt;li&gt;You’ve installed &lt;a href="https://www.php.net/" rel="noopener noreferrer"&gt;PHP&lt;/a&gt; and &lt;a href="https://getcomposer.org/" rel="noopener noreferrer"&gt;Composer&lt;/a&gt; for the PHP backend.&lt;/li&gt;
&lt;li&gt;You’ve installed &lt;a href="https://docs.npmjs.com/getting-started" rel="noopener noreferrer"&gt;Npm&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You’ve installed &lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;Git&lt;/a&gt; and can use the Git bash terminal(important for windows).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Setup Process
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt; &lt;br&gt;
Install the template's package and create your Shopify Vue app.&lt;/p&gt;

&lt;p&gt;Using your terminal install &lt;a href="https://github.com/Digitalmvps/ShopifyVue" rel="noopener noreferrer"&gt;ShopifyVue&lt;/a&gt; as a global package.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm i -g shopifyvue


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Next, create your app from your terminal(ideally Git bash on windows) with one of the two available backend frameworks.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

shopifyvue create "MyShopifyApp" --backend nodejs
or
shopifyvue create "MyShopifyApp" --backend php


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The NodeJS backend is based on &lt;a href="https://github.com/Shopify/shopify-app-template-node" rel="noopener noreferrer"&gt;this template&lt;/a&gt;, while the PHP backend is based on &lt;a href="https://github.com/osiset/laravel-shopify" rel="noopener noreferrer"&gt;this template&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Navigate into your app directory and run: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You should have a file structure similar to this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F419o0i56i8m9en6f5c4e.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F419o0i56i8m9en6f5c4e.JPG" alt="NodeJS file structure"&gt;&lt;/a&gt; NodeJS&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbz6pu2sz1mtrtycagpg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbz6pu2sz1mtrtycagpg.png" alt="PHP backend file structure"&gt;&lt;/a&gt; PHP &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br&gt;
We'd need a tunnel to connect the local server with Shopify. I recommend using &lt;a href="https://ngrok.com/download" rel="noopener noreferrer"&gt;Ngrok&lt;/a&gt;. You can also use &lt;a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/" rel="noopener noreferrer"&gt;Cloudflare tunnel&lt;/a&gt; or &lt;a href="https://github.com/localtunnel/localtunnel" rel="noopener noreferrer"&gt;Local tunnel&lt;/a&gt;.&lt;br&gt;
With your &lt;a href="https://ngrok.com/" rel="noopener noreferrer"&gt;Ngrok account&lt;/a&gt;, connect your agent to your account using the Auth token from your dashboard in your terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ngrok config add-authtoken TOKEN


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then run your localhost port.&lt;/p&gt;

&lt;p&gt;For NodeJS:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ngrok http http://localhost:8081/


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For PHP:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ngrok http http://localhost:8000/


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This will generate ngrok https URL for you. &lt;br&gt;
Note the URL, you'll use it later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;br&gt;
Create an app manually from your partner dashboard.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mgquk979zh0vjuj7oi7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mgquk979zh0vjuj7oi7.png" alt="Create Shopify app manually"&gt;&lt;/a&gt;&lt;br&gt;
In the App URL section, insert the Ngrok https URL generated in step 2, and in the Allowed redirection fill as follows:&lt;br&gt;
For NodeJS: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;Ngrok https url&amp;gt;/auth
&amp;lt;Ngrok https url&amp;gt;/auth/callback
&amp;lt;Ngrok https url&amp;gt;/auth/online


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For PHP: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;Ngrok https url&amp;gt;/authenticate


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;br&gt;
Now we're going to create an env file(you can edit the one that came with the installation). After creating your app on your SHopify partner dashboard, click on it to get your API keys. Copy both the API key and API secret key into your .env file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffmd04n2wzi5ai0rjceko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffmd04n2wzi5ai0rjceko.png" alt="App Api"&gt;&lt;/a&gt; &lt;br&gt;
For NodeJS:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

SHOPIFY_API_KEY="api key"           
SHOPIFY_API_SECRET="api secret key" 
SCOPES=write_customers,write_draft_orders
SHOP="my-development-store.myshopify.com"                    
HOST="Ngrok https url"          


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For PHP: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

SHOPIFY_API_KEY=&amp;lt;your api key&amp;gt;
SHOPIFY_API_SECRET=&amp;lt;your secret key&amp;gt;
SHOPIFY_APPBRIDGE_ENABLED=true


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Save the file and start you dev server.&lt;br&gt;
For NodeJS&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm run serve:dev


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For PHP&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm run dev


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And start your PHP dev server in a new terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

php artisan serve


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Note, for your PHP app to work, you'd need to configure the database, jobs, middlewares, and publish the configurations for the Laravel Shopify package. Follow the instructions on the &lt;a href="https://github.com/osiset/laravel-shopify/wiki/Installation" rel="noopener noreferrer"&gt;wiki page here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;br&gt;
This is the final step. &lt;/p&gt;

&lt;p&gt;Select a development store from within your app on your partner dashboard to install your app on. Make sure it's the same store you specified in your env file if you're using NodeJS backend. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdpiiyn2w3l46dgiijza7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdpiiyn2w3l46dgiijza7.png" alt="Sample shopify embed app"&gt;&lt;/a&gt;&lt;br&gt;
All things being equal, you should have an image similar to the one above. &lt;/p&gt;

&lt;p&gt;Congrats! You're all set to begin customizing your app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PS:&lt;/strong&gt; This post assumes prior knowledge of &lt;a href="https://vuejs.org/" rel="noopener noreferrer"&gt;VueJs&lt;/a&gt;, your chosen backend language &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;NodeJs&lt;/a&gt; or &lt;a href="https://laravel.com/" rel="noopener noreferrer"&gt;Laravel PHP&lt;/a&gt;, &lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind CSS&lt;/a&gt;(although it can be uninstalled via npm to accommodate your desired CSS syntax), and ability to work with &lt;a href="https://shopify.dev/" rel="noopener noreferrer"&gt;Shopify’s documentation&lt;/a&gt; based on what your app intends to do. &lt;/p&gt;

&lt;p&gt;Happy building!&lt;/p&gt;

&lt;p&gt;Let me know your thoughts in the comments below.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>tailwindcss</category>
      <category>typescript</category>
      <category>laravel</category>
    </item>
  </channel>
</rss>
