Friday 9 March 2018

Is NodeJS/Express/Angular the right fit for a community website? Frustrated.

This post may be a bit long/ranty, but I'm feeling (perhaps more than) a little frustrated with my research into NodeJS/frameworks. Maybe this isn't the right place to ask, but I need some input from those more familiar with NodeJS and all the related frameworks to help steer me in the right direction.I did web development for around 10 years (PHP/MySQL/HTML/CSS/JS), until a couple of years ago when I abandoned it to pursue my real passion (game development).Recently tasked with developing a new website for an online community I am part of, I thing it would be a good opportunity to learn newer technologies for web development (especially as PHP drives me nuts now). I've been going back and forth between Ruby on Rails and NodeJS, but I think NodeJS may be a better bet as I'm way more familiar with JS than Ruby.I'll explain the project first. For general visitors (and search engines) it will be a collection of static pages like any typical website. Where it gets involved, is for members - OAuth login, webhook integration with a third party service, multiple member tiers, data exports to various formats, etc. Basically, automation and tools for managing and interacting with the community.My initial thought process after doing some research was to design it as an ExpressJS API backend, with an AngularJS frontend. This made a lot of sense to me, initially. I've managed to find well-documented libraries for handling various aspects, such as Passport for OAuth and a JWT library for detecting user authentication between frontend/backend. However, as I delve deeper, I'm getting frustrated with what seem like the basics.For example, while the Express documentation is really good at explaining the API, I've yet to find a good explanation on how to structure an Express project. Most tutorials just put everything in app.js (we're really still doing this in 2018?) and few have spread things across "component" files but offer no explanation beyond "put this code in x.js". Is there no standard structure? Is MVC just loosely implied in NodeJS frameworks rather than strictly forced like in Rails?Another example is with the Angular frontend/Express backend approach, that SEO will be an issue for all of the static pages. I came across Angular Universal, which should be the solution but also puts so many architectural questions in my head. It's not really needed for the places where Angular would be used (logged in users), yet if I stick to the API based approach it seems like a really big weird caveat-filled workaround for static pages that Express could just render itself. Likewise, if I wanted to have these pages dynamically load by AJAX as well as still function statically, this wouldn't be suitable either. Is there not a better approach?The more I dig the more unsure I get. Almost every tutorial and guide I find is about using NodeJS/Express/Angular to make an SPA (are todo lists the new hello world?), whereas I think what I really want is an "MPA".Overall I think I'm misunderstanding something or falling into the classic "using a hammer to put in a screw" trap. Am I looking at the right toolset here? Are there frameworks other than Angular/Express that would be a better fit? Or are they the right tools but I'm just using them wrong? Should I look at a different architecture entirely?TL;DR - Is a NodeJS/Express/Angular stack the best fit for a community website with a mix of static and dynamic content?

Submitted March 09, 2018 at 12:48PM by Fourjays27

No comments:

Post a Comment