GridsomeGraphQLJamstack

Dishit Dhanesha

Fri Mar 25 2022

Dishit Dhanesha
blog

Overview


Static web development, which traditionally means playing around with HTML and CSS. We’ll naturally call any website built with HTML and CSS a static website as no form of dynamic action is going on. Here to make this process much easier and faster static site generators are introduced. Static Site Generators are a new, hybrid approach to web development that allows you to build a powerful, website locally on your computer but pre-builds the site into static files for deployment.
These Static Site Generators follow Jamstack Architecture. Jamstack, a comparatively new and latest term that is a modern web development architecture, and Gridsome is a framework following Jamstack Architecture, it is a Vue-powered static site generator for building blazing fast static websites. Now you might think that why Jamstack and Gridsome terms are being so popular in a short span of time. So here comes in the picture its advantages over the architectures and frameworks we are using currently and we will discuss the same in this article with its implementation.
So Let’s Hop On It.


Introduction to Jamstack.


  • Jamstack stands for Javascript API Markup, It is a web development architecture used to make the web faster, more secure, and easier to scale. Jamstack works on the core principle of pre-rendering and decoupling. Jamstack Architecture is mostly used to develop and generate static web apps. There is a huge community of Jamstacks built on top of multiple modern frameworks like React, Angular, and Vue.js.

Introduction to Gridsome.


  • Gridsome is a Jamstack framework built on top of Vue.js and GraphQL. Gridsome makes it easy for developers to build static generated websites & apps that are fast by default. In Gridsome Vue.js is used for the frontend and GraphQL acts as a data source. Gridsome generates static HTML that hydrates into a Vue SPA once loaded in the browser. This means you can build both static websites & dynamic apps with Gridsome. Gridsome builds ultra-performance into every page automatically. You get code-splitting, asset optimization, progressive images, and link prefetching out of the box. With Gridsome you get almost perfect page speed scores by default.

Architecture of Gridsome.


  • Gridsome is built using Vue.js as frontend and GraphQL as the data layer. In Gridsome data can be stored and can render in the frontend using APIs, Databases, AirTable, YAML, CSV, JSON, etc. Gridsome supports any headless CMS like WordPress, Drupal, sanity.io, Netlify CMS, etc to manage the content of the website.
  • GraphQL is responsible to bring all the required data from the data source and pass it to the frontend.
  • Built Gridsome project can be deployed serverless to Netlify hosting, AWS Amplify, Amazon S3, and many other hosting services.

Architecture of Gridsome

Working of Gridsome.


  • Gridsome generates static HTML that hydrates into a Vue.js SPA once loaded in the browser. This means you can build both static websites & dynamic apps with Gridsome.
  • Gridsome builds one .html file and one .json file for every page. After the first page load, it only uses the .json files to prefetch and load data for the next pages. It also builds a .js bundle for each page that needs it (code splitting).

    Installation Process


        1. Install Gridsome CLI tool
            -Using YARN:yarn global add @gridsome/cli
            -Using NPM:npm install --global @gridsome/cli
        2. Create a Gridsome project
                gridsome create my-gridsome-site to create a new project
                cd my-gridsome-site to move into project directory
                gridsome develop to start local dev server at http://localhost:8080
                Happy coding 🎉🙌
        3. Next steps
            Create .vue components in the src/pages directory to create page routes.
            Use gridsome build to generate static files in a /dist folder

Benefits of Using Gridsome.


Gridsome is fast by default. Gridsome generates static PWAs. Only critical HTML, CSS, and JavaScript get loaded first. The next pages are then prefetched so users can click around incredibly fast without page reloads, even when offline. Simple, safe deployment, no servers, no databases, Only files. Deploy your entire site to a CDN and forget about it. SEO-friendly Gridsome sites load as static HTML before they hydrate into fully Vue. js-powered SPAs.

Conclusion

Gridsome is one of the fastest frameworks which follows Jamstack Architecture. Gridsome makes it easy for developers to build and deploy seamlessly fast web apps and statically generated websites. Gridsome is lightweight, one of the most secure and SEO-friendly frameworks, which developers love to use.


Share post on
Recent Posts

Why Reveation Labs

We are a team that is technically proficient and simultaneously caring for your business. Our ideology is to provide the latest technologies that suit your business well.

Let’s discuss your requirements!

Give your business the next-gen technology it deserves. Be a part of our family of successful enterprises that work on high-end software solutions.

Experts
Experts

In all the latest technologies and developments.

Experts
Creative

To innovate the best solutions and pick the right technology for you.

Experts
Ethical

To always put you first & respect your business values and procedures.

Experts
Dedicated

To meet the deadlines and help you until the very end and beyond.

Experts
Approachable

For all your business needs and queries at any point of time.

Experts
Transparent

In our ways of working.