Backend server - pinocchio61/Architecture GitHub Wiki
Backend server investigation
Author
Brian Wan (bwan2)
Context
A decision on which technology to use for our Pinocchio backend. The goal of this backend is to host the website (for visitors) and other functionalities (such as uploading a file hash). The front-end client has already been established to be React.js (UI library used to build UI components).
Investigation
Looked at the following technologies:
- Django/Flask
- Node.js
These technologies were considered due to our team experience in using these backend technologies. Our team has experience in both Python and JavaScript. As a result, using Django/Flask or JavaScript would speed development time due to familiarity. Ruby or PHP based technologies were not considered due to unfamiliarity and higher learning curves, which is not necessary since the backend server's main focus is to host a website (where any technology would be suitable to do so).
Django/Flask
Django's main pro is that it is already set up with authentication, account administration, and other features out of the box. However, this also comes at a price because Django requires developers to know the entire system in order to work on it. Django is also very monolithic, which may not be suitable for all the different calls we want to support in our system.
Flask's main pro is that it is extremely lightweight and is flexible enough to add any features as you need, rather than Django with everything built in. However, since Flask is very barebones, every module or web component would need to be considered in design/development.
Node.js
The main pro with using Node.js is that since we are using React.js for the client-side, then only one programming language would need to be known to maintain each side. In addition, if we anticipate more users in the system (potentially everyone in the audience attending events in the United States), Node.js is highly scalable (horizontally).
For websites, Node.js provides server-side rendering. This leads a lighter-weight client to not have to render javascript.
The main con with Node.js is that API keeps changing for developers and to make applications more scalable, knowledge in asynchronous calls is required to be more efficient. However, API changes are subject to any backend technology choice and asynchronous calls are the backbone in understanding JavaScript.
Decision
Most discussions on what backend technology to use with React.js is based on developer experience. However, since our team is familiar with a wide range of programming languages and backend technologies, we have a lot of options. We decided to use Node.js as our backend for the primary reasons:
- easier to maintain client and server codebases since they are both in JavaScript
- server-side rendering may reduce the client-side to render fetched pages
- is known to be highly performant/scalable and easy to use We anticipate there being a lot of users visiting the Pinocchio website. Also, these requests are likely to be stateless, so asynchronous calls are widely used in Node.js. Django/Flask would require more development time since each Pinocchio member would have to switch between Python and JavaScript in development. In addition, Django has a higher learning curve and can be too clunky to use (due to overloading with features).
Status
5/31 - Proposed by Brian
Consequences
References
- https://www.educba.com/django-vs-node-js/
- https://hackernoon.com/advantages-and-disadvantages-of-django-499b1e20a2c5
- https://www.mindinventory.com/blog/pros-and-cons-of-node-js-web-app-development/
- https://medium.com/@shahroznawaz/best-backend-frameworks-to-build-your-next-web-application-2f89f08f34e3