<?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: -Λaron Vail 👨‍💻</title>
    <description>The latest articles on DEV Community by -Λaron Vail 👨‍💻 (@aaron_vail).</description>
    <link>https://dev.to/aaron_vail</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%2F131718%2F0f035423-0014-4dae-937c-2ef6fd74ae71.jpg</url>
      <title>DEV Community: -Λaron Vail 👨‍💻</title>
      <link>https://dev.to/aaron_vail</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aaron_vail"/>
    <language>en</language>
    <item>
      <title>How to build Authentication using Cosmic JS, Vue, and Lambda</title>
      <dc:creator>-Λaron Vail 👨‍💻</dc:creator>
      <pubDate>Tue, 04 Jun 2019 20:19:27 +0000</pubDate>
      <link>https://dev.to/aaron_vail/how-to-build-authentication-using-cosmic-js-vue-and-lambda-17fh</link>
      <guid>https://dev.to/aaron_vail/how-to-build-authentication-using-cosmic-js-vue-and-lambda-17fh</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6T468WYf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AqWVhUr9B3T2dggZLAPrWdw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6T468WYf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AqWVhUr9B3T2dggZLAPrWdw.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial I’ll be showing you how I built a Vue.js app with Authentication using Cosmic JS and AWS Lambda prior to deploying to Netlify. Let’s get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://cosmicjs.com/apps/vue-cosmic-auth"&gt;Demo Link&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/cosmicjs/vue-authentication"&gt;View Code on Github&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Netlify hosting (plus CDN, Prerendering, Minification, etc..)&lt;/li&gt;
&lt;li&gt;Vuetify components for interface&lt;/li&gt;
&lt;li&gt;AWS Lambda functions via Netlify&lt;/li&gt;
&lt;li&gt;Cosmic JS for Database API&lt;/li&gt;
&lt;li&gt;Password hashing using PBKDF2 with Salt&lt;/li&gt;
&lt;li&gt;Email Verification using Nodemailer via &lt;a href="https://www.sendinblue.com/?tap_a=30591-fb13f0&amp;amp;tap_s=532760-3bdbbe"&gt;SendinBlue&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Needed Improvements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Password reset function&lt;/li&gt;
&lt;li&gt;User avatar support&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You will be required to have Node JS and npm before starting. Make sure you already have them installed. If not you can find them here: &lt;a href="https://nodejs.org"&gt;https://nodejs.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In order to deploy you will need a Netlify account.&lt;/p&gt;

&lt;p&gt;Also for SMTP server to send email verification link I am using &lt;a href="https://www.sendinblue.com/?tap_a=30591-fb13f0&amp;amp;tap_s=532760-3bdbbe"&gt;SendInBlue&lt;/a&gt; since they give you 300 free emails a day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;Important things to note:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;~/public/_redirects&lt;/strong&gt;&lt;br&gt;
This file is important since it points all your traffic to the index.html file in order for vue-router to handle the requests. To learn more about Netlify redirects visit their docs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;~/cosmic.js&lt;/strong&gt;&lt;br&gt;
This file is the main entry point for Cosmic JS node library that we will export in order to use through-out our lambda functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;~/functions&lt;/strong&gt;&lt;br&gt;
The functions directory holds all of our lambda functions which will automatically get ran on AWS once we deploy to netlify. We’ll be using these functions to handle our hashing and database logic required for Cosmic JS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fork and Clone
&lt;/h2&gt;

&lt;p&gt;First we’ll be forking the repository on GitHub. Afterwards open up command line or terminal and clone it to your project folder on your local machine with this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clone https://github.com/cosmicjs/vue-authentication&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use BitBucket or Gitlab instead?&lt;/p&gt;

&lt;p&gt;If you prefer to use a different git provider you can just clone the repository and upload it to your desired remote.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;p&gt;In your command line cd into the project root directory that you just cloned and run npm install to download and install all the required dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrate Cosmic JS Bucket
&lt;/h2&gt;

&lt;p&gt;In your Cosmic JS account create a new bucket and call it whatever you want.&lt;/p&gt;

&lt;p&gt;Download this bucket.json file and go to Import / Export Data page in your cosmic JS bucket’s Settings, select and upload the downloaded file. This will import all the Object Types and placeholder data.&lt;/p&gt;

&lt;p&gt;Next you’ll need to modify the cosmic.js file within your project directory to connect to the bucket you just created.&lt;/p&gt;

