Pizzuno

Pizzuno

5 Followers
Pizzuno is a game like UNO that can be played with friends online for free.

Decisions 4

Ricardo Fiorani

Founder at Pizzuno

Shared a protip
on
pm2pm2Node.jsNode.js
at

If you, like me, have more of a PHP background and are trying NodeJS. Know that any small error will kill your app and thus your "server" since NodeJS relies on an infinity loop to run itself as a server. There are workarounds to solve this, but none solves it beautifully as PM2. PM2 will ensure that your NodeJS app is running and restart it automatically for you. It has a huge community and therefore documentation. Its features are really impressive.

10 11.3K

Ricardo Fiorani

Founder at Pizzuno

Now I come to a funny position where I used PHP for the template building on Pizzuno's frontend, but for the backend, I don't use PHP but NodeJS instead.

There is not only one reason why I opted for NodeJS over PHP but many.

I needed operations to run in a non-blocking way (async)

I know is possible in PHP but I didn't have time to struggle with the preparation of the environment on PHP to make it possible. On NodeJS this is out-of-the-box and really easy to use.

I can share components and classes between the frontend and the backend

Since both, runs on the same language, Javascript. This makes the socket communication way easier and the roll-out of new features and maintenance easier.

Performance in a low-cost server!

Since PHP relies on an Nginx or Apache to run under an HTTP/HTTPS server, I would ideally use some sort of a Kubernetes or Docker-compose solution to orchestrate PHP-FPM + Nginx (or Apache). This would add a lot of overhead to my 512MB server. NodeJS can serve requests on a production scale straight away by itself, so I wouldn't need Docker or any other orchestration other than PM2 (also kudos for PM2, it's heavenly!).

Small note here: I'm completely aware that I can install PHP and Nginx on my Linux instance, but still I lose the portability, as I have plans to migrate to another cloud.

6 12.7K

Ricardo Fiorani

Founder at Pizzuno

You might find it odd that there is PHP in here, however, for the frontend's templating and building of Pizzuno, it was actually way easier with PHP since it is so powerful out-of-the-box (this project's PHP runs without any dependency like composer), so there is no build/preparation for the building environment, it uses plain PHP to lightning-fast create the template files.

5 8.1K

Ricardo Fiorani

Founder at Pizzuno

Migrated
from
JSONJSON
to
LocalazyLocalazy
at

I wanted to keep it REALLY simple when it comes to the internationalization of my application, however, handling translations on JSON files turned out to be a big pain. That's why I started searching for translation management tools. Upon analyzing many tools out there, I found Localazy the easiest, the simplest, and fastest tool. Since I want my game to be built close to what my users expect, Localazy stood out with it's "crowd-sourced" way of translation management. Today I completely recommend Localazy to all my friends and their projects.

3 5.4K

Followers 5