<?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>Forem: Julien Vanelian</title>
    <description>The latest articles on Forem by Julien Vanelian (@julienvanelian).</description>
    <link>https://forem.com/julienvanelian</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%2F518093%2F16ea5fe5-d304-4628-821f-2921eb157cd3.jpg</url>
      <title>Forem: Julien Vanelian</title>
      <link>https://forem.com/julienvanelian</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/julienvanelian"/>
    <language>en</language>
    <item>
      <title>Building and deploying a static blog with Nuxt.js, Sakura, GraphCMS and Vercel</title>
      <dc:creator>Julien Vanelian</dc:creator>
      <pubDate>Sun, 22 Nov 2020 17:40:40 +0000</pubDate>
      <link>https://forem.com/julienvanelian/building-and-deploying-a-static-blog-with-nuxt-js-sakura-graphcms-and-vercel-4n97</link>
      <guid>https://forem.com/julienvanelian/building-and-deploying-a-static-blog-with-nuxt-js-sakura-graphcms-and-vercel-4n97</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Recently, I've been trying Nuxt.js and it's a really great experience. I decided to write an article on making something cool! The goal of this project is to create a simple static blog.&lt;/p&gt;

&lt;p&gt;For this project, I have chosen to use &lt;a href="https://nuxtjs.org" rel="noopener noreferrer"&gt;Nuxt.js&lt;/a&gt;, &lt;a href="https://oxal.org/projects/sakura" rel="noopener noreferrer"&gt;Sakura&lt;/a&gt;, &lt;a href="https://graphcms.com" rel="noopener noreferrer"&gt;GraphCMS&lt;/a&gt; and &lt;a href="https://vercel.co" rel="noopener noreferrer"&gt;Vercel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nuxt.js&lt;/strong&gt; is a JavaScript framework built on top of &lt;a href="https://vuejs.org" rel="noopener noreferrer"&gt;Vue.js&lt;/a&gt;. We'll be using this to build our app, handle the routes, and generate our final website.&lt;/p&gt;

&lt;p&gt;Sakura is what we call a &lt;strong&gt;Classless CSS Framework&lt;/strong&gt; or a &lt;strong&gt;Drop-in CSS&lt;/strong&gt;. It's a CSS framework which can be dropped in an HTML to style it. For this to work, we will be using &lt;strong&gt;HTML semantic tags&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GraphCMS&lt;/strong&gt; is a &lt;strong&gt;headless CMS&lt;/strong&gt;, which means it doesn't serve templates/views created from your content unlike Wordpress, Joomla! or Drupal. GraphCMS will be used to manage and create our articles. Under the hood, GraphCMS uses GraphQL, which we will be using to query our data from Nuxt.js.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vercel&lt;/strong&gt; is basically a cloud platform for &lt;strong&gt;serverless deployments&lt;/strong&gt;. We will be using it to deploy our finished blog on the web.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating our content with GraphCMS
&lt;/h1&gt;

&lt;p&gt;Let's begin by creating our data, in our case: blog posts!&lt;/p&gt;

&lt;p&gt;If you haven't done yet, go create yourself an account on &lt;a href="https://graphcms.com" rel="noopener noreferrer"&gt;graphcms.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now when that's done, create a new project. Name it however you want, it'll serve for our blog.&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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A657%2Cwidth%3A935%2Fa7sgKu3QrOjIRWQAatMg" 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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A657%2Cwidth%3A935%2Fa7sgKu3QrOjIRWQAatMg" alt="New project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After all the basic setup done, you'll be presented with a dashboard. Notice the quick start guide! Click on "Set up your schema".&lt;/p&gt;

&lt;p&gt;In GraphCMS a schema represents an entity, which will hold many instances of itself, like a table in SQL. Create a new schema, then fill in and confirm the information in the opened modal.&lt;/p&gt;

&lt;p&gt;I created a model named &lt;code&gt;Post&lt;/code&gt;, and here's the schema I've made:&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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A379%2Cwidth%3A737%2F9cA42muYSpatu8cgfu5p" 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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A379%2Cwidth%3A737%2F9cA42muYSpatu8cgfu5p" alt="Fields definition"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we've setup our schema, let's add the first post! Click on the content button on the left, click on create. You'll be prompted with a pretty form, ready to be filled in!&lt;/p&gt;