&lt;p&gt;Here’s what you’ll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bucket slug&lt;/li&gt;
&lt;li&gt;API Read Access Key&lt;/li&gt;
&lt;li&gt;API Write Access Key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;~/cosmic.js&lt;/strong&gt;&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Cosmic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'cosmicjs'&lt;/span&gt;&lt;span class="p"&gt;)();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;database&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Cosmic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'YOUR BUCKET SLUG'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;write_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'YOUR BUCKET WRITE KEY'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;read_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'YOUR BUCKET READ KEY'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;database&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Integrate SendInBlue SMTP
&lt;/h2&gt;

&lt;p&gt;In order for email verification to work you’ll need an SMTP server. For the sake of simplicity for this tutorial I will be using &lt;a href="https://www.sendinblue.com/?tap_a=30591-fb13f0&amp;amp;tap_s=532760-3bdbbe"&gt;SendInBlue&lt;/a&gt; since they provide you with 300 free emails and use the Nodemailer npm package to integrate with.&lt;/p&gt;

&lt;p&gt;After you create an account go to your SMTP &amp;amp; API settings to generate an SMTP key to use in the CreateNewUser.js Lambda function, you can find it under the “SMTP” tab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BhVcv1Dd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AMPYpKryoDSZMkCEC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BhVcv1Dd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AMPYpKryoDSZMkCEC.png" alt="SendInBlue SMTP Key"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then enter in your email and SMTP password to the following transporter object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;~/functions/CreateNewUser.js&lt;/strong&gt;&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transporter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nodemailer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createTransport&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'SendinBlue'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// no need to set host or port etc.&lt;/span&gt;
&lt;span class="na"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'YOUR EMAIL'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;pass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'API KEY'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// Read more on the usage of Nodemailer package here: https://nodemailer.com/usage/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Running your app locally
&lt;/h2&gt;

&lt;p&gt;In order for the AWS Lambda functions to run locally properly you’ll need to run the following command: &lt;code&gt;npm run start:lambda&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will spin up a local function server using the netlify-functions library.&lt;/p&gt;

&lt;p&gt;Next, you’ll need to make sure you have a .env file in your root project directory to change the VUE_APP_API_HOST variable to point to the lambda server you just started running. Otherwise your app won’t work. Mine started on port 9000 by default.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;VUE_APP_API_HOST=http://localhost:9000/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After that you may open another console and finally start the Vue JS application with this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run serve&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In order to test the API locally you may need to run Chrome with CORS disabled, you can find out how to do that depending on your OS with this helpful list:&lt;/p&gt;

&lt;p&gt;Windows:&lt;br&gt;
&lt;code&gt;"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --disable-gpu --user-data-dir=~/chromeTemp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;OSX:&lt;br&gt;
&lt;code&gt;open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Linux:&lt;br&gt;
&lt;code&gt;google-chrome --disable-web-security&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now you can navigate to &lt;code&gt;http://localhost:8080&lt;/code&gt; to open the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment with Netlify
&lt;/h2&gt;

&lt;p&gt;Go to your Netlify dashboard and click “New site from Git”. Choose your git provider (I use GitHub).&lt;/p&gt;

&lt;p&gt;After you authenticate you can see your list of repositories. Select the one you created for this project you created earlier and set the build command to “npm run build” and the publish directory to “dist”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L4iBwkaK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2Ase61eEsloNS9SZq1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L4iBwkaK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2Ase61eEsloNS9SZq1.png" alt="Netlify Deploy Settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, you’ll need to make sure you have set the environment variables and have the VUE_APP_API_HOST variable to point to the new site you just created in Netlify. Otherwise your app will not work.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;VUE_APP_API_HOST=https://yourNewSite.netlify.com/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next you want to set your functions directory to use “lambda” which will be the compiled version of the /functions folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I built this app for open source under MIT license so feel free to upgrade it, hack it, or break it.&lt;/p&gt;

&lt;p&gt;This was built using Cosmic JS for the user database.. and the password-hash-and-salt library for hashing. Oh, and don’t forget Vuetify, the amazing Vue JS component library by John Leider and over 200+ open source contributors.&lt;/p&gt;

&lt;p&gt;The email verification is using SMTP server hosted with &lt;a href="https://www.sendinblue.com/?tap_a=30591-fb13f0&amp;amp;tap_s=532760-3bdbbe"&gt;SendinBlue&lt;/a&gt;, they give you 300 free transnational emails. Then of course Vuex for state management.&lt;/p&gt;

