Headless WordPress

Headless WordPress with Nextjs

A couple of days ago, I tried using Nextjs to re-design a frontend for my blog. I have to say I am quite satisfied with the results.
Nextjs fetches data from WordPress and stores it statically so the load speed is amazingly fast. I could also re-fetch data on a Node server with the “revalidate” option. This is a great way to update the front end when a new post is published and can work very efficiently.

As for now, The downside of using this approach is that I lost WordPress commenting system and I need to find a way to add commenting functionality to my blog. Most websites are publishing posts for SEO purposes so they don’t use comments but others may want to engage more with the reader and allow them to post comments.
To solve the issue of comments, I created a usr authentication system with Nextauth, the I used prisma to store comments in a sqlite database. This is a simple yet powerful way to offer commenting feature without relying on wordpress commenting system. However the user must login as an admin to a separate backend and approve comments. One might think if there is another backend why use wordpress. This is a good question as well.

You can check the front end at this URL: https://app.behnoud.net

I will update this post with more details in the future.

Leave a Reply

Your email address will not be published.