&lt;p&gt;When you are done writing your blog post, press "Save and publish" on the top right, this will make your article ready to be retrieved later on from our code.&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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A496%2Cwidth%3A646%2F80rsfLVHSQKj2K4BmOcz" 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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A496%2Cwidth%3A646%2F80rsfLVHSQKj2K4BmOcz" alt="Post details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To test our schema, head to what GraphCMS calls "API Playground". Let's click on the "Explorer" tab to see which fields we are able to retrieve. As you check these fields, the related GraphQL query gets generated on the center. This is the query we are going to use in Nuxt.js to get all of our posts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="k"&gt;query&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;MyQuery&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;slug&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will use this query to get all the posts of our blog.&lt;/p&gt;

&lt;p&gt;Let's continue with Nuxt.js in the next section.&lt;/p&gt;

&lt;h1&gt;
  
  
  Building our blog with Nuxt.js
&lt;/h1&gt;

&lt;p&gt;Now the real fun begins, let's open up our terminal and create a new folder for our project. We will be using Git for this project.&lt;/p&gt;

&lt;p&gt;In this folder, create a package.json file, and put in this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"my-blog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"dev"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nuxt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"generate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nuxt generate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nuxt start"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We've already put some scripts in there as you can see (&lt;a href="https://nuxtjs.org/docs/2.x/get-started/commands" rel="noopener noreferrer"&gt;more info here&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;yarn dev&lt;/code&gt; will be used to launch our development environment&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;yarn generate&lt;/code&gt; will be used by Vercel to build the production files&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;yarn start&lt;/code&gt; can be used to locally test the production files &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that, go back to your terminal and run &lt;code&gt;yarn add nuxt&lt;/code&gt; to install Nuxt.js as a dependency.&lt;/p&gt;

&lt;p&gt;Here I use yarn, but with npm that would be &lt;code&gt;npm install nuxt&lt;/code&gt;. If you feel lost, don't hesitate to check out the Nuxt.js &lt;a href="https://nuxtjs.org/docs/2.x/get-started/installation" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As we will be using git, add a &lt;code&gt;.gitignore&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
.nuxt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's add a bit of configuration, to get setup and running. Add a &lt;code&gt;nuxt.config.js&lt;/code&gt; in the project root, and write the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;graphcmsEndpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GRAPHCMS_ENDPOINT&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;static&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Disables the page change loader on the top&lt;/span&gt;
  &lt;span class="na"&gt;head&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;htmlAttrs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;titleTemplate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;%s - My Blog&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;charset&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf-8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;viewport&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;width=device-width, initial-scale=1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, I use an environment variable to get the GraphCMS endpoint URL, more on this later. Also, notice the target value is static. Doing so, Nuxt will pre-render all your pages. Check &lt;a href="https://nuxtjs.org/blog/going-full-static" rel="noopener noreferrer"&gt;this article&lt;/a&gt; for more info.&lt;/p&gt;

&lt;p&gt;As we will be using GraphQL, we need to install the &lt;code&gt;graphql-request&lt;/code&gt; package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add graphql graphql-request
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to tell Nuxt.js we're using this module as a plugin, head into your nuxt.config.js and add &lt;code&gt;plugins: ['~/plugins/graphcms.js'],&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create a config file in your project root: &lt;code&gt;./plugins/graphcms.js&lt;/code&gt;. In this file we'll write this piece of code which will create for us a GraphQL client:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;GraphQLClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;graphql-request&lt;/span&gt;&lt;span class="dl"&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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;inject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;inject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;graphcms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;GraphQLClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;graphcmsEndpoint&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We now need to create the layout of our app. Add a &lt;code&gt;layouts&lt;/code&gt; folder in the project folder, and a &lt;code&gt;default.vue&lt;/code&gt; file in it. &lt;strong&gt;Layouts in Nuxt.js are templates which will be extended by our pages&lt;/strong&gt;. A layout can contain a header, a footer, etc. Everything that is common to all pages. Note that you can still create specific layouts for different pages if needed.&lt;/p&gt;

&lt;p&gt;Here's a basic layout I came up with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;My blog&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;nav&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;NuxtLink&lt;/span&gt; &lt;span class="na"&gt;to=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/NuxtLink&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;main&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;Nuxt/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Nuxt.js, &lt;code&gt;&amp;lt;Nuxt/&amp;gt;&lt;/code&gt; is a special component which indicates that pages will be rendered here.&lt;/p&gt;