&lt;p&gt;If you have trouble or it’s not working for you let me know in the comments and I’ll do my best to help! Or reach out via twitter &lt;a href="https://www.twitter.com/Aaron_Vail"&gt;@Aaron_Vail&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cosmicjs</category>
      <category>javascript</category>
      <category>lambda</category>
      <category>vue</category>
    </item>
    <item>
      <title>How to deploy a blog using Cosmic JS + Vuetify to Netlify</title>
      <dc:creator>-Λaron Vail 👨‍💻</dc:creator>
      <pubDate>Fri, 25 Jan 2019 16:02:36 +0000</pubDate>
      <link>https://dev.to/aaron_vail/how-to-deploy-a-blog-using-cosmic-js--vuetify-to-netlify-jm3</link>
      <guid>https://dev.to/aaron_vail/how-to-deploy-a-blog-using-cosmic-js--vuetify-to-netlify-jm3</guid>
      <description>&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fktssgxqv6y5yei1zcryn.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fktssgxqv6y5yei1zcryn.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, I'm going to show you how to create a minimalistic but awesome single page app blog using Vue, Vuex, Vuetify, Cosmic JS and deploy it to Netlify. Let's get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  TL;DR
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://cosmicjs.com/apps/vuetify-blog" rel="noopener noreferrer"&gt;Demo Link&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/cosmicjs/vuetify-blog" rel="noopener noreferrer"&gt;View Code on Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://app.netlify.com/start/deploy?repository=https://github.com/cosmicjs/vuetify-blog" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.netlify.com%2Fimg%2Fdeploy%2Fbutton.svg" alt="Deploy to Netlify"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Netlify hosting (plus CDN, Prerendering, Minification, etc..)&lt;/li&gt;
&lt;li&gt;  Moderated commenting system (Un-moderated by default)&lt;/li&gt;
&lt;li&gt;  Social share buttons&lt;/li&gt;
&lt;li&gt;  SEO Meta tags with Vue-Meta&lt;/li&gt;
&lt;li&gt;  Integrated content management system via Cosmic JS&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Needed improvements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Static page content connected to Cosmic JS&lt;/li&gt;
&lt;li&gt;  Post categories feature&lt;/li&gt;
&lt;li&gt;  Gravatar comment integration&lt;/li&gt;
&lt;li&gt;  Back/Forward buttons to trigger post view&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will be required to have Node JS and npm before starting. Make sure you already have them installed. If not you can find them here: &lt;a href="https://nodejs.org/" rel="noopener noreferrer"&gt;https://nodejs.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also in order to deploy it you can use Netlify account or &lt;a href="https://cosmicjs.com/?ref=SJHUGTXvf" rel="noopener noreferrer"&gt;Cosmic JS hosting&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Project Structure
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Important things to note:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;~/public/_redirects&lt;/em&gt;&lt;br&gt;
This file is important since it points all your traffic to the index.html file in order for vue-router to handle the requests. To learn more about Netlify redirects &lt;a href="https://www.netlify.com/docs/redirects/" rel="noopener noreferrer"&gt;visit their docs&lt;/a&gt;. You don't need this file if you're deploying via Cosmic JS.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;~/public/favicon.ico&lt;/em&gt;&lt;br&gt;
If you want to customize your favicon you can change this file located within the public directory.&lt;/p&gt;
&lt;h3&gt;
  
  
  Fork and Clone
&lt;/h3&gt;

&lt;p&gt;First we'll be forking the Cosmicify repository on github. Afterwards open up command line or terminal and clone it to your project folder on your local machine with this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clone https://github.com/cosmicjs/vuetify-blog.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use BitBucket or Gitlab instead?&lt;/p&gt;

&lt;p&gt;If you prefer to use a different git provider you can just clone the cosmicify repository and upload it to your desired remote.&lt;/p&gt;
&lt;h3&gt;
  
  
  Install
&lt;/h3&gt;

&lt;p&gt;In your command line &lt;code&gt;cd&lt;/code&gt; into the project root directory that you just cloned and run &lt;code&gt;npm install&lt;/code&gt; to download and install all the required dependencies.&lt;/p&gt;
&lt;h3&gt;
  
  
  Integrate Cosmic JS
&lt;/h3&gt;

&lt;p&gt;In your Cosmic JS account create a new bucket and call it whatever you want.&lt;/p&gt;

