MEAN Stack vs. MANN stack

Jorge Guerra Pires, PhD
Geek Culture
Published in
5 min readJan 4, 2022

--

“we believe deep learning and JavaScript belong together.” Deep learning and JavaScript

”the speed of model training in tfjs-node [a Node.js optimized to TensorFlow.js] is on par with the speed of Keras in Python.” Deep learning and JavaScript [today we are all about learning machine and web application], see my article on JavaScript and learning machine.

Photo by Alexander Sinn on Unsplash

I have started web coding using MEAN Stack (MongoDB, Express, Angular, and Node.js, respectively). The main selling point was: one single programming language (i.e., JavaScript) and file exchange format (i.e., JSON) for the entire stack. Indeed it is true.

Pires, 2021.

“Nest.js has a unique symbiotic relationship with Angular because they are both written in TypeScript.” Jay Bell, Greg Magolan, David Guijarro, Adrien de Peretti, Patrick Housley

Nonetheless, since the beginning I have noticed this selling point did not tell the whole story: JavaScript is replaced by TypeScript at the frontend! Even though it is better than having to shift from say Python to JavaScript, it can still be painful; if you are starting, having to keep track of two “different” languages can be overwhelming. However, recently, about 2017, a new framework was released, namely, NestJS; it is different from Express mainly for not being a library, like Angular, it is a framework.

The main selling point was: one single programming language (i.e., JavaScript) and file exchange format (i.e., JSON) for the entire stack. Indeed it is true. Nonetheless, since the beginning I have noted this selling point did not tell the whole story: JavaScript is replaced by TypeScript at the frontend!

NestJS is a server-creator framework created on top of Express, that resembles Angular. Thus, it creates a better synergy between the technologies in the MEAN stack, creating what one could call MANN stack!

Here goes some possible gains from this addition:

  • Like Angular, Nest incorporated the concept of tests;
  • Like Angular, it has its own CLI;
  • It is what some calls progressive framework, it means that, according to definitions on the internet: once can start small and grow gradually!
  • It is written in Typescript, thus, just one language for the entire stack;

I have not yet incorparted this framework on my stack, but I have great expectations. The main reason, at least for me, it is being similar to Angular. Sometimes, as I was coding in Nest, I had difficulties to tell my brain that I was in the backend.

TensorFlow.js: a case study

“If your backend is already written in Node.js, and you would like to add machine learning to your stack, using tfjs-node is usually a better choice than using Python. By keeping code in a single language, you can directly reuse large portions of your code base, including those bits for loading and formatting the data.” Deep learning and JavaScript

Some time ago, I have decided to venture on deep learning Using JavaScript, mainly because of TensorFlow.js, which I have found by accident. I have coded on Angular using TensorFlow.js, however, some limitations may come up:

  • Browsers have limitations on their computing power;
  • It may not be a good idea to overload the user’s computer;

One solution, which is part of TensorFlow.js is tsjs-node. I have not yet tested, but results in Angular, which is quite similar to Nest, showed promising results. I was able to adapt codes already in JavaScript to TypeScript, with some problems, but nothing impossible to handle.

Thus, here goes another reason for using Nest: if you have a library in JavaScript, chances are you can use it Nest.

Pires, 2021.

What about the remaining components of the MEAN stack?

Angular, as we have seen, is close to Nest, which is something quite nice. Now, MongoDB becomes even easier! They incorporated Mongoose, it is even easier to connect! Express is the base for NestJS!

Thus, it seems to me we have all the ingredients for the transition!

Posting on Facebook group of NestJS
Posting on Facebook group of JavaScript

References

  • Pires, JG. MEAN + TensorFlow.js: a single language, a single data exchange format for machine learning based web applications! In My selected assays from Medium on Computer Programming: Angular, JavaScript, Machine Learning, TensorFlow.js and more! Vol 1. Self-published: Ouro Preto, 2021. On Amazon
  • Jay Bell et al. Nest.js: A Progressive Node.js Framework. On Amazon

What is next?

  • Angular vs. NestJS: do we need backend with Angular around?

You may be interested

Angular, Unit Testing, Figma, and Numerical Analysis: Building a dashboard for our app using Angular Material
https://www.udemy.com/course/angular-unit-testing-figma-and-numerical-analysis/?referralCode=CEC8C36E50F431E197CE
Coupon(free access): FREEDECEMBER21
#javascript #typescript #angular #udemycoupons #testdrivendevelopment #testing #technology

Mongoose, Test Driven Test-driven development, NestJS, Jest: Aprenda sobre o funcionamento do Mongoose focando em testes
https://www.udemy.com/course/mongoose-test-driven-design-nestjs-jest/?referralCode=4A71374615821D1820BE
#mongodb #mongoose #testdrivendevelopment #nestjs #unittesting #udemycourse #udemycoupon

===========

Support my writing by buying our ebook!
https://jorgeguerrapires.medium.com/my-selected-assays-from-medium-on-computer-programming-34578bebb63a

My selected assays from Medium on Computer programming: Angular, JavaScript, Machine Learning, TensorFlow.js and more!
https://www.amazon.com.br/dp/B09PGT697D/ref=sr_1_1?qid=1640915011&refinements=p_27%3AJorge+Guerra+Pires&s=digital-text&sr=1-1&text=Jorge+Guerra+Pires

===
Donations

Buy me a coffee ☕☕☕☕☕ or a book!! 📚📚📚📚📚
If any of this content was useful to you! it is an one time donation, no need to donate again!
https://www.buymeacoffee.com/jorgepires

Now you can also support any of my projects! 🥰🥰
More info: https://jorgeguerrabrazil.wixsite.com/ideacodinglab/publications

Visit my courses: https://www.udemy.com/user/jorge-guerra-pires/

--

--

Jorge Guerra Pires, PhD
Geek Culture

Independent Researcher and writer at Amazon | “I want thinkers, not followers!” | More: https://linktr.ee/jorgeguerrapiresphd