/    Sign up×
Community /Pin to ProfileBookmark

Moving from Laravel/PHP to NodeJS

Hello!

I just signed up here, as this is a little more opinionated as to post it on StackOverflor or any Stack-ish Q/A board. So yeah, hopefully I am right here now!

For years, I have developed ontop of PHP, leveraging Yii, then later Laravel (and therefore Symfony) but my requirements for back-end resources have totally changed for a project…and before I start coding a bridge between PHP and NodeJS, I’d rather just switch over entirely. ? I mean, it wouldn’t be impossible but… tedious.

So what exactly am I requiring? Well… I am not exactly a fan of streaming megabytes of JavaScript to my clients – be it templates, polyfills or the like. I want to render server-side, and do only arbitrary stuff (like, generating dialogs as modals, and such) on the client side. Therefore I have more room for what really matters, like the real-time engine for the chat or notifications through WebSockets or some neat image pre-/postloading routines. But where exactly do I find me a base framework that would allow me to render “as server-side as possible”? I prefer to not reinvent the wheel and reuse existing code – saves some time and speeds things up.

I have grown quite comfortable to the MVC concept (well, MVCC to be exact) so I would like to stick to it. I can do that by using Express and some structured placement of code – this should be relatively easy. But views? Models? I am a bit lost on how I would realise that…after all, the templating engines I have seen so far are quite bold on their features that they support – which makes me worry about their speed, as I am expecting to render mostly on the server – and, it’d be handy to use the same engine on the client too. I thought about using EJS (Embedded JavaScript) but I haven’t really seen other alternatives that come close to this. So, I might have to stick with that…

Another aspect is, that I want to utilize Bootstrap as a CSS framework, and utilize the Bootstrap.Native tools provided here: https://github.com/thednp/bootstrap.native
This already strips off jQuery – so what I really then need is just a tiny set of polyfills to do promises, AJAX and even better, PJAX. I would like to leverage PJAX and the History API in order to minimize the loading times as much as possible.

Now that I have gone on and on about what I would like to achieve… I think it’s best if I sum up all my questions and the things that I am looking for up into a short little list. Sorry if this post turns out to be waaaay too long. ?

I want to…
– Render as much as possible on the server, only sending small templates for modals and the like to the client for minimal inline rendering. Which rendering engine do I best use, that is fast and small? It does not need to have bold features – I am fine with simple stuff like scoping and variable substitution (think of a minimal bare-PHP templating).
– Utilize as few JavaScript as possible (size vs. bulk). So no jQuery – instead, I wish for just a few essential tools for managing the History API, PJAX and regular AJAX. Having these feature file uploading would be neat, but it is currently not a top-level priority. I may be able to cut size by using WebPack’s tree-shaking, but I’d just like to be double-sure about the size of the stuf that I deliver.

I am quite likely to add other stuff to the client – like a proper Markdown editor for bigger inputs and such – but keeping the base as small as possible is my goal. I am not striving for i18n/l10n any time soon either. Though, I will be using RDFa and Microdata. But as they are pretty much part of the HTML elements, I would just put them into my views, I guess… Or, obtain them off a model for convenience.

Hopefully I did reach the right place here! Thanks in advance.

Sincerely, Ingwie Phoenix.

to post a comment

0Be the first to comment 😎

×

Success!

Help @IngwiePhoenix spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...