&lt;p&gt;Download this &lt;a href="https://raw.githubusercontent.com/availit/cosmicify/master/bucket.json" rel="noopener noreferrer"&gt;bucket.json&lt;/a&gt; file. And in Settings -&amp;gt; Import / Export Data, select and upload the downloaded file. This will import all the Object Types and placeholder data.&lt;/p&gt;
&lt;h3&gt;
  
  
  Bucket Structure
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Settings
&lt;/h4&gt;

&lt;p&gt;There are a couple settings Objects to allow you to change how your blog acts. The global Object has most of the overall options such as choosing whether your comments require you to approve and publish them. Your blog's logo in the navbar, or the "Read More" button text.. Meanwhile the Social profiles Object is to set the social network icons in the footer.&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2A_PIh6zQcpYqHdPHJ.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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2A_PIh6zQcpYqHdPHJ.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Posts
&lt;/h4&gt;

&lt;p&gt;These Objects will be all your blog posts/articles.&lt;/p&gt;
&lt;h4&gt;
  
  
  Profiles
&lt;/h4&gt;

&lt;p&gt;These Objects are for the author that will be posting on the blog. You can change your name, bio and profile picture.&lt;/p&gt;
&lt;h4&gt;
  
  
  Comments
&lt;/h4&gt;

&lt;p&gt;The Comments Objects are exactly that; Comments, typically created via the site's new comment form. They collect Name, Email, and the Comment.&lt;/p&gt;
&lt;h3&gt;
  
  
  Deployment with Netlify
&lt;/h3&gt;

&lt;p&gt;Go to your Netlify dashboard and click "&lt;a href="https://app.netlify.com/start" rel="noopener noreferrer"&gt;New site from Git&lt;/a&gt;". Choose your git provider (I use github). After you authenticate you can see your list of repositories. Select the one you created for this project you created earlier.&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2A-wfxO53GdlVAehSn.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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2A-wfxO53GdlVAehSn.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next it will make you choose a branch, then set some config options for it to run properly.&lt;/p&gt;

&lt;p&gt;Set the deploy directory to &lt;code&gt;dist&lt;/code&gt; and set the deploy command to &lt;code&gt;npm start&lt;/code&gt;&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2APBP0ujLSCKbG-kZu.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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2APBP0ujLSCKbG-kZu.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next you'll click 'Show advanced' in order to set some environment variables.&lt;/p&gt;

&lt;p&gt;Using the list below enter the key and values for your app. You need to enter your Bucket slug in the COSMIC_BUCKET variable. The variables with META in the name are used for the SEO tags on the site. The VUE_APP_DOMAIN is required for the article share links to work properly. For the commenting system to work you need your COSMIC_READ_KEY and COSMIC_WRITE_KEY.&lt;/p&gt;

&lt;p&gt;Required environment variables for the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;VUE_APP_TITLE
COSMIC_BUCKET
COSMIC_READ_KEY
COSMIC_WRITE_KEY
VUE_APP_DOMAIN
VUE_APP_META_TITLE
VUE_APP_META_LOGO
VUE_APP_META_DESC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AfHL_0zfFZEft4w6m.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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AfHL_0zfFZEft4w6m.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once everything looks correct you can click "Deploy site" and it will install and build the app in a couple minutes then publish it live on the internet!&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AEWYQ2sAlf1B4z7rr.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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AEWYQ2sAlf1B4z7rr.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Netlify Post Processing
&lt;/h3&gt;

&lt;p&gt;Netlify offers post processing that runs after your site builds. This is optional but I highly recommend enabling post processing because it enhances your site's performance and prerendering in order for Googlebot to crawl your blog content.&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AdRYDLFQtgcRF49W6.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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AdRYDLFQtgcRF49W6.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I built this app for fun and decided to share it with everyone. It is open source under MIT license so feel free to hack it, modify it, or break it for all I care. Built using Vue, Vuex, and Cosmic JS. Oh, and don't forget Vuetify, the amazing material component library by John Leider and over 200+ open source contributors.&lt;/p&gt;

&lt;p&gt;If you have trouble or it's not working for you let me know in the comments and I'll do my best to help! Or reach out via twitter &lt;a href="https://www.twitter.com/aaron_vail" rel="noopener noreferrer"&gt;@Aaron_Vail&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article was originally posted on &lt;a href="https://aaronvail.io/posts/tutorial-how-to-deploy-a-blog-using-cosmic-js-vuetify-to-netlify" rel="noopener noreferrer"&gt;aaronvail.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>cosmicjs</category>
      <category>javascript</category>
      <category>vuetify</category>
    </item>
  </channel>
</rss>
