
Get started with making a headless CMS and modern Next JS site with these tips.
Developing your own website can be inexpensive with the main running cost being buying a domain, and of course your own time.
Using a "headless CMS" (content management system), such as Sanity, can provide great flexibility for your content across all sorts of devices and choice of modern frameworks including NextJS. Opposed to a traditional CMSs, a headless CMS can publish content to any "front-end" provider, enabling you to choose any sort of coding language and framework. There are many benefits including live editing & saving, image optimisation, generally quicker pagespeed loading, and TypeScript support (a file type that can point out errors during development mode) to name some.
NextJS is developed by Vercel, a popular 'Frontend Cloud' that simplifies deploying sites and integrates along well with Sanity.io and GitHub. The great thing about using such platforms is that they are open-source - having fairly generous free account plans and collaborative communities that are free to join.
All of this is to say that this guide has selected some of the more user-friendly tools out there that don't compromise on capabilities, customisation and scalability. Anyhow, if you're a hands-on person like me, let's dive into it, and do note that the tips throughout are geared for Mac OS users.
As mentioned before, you won't be spending out-of-pocket in this walkthrough other than buying a domain. While some of the platforms have trial account plans, after they expire you will be able to stay on fairly generous free plans to keep your site running. Prep on your desktop the following by installing and creating accounts etc to make the process smoother:
If you don't like the idea of starting from scratch and coding 101, you could quickly learn by working on a template and familiarising yourself with the architecture in a practical way. See this as a phase 1 for getting the bones of your site up and running. Then we'll continue in future guides how to further customise components, add layouts, CSS and install plugins and third-party tools like Google Analytics.
In this guide, we're using https://vercel.com/templates/next.js/sanity-visual-editing-demo
You'll be asked to log into your GitHub account. Then create and name a new "Git Repository". Choose something related to your desired domain name. Note that words should be separated by hyphens. Keep the "Create private Git Repository" ticked as you probably do want to keep your project private.
Add the Sanity integration and you'll be asked to sign into your account and create the new project.
Proceed to Deploy and let it run. Note the estimate build time might not be accurate. You can always open up a new tab to log into your Vercel account and check the progress.
In the GitHub Desktop, click on the Repository panel > Add > Clone Repository...
Select the project by name you created earlier via Vercel.
If you're a Mac OS user, use the shortcut (cmd + shift + F) from GitHub Desktop to "View the files of your repository in Finder".
At the top of the Finder window, click the 3 dots > Get Info
Then, in the popup, look towards the bottom for the "Sharing & Permissions:". Unlock the padlock to change the Privilege for your user profile to have "Read & Write" (if it doesn't already) and then click at the bottom the 3 dots > Apply to enclosed items > OK
and lock the padlock to save changes.
Back in GitHub Desktop you can use the shortcut (cmd + shift + A) to "Open the repository in your external editor".
Within Visual Studio Code open a new Terminal from the nav bar Terminal > New Terminal (or use the keyboard shortcut ctr + opt + `)
Copy + paste + Enter the follow to run as a command in Terminal:
npx vercel linkYou'll be prompted to enter your Mac admin password to proceed.
Tip: whenever you get a Terminal error message about 'EACCES' you can prepend "sudo" to the command you want to run in Terminal.
Then follow the prompts to set up your Vercel project and link the project by the name you recently created.
When that's completed, copy + paste + Enter:
npx vercel env pullNext, in Terminal run the following:
npm install && npm run devThis will install the necessary node.js modules etc and trigger dev mode. Meaning you'll be able to play around with your Sanity CMS in your browser your browser at http://localhost:3000/studio
and view the content at http://localhost:3000
Tip: you can hover on the url that appears in the Terminal messages and hold "cmd + click" to follow the link in your default browser.
You'll be able to access the localhost as long as the Terminal window is open. For future Terminal commands, open another Terminal window (keyboard shortcut: ctr + opt + `). Have a play around the CMS and create some test pages to familiarise yourself with the environment.
Tip: While Visual Code Studio extensions are great at highlighting errors, sometimes things get missed, so you can always double check your code by running in a new Terminal window the command:
npm run buildIn Visual Studio Code, locate the "intro-template" folder and delete it.
Then locate the "Layout.tsx" file in components > shared >
Edit the file to remove instances of "IntroTemplate". You'll see the div class below the line for the footer to delete:
<IntroTemplate />and the import call for that component at the top of the file to delete:
import IntroTemplate from 'intro-template'If you haven't already, register a domain, in this example via Cloudflare.
In your Vercel account online, go to your project's Settings > Domains
to add your domain. Follow the instructions to add your DNS records in your Cloudflare domain's DNS Records Configuration.
e.g. add Type "A" record for the nonWWW version of your domain and Type "CNAME" record for the WWW version of your Vercel domain url.
Tip: In the record settings, switch the Proxy status from "Proxied" to "DNS only"
Back in Vercel it will automatically validate configuration. Ensure that you haven't made "redirection loops" and that variations of the site domains point to the one desired domain version.
Go to your GitHub Desktop app to use the shortcut button "Commit to main". Best practice is to fill in a detailed Summary and Description of what changes you've made. For example, include a datestamp and list files you made changes to and the level of impact on your site.
This should trigger GitHub to "back up your copy of the site" and trigger Vercel to publish your site on your domain.
Congrats! In Vercel, you should be seeing the green Status "Ready" on your Production Deployment.
If not, you'll need to do some troubleshooting. You can click into your Vercel Deployment Details > Building > Errors to see the log of issues.
Or from your local project, use Terminal to run the command "npm run build".
Typical issues could be typos in the code - check for syntax errors, or your Vercel Project Settings > Node.js Version not matching what you've installed, or your Domains redirection settings.
You'll only need to make future "deployments" when making "backend" changes to, for example, page layouts and adding new components. You can always access your headless CMS from "yourdomain.co.uk/studio" and do content editing and publishing from there. You may need to wait a while for caching to clear before you see changes published. Make it a habit to hard refresh your browser (keyboard shortcut cmd + shift + R) before doing further troubleshooting. You can also force caching to clear from your Cloudflare account > Websites > Caching > Configuration > Purge Everything
Recent blog posts (3)

Learn more about how cookies and cookieless tracking drive better ad campaigns, improve user experience, and help brands make smarter content decisions.

What comes to mind when you hear "Search Engine Optimization" (SEO)? If keywords and backlinks are popping up, you're thinking in pre-AI terms. Traditional SEO tactics, once designed to help search engines match text-based queries to webpages, are no longer enough.

Digital content is the first and often the last point of contact for customers in a state of urgency. A global SEO strategy produces many benefits for both customers and support agents.