Archived article
← All articles

Getting started with JAMstack

An introduction to static sites with Nuxt.js and a Git-backed content workflow.

An earlier article, retained in the writing archive. Tool names and setup commands reflect the original publication.

Introduction

JAMstack has been all the rage recently — and for good reason — because it enables developers and content creators to move a lot faster with getting their content online.

There are a lot of options for the stacks to use with JAMstack, you first need a frontend — this usually being an SSG (Static Site Generation) enabled JavaScript framework — and a backend to manage all the dynamic data you want to display on your site, simple right?

Short answer is no. There are a lot of options for both requirements, and if you're not a seasoned frontend developer it's easy to get lost due to the amount of options available.

But don't panic just yet! In this article I'll try to make it as simple as possible to start creating your own JAMstack website.

What is JAMstack anyway?

Jamstack is an architecture designed to make the web faster, more secure, and easier to scale. It builds on many of the tools and workflows which developers love, and which bring maximum productivity.

The core principles of pre-rendering, and decoupling, enable sites and applications to be delivered with greater confidence and resilience than ever before.

This is how jamstack.org (a Netlify-started movement) explains it, which is a very good resource to get familiar with the technology, but in this article we'll get started by doing instead of reading.

Choosing our stack

First we need to choose a frontend framework with SSG to get started with. There are two popular choices in this step, those being React and Vue, with each of them having separate tools to use for SSG.

Some examples for React based tools being:

And some Vue based tools being:

We'll be using Nuxt.js which is a fantastic and easy to use solution, with a lot of starter templates, an amazing community, and stellar documentation.

Next we'll be choosing a headless CMS to hold our dynamic data. There are a lot of options here too like:

We'll be using NetlifyCMS which is the easiest, fastest, and cheapest solution to get started with. Being git hosted as opposed to something like Strapi which you need to host on something like Digital Ocean or Heroku, and being completely free to use with automatic, free git deployments to use with something like Netlify or Vercel.

Getting started

Getting started with using our stack is extremely simple, we could just use one of the many starters to get on with developing our website.

We'll be using xdesro's super minimal starter to get started, which is based on npx create-nuxt-app <App name> and NetlifyCMS generating .md files to save data to.

Nuxt starter

First we should clone the repo locally and install all the dependencies by running:

git clone https://github.com/xdesro/nuxt-netlify-cms-starter
cd nuxt-netlify-cms-starter
npm install

After that we should start the development server by running:

npm run dev

Our application is now running on http://localhost:3000. Nice job!

Next we'll install a super useful plugin called Nuxt Content, which allows us to easily query the data stored by NetlifyCMS.

npm i @nuxt/content

And importing the package to use in nuxt.config.js by adding it to the modules like this:

modules: ["@nuxtjs/markdownit", "@nuxt/content"];

And voila! We're done with all the setup! Now let's start customizing our portfolio/blog to make it our own.

Customization

We can now customize our application by changing the landing page, or creating new pages. Nuxt makes this super easy by specifying a layout file located at layouts/default.vue which we can change to include say a navbar and a footer components. Nuxt also automatically detects files in the pages directory and routes to them when the user navigates to the page.

We can customize our landing page by changing the content of pages/index.vue to something like:

<template>
  <div>
    <h1>Hello world!</h1>
  </div>
</template>

From here, the sky's the limit.

Bonus: NetlifyCMS

If you want to see how NetlifyCMS makes things super simple you can follow along, I promise it won't take as long as getting things set up.

To start using NetlifyCMS locally we need to start a proxy server. It sounds complicated but it really isn't, you just need to run one command in your terminal and you're good to go!

Simply run:

npx netlify-cms-proxy-server

And navigate to http://localhost:3000/admin and you should be greeted with your admin dashboard where you can create new blog posts!

Admin dashboard

Now if we create a new blog post it should be updated in our landing page.

Creating a new blog post

Reflected in our landing page

Conclusion

This should get you started with using Nuxt.js and NetlifyCMS to create your own awesome websites.

If you face any issues following along this article, or want to get in touch I encourage you to do so!

Hope this could help.