I have toyed with the idea of changing my own site (this one you are reading) to use a React Next.js front end, with WordPress operating as a headless CMS, for some time now. I’ve always been slightly put off by the extra overhead of needing a JS service as well as my usual web hosting. Especially since my site is very low traffic – there’s basically no benefit!
But it’s always good to try these things out and see what I learn along the way!
What’s needed to start with?
There are two key parts to this:
- The CMS – We already have the WordPress instance set up, that’s this site. We’ll just be serving the content from this site using the WP REST API. Easy.
- A Vercel account – There are other options, but I decided to go with Vercel since they are the creators of Next.js. And that’s the React framework I decided to use due to it’s popularity. Vercel have free “hobby” accounts that have a limit, but it should be more than enough for me playing around.
- UPDATE! Soon after launching this, Siteground (my WordPress host) started offering Node.js apps. So I have actually switched from Vercel to Siteground – mostly to keep things nice and simple to maintain. Siteground seems to have a different pricing model: No request metering. Vercel counts invocations, bandwidth and build minutes, whereas on a SiteGround Cloud plan you have a fixed slice of a server on my Cloud hosting. I prefer this option for now. Anyway, I’ll leave the Vercel stuff in below as somebody else might find the setup useful.
- A Github repo – This is required for the Vercel front end app to go in.

Setting up a Vercel account was easy enough, and soon I was into my new dashboard having a look around.
But before I go any further…
Start coding!
Started by scaffolding a Next.js app in my local machine. Again, this is pretty easy and at this stage can be kept fairly basic because, well, my site’s not very big anyway so I am sure it doesn’t need too many components.
I also took a decision to do this in chunks – I’d start with getting the blog working, then move on to pages later. The reason for this is that the default WP REST API (/wp-json/), page content comes back empty via the API — it’s built with my ACF page builder that stores markup outside the normal REST-visible fields like post_content. So here’s where I started:
- Next.js app in
screencandy-vercel, homepage hand-built in JSX/Tailwind recreating the real site’s copy/layout. - Blog is the headless part —
lib/wordpress.jsfetches live posts from screencandy.co.uk’s REST API,app/blog/page.jslists them,app/blog/[slug]/page.jsrenders each one with real content/images
At this point I pushed all this up to Github and went back to my Vercel dashboard to set up a project. You connect to your Github account, and then you can search for a repo and import it.
I hit one stumbling block where my repo showed up in the picker but failed on import — This was a GitHub App permissions issue. Vercel’s GitHub integration can be installed with access to only select repositories, and a brand-new repo like this one often isn’t in that list yet even though GitHub’s autocomplete shows it (autocomplete uses your general GitHub access, the actual import uses the Vercel App’s granted list).
The fix:
- Go to github.com/settings/installations (or Vercel → your avatar → Settings → Git → GitHub, then “Manage” next to the connection).
- Find the Vercel app in the list, click Configure.
- Under “Repository access,” either switch to All repositories, or if it’s set to “Only select repositories,” add the repo to the list.
- Save and go back to “new project” and find repo again.
And it’s actually pretty much done! I was able to click on the temporary screencandy-vercel.vercel.app address and see the app running nicely. So far it looks like this…

But I wanted to make sure that my entire site was being served by the app from WordPress API – not just the blog, plus a recreation of the rest of the content in JSX code.
Why that output is awkward for Next.js
We have already established that the post_content is not present on these pages – they are built using a bunch of ACF fields using post_meta. There’s also a few other issues with using the default WP REST API as it would currently stand. Here are some examples of other problems:
- Images: a screenshots gallery comes back as bare attachment IDs, unless we set the return format, and then you still have to decide the image sizes.
- Wysiwyg fields come back as raw HTML. You’d want to sanitise or render that HTML in Next.
- Computed external data: As an example of this, we have a page with plugins, and their version, zip URL and repo link are fetched from GitHub in
app/github.phpat render time. The default WP REST output has no idea they exist, so Next would have to call GitHub itself and duplicate the caching and fallback logic. - Menu: the header menu would need a separate request, or a plugin, to read it.
- Banner: the page banner’s eyebrow and subheading are separate fields on the same response.
- Design choices: colour options such as “pale” for Cyan are design keys. Next would have to map them itself.
So I went back to the drawing board and built a custom WP REST Endpoint instead.
What I’d build A small custom route such as /wp-json/screencandy/v1/pages/{slug}. It would return one clean, stable shape for a whole page:
- Overall page data: like the title, the eyebrow and subheading, and SEO fields from my SC SEO plugin if needed.
- Content blocks: an ordered array, each with a
typeofbasic_content. For example, the ACF flexible content field called “plugin block” would include all its fields, the images resolved to URLs and sizes with alt text, and the GitHub version and zip link already attached (cached the same way). - Menu and footer data: For completeness, let’s set up another little custom endpoint for the menus at, for example:
/screencandy/v1/menus/primary.
This makes Next’s job easy.
So now we have an output at, for example: https://screencandy.co.uk/wp-json/screencandy/v1/pages/wordpress-plugins-download which looks a bit like this…