&lt;p&gt;Just for this sake of this article, let's turn the header into a component. Create a &lt;code&gt;components&lt;/code&gt; folder at the root of your project and create a &lt;code&gt;navbar.vue&lt;/code&gt; file. Let's put in our header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;My blog&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;nav&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;NuxtLink&lt;/span&gt; &lt;span class="na"&gt;to=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/NuxtLink&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we've created a &lt;code&gt;navbar&lt;/code&gt; component, let's remove the old header and include the new component in our &lt;code&gt;default.vue&lt;/code&gt; layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Navbar/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;main&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;Nuxt/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Much better!&lt;/p&gt;

&lt;p&gt;To use our header component in our layout, we actually don't need to manually import it like in Vue.js. We can put &lt;code&gt;components: true&lt;/code&gt;, in our &lt;code&gt;nuxt.config.js&lt;/code&gt; to tell nuxt to &lt;a href="https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-components" rel="noopener noreferrer"&gt;automatically import components&lt;/a&gt; based on their file name!&lt;/p&gt;

&lt;p&gt;In Nuxt.js the routing is done automatically based on the files and folders, this is commonly called &lt;strong&gt;file-system based routing&lt;/strong&gt;. For more information see the &lt;a href="https://nuxtjs.org/docs/2.x/features/file-system-routing" rel="noopener noreferrer"&gt;routing docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's create a &lt;code&gt;pages&lt;/code&gt; folder inside our project root with an &lt;code&gt;index.vue&lt;/code&gt; file in it, this will be our main blog page, where all the articles are listed. In the previous section, we created a GraphQL query from the API Playground, let's use it to get all the posts.&lt;/p&gt;

