Using NodeJS locally and on shared hosting

How does this affect the development in PHP? I mean is it possible to develop in PHP running PHP server locally within Wappler, without installing Wamp, Xamp etc,?

The post is about NodeJS.
It does not affect PHP in any way. You still need xamp/wamp for PHP.

Also, this post is not showcasing anything new. NodeJS has worked locallly withing Wappler since day 1. I think its just good to have something like this documented… as in many instances, I have seen devs getting confused between NodeJS & Docker.

1 Like

Thank you sid for your answer, please correct me if I’m wrong: If I want to develop in NodeJS I don’t need to install some local server since it is "self running in Wappler) but if I develop in PHP I must install a local server like Xamp even if I use Docker? Sorry for my basic question but all this stuff (NodeJS, Docker is new to me) and I try to better understand before I start building a small cms using PHP and publish to standard shared hosting. From what I understand it is actually simpler using NodeJS to develop and test locally than it is in PHP? Just trying to make things clear in my head :slight_smile:

No. Docker takes care of that for you.
You need a PHP server to process PHP files. Similarly, you need a NodeJS server (with ExpressJS) to process EJS files.
With NodeJS, Wappler can run this server internally, without any need to install & run the server locally or via Docker.
With PHP, Wappler does NOT have a PHP server running internally. So, you need to either install & run PHP server locally on your system (xamp/wamp) or use Docker.

Think of docker like a separate OS running inside your local OS (Windows, Mac or Linux etc).
When using PHP with Docker, what it does is it installs PHP on that docker machine & then runs your app from that server.
Similarly, if you decide to use Node with Docker, it installs NodeJS server on that docker machine & serves your app.

This is my very basic understanding of Docker and helps me work with it so far.

When you talk about standard shared hosting, think of it like a docker machine which already has PHP installed. Its not that simple, but just to give you a comparision.

Yes. Only because it does not require any additional server side setup to make it live.

I have not found any major benefit of using NodeJS over PHP to be honest. But we have stopped using PHP for newer projects.
I do see some benefits with using Docker (with NodeJS or PHP) - as it makes deployment a bit more controlled and there are almost zero surprises when app is deployed from local to production. Docker requires VPS, it won’t work on Shared Hosting though.

2 Likes

To add to @sid’s excellent reply. Node will run on a shared host. The only caveat is that Node must be active on the remote.

My Plesk Panel shows this as:

Ask your host to install Node if it is not enabled in your host panel.

The advantage of Node is not dissimilar to Docker in that the complete environment is encapsulated within its own module, especially when using SQLite as the database,

There are some drawbacks when using SQLite for data intensive sites with hundreds of users. If that is the case, then you can always revert to using MySQL or similar.

1 Like

Thanks for that Ben.
I have deployed Node on shared server via cPanel, and the experience is not great to be honest. Which is probably why it skipped my mind.

I could not even run my HTML to PDF extenstion for Node because my shared server hosting provider has some limitations. :sweat_smile:

What went wrong?

Mostly this. And apart from that, the resources were very limited. Running 3 apps caused CPU & Storage to hit server limits.

2 Likes

Thank you very much Sid for all the clarification I really do appreciate!

I realize that my need are simple compare to what dev build with Wappler, and I find NodeJS to be an overkill and a bit too complex for me and my needs,

This might change in the future but for now my goal is to set the simplest/easiest possible development environment knowing that I will build mostly basic cms (CRUD) and publish via ftp on a shared hosting. So then in my case would you recommend using Docker or a php server on my local machine?

NOTE: My hosting does support NodeJS but not sure how to deal deal with that when tings turn bad as I see many technical issues from what I dead from many dev.

You say: “I have not found any major benefit of using NodeJS over PHP…” …But we have stopped using PHP for newer projects…" I am a bit surprised because many dev who switch from php to NodeJS say that it is a huge improvement… May I ask you what type of projects you build? Are they complex or advanced stuff?

Hi Ben and thank you for your reply! I did verify and I do see the NodeJS feature is there in Cpanel.
Can you share what was your experience with that? How things went when you activated NodeJS? Was it straightforward or did you run into technical issues?

I don’t plan building data intensive sites or having hundreds of users, my projects will be basic, at least for now.

Local PHP server. Since you shy away from NodeJS due to technical issues, Docker has bigger problems than that. If it works, it works. But if you get stuck, its a nightmare to figure out.

We do some very complex stuff with 3rd party library integrations and a lot of other quirks. But Wappler has us spoiled in a manner that it takes away a lot of the complexities of server model.
Be it asp, node or php, server actions and client side app connect etc all work the same. Which is why I say I don’t see any huge improvements.

We have built fairly complex projects in all three server models in Wappler now. And all work great and clients are happy as well.
For now NodeJS is our priority. We have moved to Caprover based droplets for our dev servers. And clients have their own production setup.

Again, this is all my personal experience. I don’t have much DevOps knowledge. Its just what I’ve learned by tinkering… There are many more complications around servers and networks which I have no idea about yet.

Thank you for sharing your experience Sid, I have to say I am impressed!
So PHP server it will be.

Caprover? So you have more control and lower your cost I guess?

Exactly what I think is the most important, that it work fine and clients are happy with it (whatever technology you use).

Thank you again and I wish you the best :slight_smile:

1 Like

Jacques, Hi!

Just wanna add, that NodeJS has more possibilities in Wappler, than PHP. Most of them covered here in docs. https://docs.wappler.io/t/about-the-nodejs-category/22088 Maybe it would not be useful for your project, but who knows.

Only drowback is that not all shared hosting supports NodeJS. Seems like you don’t have that problem.
And that’s a problem only if you make project for client and they already have hosting, that don’t support NodeJS, and don’t wanna change it. In other cases your just switch to another more convenient hosting.

So, my humble suggestion, that it is better to start with NodeJS, if you can.

2 Likes

I have had no problems using Node. The server setup is self-explanatory, it is a matter of installing NodeJS for the project. This must be done for each project separately. At times, while making changes to the project, I have had to refresh the remote Node server. But this has improved in more recent versions of Wappler. Wappler has a built in module that restarts the remote when uploading files. I started with leaving the Apache and Nginx servers in place. This was a bad idea, so now my sites are pure NodeJS

I find that NodeJS/Express has so much more to offer than PHP. Templating was the first reason why I wanted to explore Node.

As I previously stated, NodeJS is in fact rolled into an environment of its own, sort of like a Docker container without the container, if that makes sense. Like Docker, the developer (in our case Wappler) decides the server specs. In a real world these specs can differ for each project. The only dependency is the NodeJS version which could be different, remote vs local.

I hope this helps.

2 Likes

One thing I did not realize is SEO support.
Setting up meta tags is a challenge with PHP and ASP Single Page Applications with Wappler.
But with NodeJS’s server side data, this is a simple setup. So that would be one major advantage to go with Node.
But if you PHP app is not SPA or does not require SEO stuff, you can continue with PHP.

You too. :blush:

1 Like

Hi Ben for sharing your experience with NodeJS indeed this is helpful to me.

I must admit that templating is very interesting and might be the reason I decide to give NodeJS a try, maybe not for the my actual basic project I but I will definitely explore the possibilities.

Thank you again!

Thank you nickneustroev for your input I appreciate!

Fortunately I host must of my clients so It would bot too much of a problem.
I will definitely take a look at that documentation you refer to.