The blocks are all nicely parsed and easy to consume by my Next.js app.
Cost and trade-offs:
- The endpoint is maybe 100–150 lines of PHP in the theme (if I was doing this properly it might be better in a small plugin – the headless app might outlive this theme).
- It does mean every new block type needs a line in the endpoint, which is the price of a clean contract.
The front end
Now I have to go back to my app and start ingesting and displaying this content on the pages. This is the exciting bit as you see your app actually working!
Switching to Siteground
At this point I’m going to mention that I was able to switch to Siteground’s Node.js. This was, in one way, really easy but threw up a problem:
- I simply accessed their wizard, pointed it to my screencandy-vercel repo and… It didn’t work!
- After a bit of digging, I had to switch Turbopack to Webpack. Then the app built correctly and it was live on Siteground.
You can find the app hosted at: https://neils201.sg-host.com/
Page transitions are slick and fast.
As usual when starting on a JS app, we need to do some planning ahead: My homepage is going to need a lot of it’s own components that never really overlap with anything else on the site. I sometimes feel that this can be a bit wasteful; building lots of JS component files that don’t get reused, but I want my homepage to stand apart. However, my regular content pages should be easy enough to make into a set of reusable components. My site only really has two “pages” and there are not many ACF flexible content blocks on them yet so it shouldn’t take too long. Plus, there will probably be some overlap with the blog post content.
A lot of the markup can be imported into all my new js components, and I’ll be carrying over all my old classes because the new app will use Tailwind CSS – just like the existing site.
Talking about styling…
The new app also uses Tailwind CSS so I was able to transfer some of the styling over directly, but it wasn’t as easy as just copying it wholesale!
I was able to directly copy the header.css and home.css as these files contained a lot of CSS which could not be expressed as Tailwind utilities anyway. Everything else I was able to put inside globals.css.
Interactive things
- Homepage decision boxes and interaction is pretty simple – Both panels are always present in the HTML, with the inactive one being hidden. I want to make sure this is crawl-able, so this is my desired route.
- On the original site there is a small carousel on plugins page and plugins content block. The CSS can be easily copied over, and it’ll continue to use Tailwind utilities where it can, so then we just need a nice, simple JS component.
The contact form
So this is a bit of a tricky one, as I use Ninja forms plugin on my main site. For the PoC I would like to get something working, but I’m not too concerned about doing it right now as I think it will be a bit convoluted! Basically, I am thinking there would be another new endpoint for submitting the form. My Next.js app would then
So now it’s kind of ready… And when I look at the site now, it’s almost an exact replica of the PHP one. Here’s a pic of it:

Anything else?
I obvs don’t want this site crawled, so we had to add noindex tags and then ensure robots.txt ignored it, so added robots: { index: false, follow: false } to metadata in app/layout.js. That adds a <meta name="robots" content="noindex"> tag to every page. Also added app/robots.js that disallows everything.
I’m still mildly worried about Google finding it, so I may eventually password protect it at the dashboard side, but for now I’ll leave it.
Final thoughts
So this actually turned out to be a lot less painful than I thought it was going to be. Taking my existing site and being able to use so much work that was already done there meant I didn’t have to rebuild massive chunks of markup and CSS. I can see me using this in future if I had a good enough reason to build a separate front-end: It is lovely having a site that’s lightning fast but it’s total overkill for my simple website.
My only reservation is the cost – It’s no longer just about hosting; there’s now another service that’s going to start costing me to use as well. And I’d want to make very sure that I had payment caps in place so that my site doesn’t go viral or something and hammer me with a massive bill!
Edit: Moving this to my Siteground hosting has alleviated some of my fears mentioned above – if I get to any limit my site will just run a bit more slowly rather than hitting me with a bill.
Tagged