PHP and Frontity

From the documentation: " In theory a PHP server can send an empty HTML with the JavaScript files and the visitor will see the page after the JavaScript has loaded, but it is not a good user experience and certainly not recommended if your site needs to rank in Google."

As I understand, we use files that we get after building process. Then we can easily make an empty php file that will run js code and we will get our frontity page. However, we will not be able to change anything and react on the changes made in our Wordpress website.

Is it possible to replace node JS part of Frontity with PHP ?
If so, it should work differently than just an empty file of course…
But how? What exactly part should be changed?

Hi @alextrade432

What I understand from your question is that can we run frontity on Apache server instead of Node JS server?

If I am correct then the answer is No. We need a Node JS server to run frontity, because Frontity uses SSR, and need to compile on the server, and Frontity is built with React JS, and to run a React JS project we need a Node JS server.

Tis :bulb:
You can just simply host your frontity project using a sub-domain on vercel, and just embed it to the WordPress by the Embed plugin.

Thank you for your reply! It’s a bit confusing, I was sure that we can replace Node JS logic with PHP logic anyway, it will work differently, but it’s possible (with static js files). Isn’t it?

Normally it would be possible with React (or Vue or Angular) to not have a NodeJS server and still have a working (headless) JS application.

However Frontity is designed to use SSR (Server Side Rendering). Again possible with PHP, but not with Frontity due to how it’s built.

1 Like