Contentful & Next.js

Published on Dec 4, 2022

A friend of mine recently reached out about building a new website, where the content would be managed entirely in a headless CMS, in this case Contentful.

I've worked with many CMSes and worked with Next.js before but this was the first time I'll be combining the two.

What is Next.js

Next.js is a React framework for building websites, developed by the team at Vercel. I've only hosted those sites on Vercel, but you can host them with a large number of web hosting companies or host them yourself.

What is Contentful?

Contentful is a headless CMS. Headless CMSes give you a UI to create your content, and an API instead of a templating system to publish your content.

Why not Laravel?

That was an option for sure, I even explored the idea, but I decided primarily because the javascript sdk that Contentful offers seems to be the preferred way of interfacing with their systems. There is a lot of documentation, tutorials and guides for building sites in javascript, and not so many in PHP.

Since this is my first time building with Contentful, and something I wanted to get built pretty quickly this seems to be safest way to go.

Staying in sync

One of the problems I've run into previously with Headless CMSes is keeping the website in sync with the content that is published and updated in the CMS. Usually requires a lot of custom code as you build out the front end of the website.  

Thankfully Next.js provides all the tooling to need to handle this pretty transparently. While no system is perfect, when you try and scale any solution will give your periods of time where content is out of sync. However building a system from the beginning that will grow with you as your website traffic grows is very nice.

Developer Experience

I'm looking forward to building out the website, the developer experience is pretty great.  

Contentful is very developer focused, their SDKs look great, it has to be or no one can publish sites with the content they manage.

Next.js is also focused on the developer experience, from local development to deploying sites (in particular) with Vercel is very smooth.

More to come about the project and the process as I build out the website, watch this space!