&lt;p&gt;This is what I came up with.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;NuxtLink&lt;/span&gt;
      &lt;span class="na"&gt;v-for=&lt;/span&gt;&lt;span class="s"&gt;"post in posts"&lt;/span&gt;
      &lt;span class="na"&gt;:to=&lt;/span&gt;&lt;span class="s"&gt;"{ name: 'slug', params: { slug: post.slug } }"&lt;/span&gt;
      &lt;span class="na"&gt;:key=&lt;/span&gt;&lt;span class="s"&gt;"post.slug"&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h3&lt;/span&gt; &lt;span class="na"&gt;v-text=&lt;/span&gt;&lt;span class="s"&gt;"post.title"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/NuxtLink&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;gql&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;graphql-request&lt;/span&gt;&lt;span class="dl"&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;asyncData&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;$graphcms&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;$graphcms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nx"&gt;gql&lt;/span&gt;&lt;span class="s2"&gt;`
        {
          posts {
            title
            slug
          }
        }
      `&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;

  &lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Blog&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I'm using &lt;a href="https://nuxtjs.org/docs/2.x/features/data-fetching#async-data" rel="noopener noreferrer"&gt;&lt;code&gt;asyncData&lt;/code&gt;&lt;/a&gt; to retrieve the post list. The GraphQL request's data is transformed into an object, which is used in the template to display the blog posts. You can see I used a route name called &lt;code&gt;slug&lt;/code&gt; which in Nuxt.js corresponds to a template located at &lt;code&gt;project/pages/_slug.vue&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After creating our post list, let's create a page to show the actual content of the posts. I named it &lt;code&gt;_slug.vue&lt;/code&gt; in my case, as I want the URL to show the slug of the post.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;v-if=&lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;v-text=&lt;/span&gt;&lt;span class="s"&gt;"post.title"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;small&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;Posted {{ formatDate(post.createdAt) }}&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt; &lt;span class="ni"&gt;&amp;amp;mdash;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;Updated {{ formatDate(post.updatedAt) }}&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/small&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;v-html=&lt;/span&gt;&lt;span class="s"&gt;"post.content.html"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;gql&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;graphql-request&lt;/span&gt;&lt;span class="dl"&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;asyncData&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;$graphcms&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;$graphcms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nx"&gt;gql&lt;/span&gt;&lt;span class="s2"&gt;`
        query GetPost($slug: String) {
          post(where: { slug: $slug }) {
            title
            content {
              html
            }
            slug
            createdAt
            updatedAt
          }
        }
      `&lt;/span&gt;&lt;span class="p"&gt;,&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="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;

  &lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;

  &lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;formatDate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;)&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;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;year&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;numeric&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;month&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;short&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;numeric&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;default&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note: I used the &lt;code&gt;createdAt&lt;/code&gt; field to show the published date. While this is incorrect, I just couldn't get the &lt;code&gt;publishedAt&lt;/code&gt; to work, as it was changed on every edit -&amp;gt; publish.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You'll notice I used the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl" rel="noopener noreferrer"&gt;Intl&lt;/a&gt; API to format the dates as it doesn't require additional libraries, but you could use something else if needed. For the actual content of the post, I went for HTML. You could retrieve the post content in multiple formats, like HTML, markdown, raw and text. You can experiment with that in the API Playground on GraphCMS.&lt;/p&gt;

&lt;p&gt;If you try to launch the project with &lt;code&gt;yarn dev&lt;/code&gt; right now, you may encounter an "Only absolute URLs are supported" error. This is because the GraphCMS endpoint URL we specified must come from and environment named &lt;code&gt;GRAPHCMS_ENDPOINT&lt;/code&gt; in our case. You could set that URL now, or wait till the end where we set it on Vercel.&lt;/p&gt;

&lt;p&gt;If you wish to set it now, set the env variable in your shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GRAPHCMS_ENDPOINT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://api-eu-central-1.graphcms.com/v2/XXXXXXXXXXXXX/master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you can run the project without issues. Instructions on how to get the URL are in the 'Deploying our blog with Vercel' section down below.&lt;/p&gt;

&lt;p&gt;So this is how our blog looks like right now:&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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A137%2Cwidth%3A634%2FUWyvUq0FTrq50kHUxsqA" 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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A137%2Cwidth%3A634%2FUWyvUq0FTrq50kHUxsqA" alt="Homepage without Sakura.css"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Styling our blog with Sakura
&lt;/h1&gt;

&lt;p&gt;Sakura is one of those drop-in CSS frameworks, just include the CSS file in your HTML, and you're done!&lt;/p&gt;

&lt;p&gt;Looking at the &lt;a href="https://github.com/oxalorg/sakura#installation" rel="noopener noreferrer"&gt;readme&lt;/a&gt;, installing normalize.css is recommended, as Sakura.css is not built with a CSS reset. Let's install the dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add sakura.css normalize.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that is done, add this line to your nuxt.config.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;css&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;normalize.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sakura.css/css/sakura-vader.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we load normalize.css first, then we load Sakura, as explained in their readme. This will ensure the best of both worlds. Don't forget to edit the theme name of Sakura if you've chosen something different.&lt;/p&gt;

&lt;p&gt;Now, with this done, let's go back to our browser to see the changes:&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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A605%2Cwidth%3A713%2FqHKYlB7QS7iUbcZmIGec" 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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A605%2Cwidth%3A713%2FqHKYlB7QS7iUbcZmIGec" alt="Homepage with Sakura.css"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can always add &lt;a href="https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-css" rel="noopener noreferrer"&gt;custom CSS&lt;/a&gt; to change the styling according to your needs.&lt;/p&gt;

&lt;p&gt;That was easy, it's the spirit of classless CSS frameworks!&lt;/p&gt;

&lt;h1&gt;
  
  
  Deploying our blog with Vercel
&lt;/h1&gt;

&lt;p&gt;Importing our blog into Vercel is easy, just click "Import project" on your Vercel dashboard, select "Import Git Repository" and put the link of your repository.&lt;/p&gt;

&lt;p&gt;Let's now add the GraphCMS endpoint URL as an env variable so it can be used by our code. From the import project screen, we'll create an &lt;code&gt;GRAPHCMS_ENDPOINT&lt;/code&gt; env variable and assign our endpoint URL to it. This endpoint URL can be found in GraphCMS by going to Settings -&amp;gt; API Access -&amp;gt; Endpoints (don't forget to edit the 'Public API permissions' settings).&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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A279%2Cwidth%3A605%2Ftmt2XynaSsIHKpjVNn0j" 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%2Fmedia.graphcms.com%2Foutput%3Dformat%3Awebp%2Fresize%3Dheight%3A279%2Cwidth%3A605%2Ftmt2XynaSsIHKpjVNn0j" alt="Environment variables"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also install "Vercel for GitHub" on your repository, this will ensure your deployed app is in sync with a specific branch.&lt;/p&gt;

&lt;p&gt;And this concludes our basic Vercel setup!&lt;/p&gt;

&lt;h1&gt;
  
  
  Syncing changes with Webhooks
&lt;/h1&gt;

&lt;p&gt;Right now, we need to manually re-deploy our app on Vercel to see the changes we made to our content. What if there is a better way to do this?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;There is!&lt;/em&gt; And it's called &lt;strong&gt;Webhooks&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Webhooks are a way to make apps talk to each other, send signals and/or data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In our case, each time we edit/create content on GraphCMS, we want to trigger a Vercel deployment. Let's do that right now!&lt;/p&gt;

&lt;p&gt;First, we need to get a deploy hook from Vercel. This is basically &lt;strong&gt;an URL that can be called and will trigger re-deployments from a specified git branch&lt;/strong&gt;. So back to Vercel, in your project settings you should see a "Deploy Hooks" section. Name yours however you like, specify the git branch you want to deploy automatically on each GraphCMS and click "Create Hook". Copy the hook URL and let's head back to GraphCMS!&lt;/p&gt;

&lt;p&gt;On your GraphCMS dashboard, click on the webhooks button on the left sidebar. Click on create, and fill in the form with the appropriate details.&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%2Fmedia.graphcms.com%2F5V1f4JESKCBVejSFEE4G" 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%2Fmedia.graphcms.com%2F5V1f4JESKCBVejSFEE4G" alt="Webhook"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice how I specified to execute this webhook only for published posts. Also, you can uncheck 'Include payload', as our webhook doesn't need any extra data to send.&lt;/p&gt;

&lt;p&gt;Now go back to your article, edit/save/publish it, and go back to Vercel. You should see a build going on. Wait a bit, and voilà! Your edits are live!&lt;/p&gt;

&lt;p&gt;See? That's the power of webhooks, and you could do more than that! Send slack messages, SMS, emails, etc.&lt;/p&gt;

&lt;p&gt;Having this done, I guess we can call this little project finished for now. I have a few ideas and improvements for this blog, but this will be subject to another article.&lt;/p&gt;

&lt;h1&gt;
  
  
  Closing Words
&lt;/h1&gt;

&lt;p&gt;We're done! Imagine if we were doing this with bare PHP 15 years ago... We've got the chance to make whatever we want with easy tools, so make whatever you dream of!&lt;/p&gt;

&lt;p&gt;Classless CSS frameworks were a new discovery for me, but as these frameworks aren't new, they are starting to get popular right now.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using this technology stack has proven to be very productive in my opinion. There's little time between idea and prototype. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can find the complete blog code over here on my github: &lt;a href="https://github.com/JulienVanelian/nuxtjs-graphcms-sakura-starter" rel="noopener noreferrer"&gt;nuxtjs-graphcms-sakura-starter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That's all for now folks, I hope you liked this post!&lt;/p&gt;

&lt;h1&gt;
  
  
  Moving Forward
&lt;/h1&gt;

&lt;p&gt;But wait! At this time of writing, Vue.js 3 is already out! Right now, Nuxt.js still uses Vue.js 2 in the background. I've heard Nuxt.js is going to support Vue.js 3 soon and I think we can expect a lot of improvements from this. Also, GraphCMS are currently working on a Vercel integration, this means we probably wont need to setup the webhook like we did!&lt;/p&gt;

&lt;p&gt;Also new stuff coming ➡️ &lt;a href="https://twitter.com/Atinux" rel="noopener noreferrer"&gt;@Atinux&lt;/a&gt; (Sébastien Chopin - Co-Creator @ Nuxt.js) said that official &lt;a href="https://twitter.com/Atinux/status/1324464524402020353" rel="noopener noreferrer"&gt;serverless support is coming to Nuxt.js&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;If you've found this useful, &lt;a href="https://twitter.com/JulienVanelian" rel="noopener noreferrer"&gt;follow me on Twitter&lt;/a&gt; and check out &lt;a href="https://jvanelian.dev/blog" rel="noopener noreferrer"&gt;my blog&lt;/a&gt;, where this article was first posted!&lt;/p&gt;

&lt;p&gt;Thanks for reading,&lt;/p&gt;

&lt;p&gt;Julien&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>graphcms</category>
      <category>vercel</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
