Closed IyanRobles closed 9 months ago
In this file, it will be discussed about what database will be the appropiate one for the project we are developing (we could also use more than one for each microservice, that is also a possibility)
First of all, I will present the debate between using a Relational Database (SQL) or a Non-relational Database like MongoDB. Then I will present also other alternatives and finally I will conclude with what I consider the good choice for the project from my point of view.
When using a Relational Database, we could choose between:
In fact, there are a lot of alternatives for Relational DBs, and the differences between them are small, so any of them is valid.
ORMs facilitate working with databases from code. The alternatives are:
Inside the world of non-relational databases, there are a lot of different data models, so I chose only to research DBs based on a document data model, but there are also other types. The most typical and popular Document Database is MongoDB and it is the one I will write about in this section.
The purpose of ODMs is the same as ORMs. The alternatives are:
In addition to traditional databases and ORMs, there are also serverless backend services that offer database functionality together with other features such as authentication, file storage, and real-time data synchronization (already made). Two popular options are Supabase and Firebase:
Supabase: Supabase is an open-source platform with tools for building scalable and secure applications. It offers a real-time PostgreSQL database, authentication, file storage, and more, all accessible via APIs.
Firebase: Firebase is a comprehensive platform by Google that offers a wide range of backend services for mobile and web applications. It includes a real-time NoSQL database (similar to MongoDB), authentication, cloud functions, hosting, and more.
Both Supabase and Firebase offer serverless backend solutions that are very similar. They are very good for rapid prototyping and iteration.
When discussing about relational databases and non-relational ones, I have included in some parts my opinion, however here I will conclude it. Between using a Relational or Non-relational for a small application like this there is not much difference and it's very difficult that a bad decision when choosing could lead to a fail of the project. Also, the language used for the backend can influence on the decision of which database to use, so the language used for the backend is something to take into account.
JavaScript: In case of using JavaScript (Node.js), I think that MongoDB would be a good choice. It is commonly used with an ODM like Mongoose, so there is a lot of examples on the Internet and it also conforms the MERN stack (MongoDB, Express, React and Node.js) which is a quite popular stack.
Java: Java has a lot of ORMs that have good compatibilities with Relational Databases, however in the recent years MongoDB has increased in popularity and many technologies have been developed in order to be used with Java.
Others: I have not researched in relation with other languages, but both databases have good support no matter the language.
To conclude, I consider MongoDB a good choice. While it has some disadvantages like the lack of ACID transactions, I don't consider them a problem for the application we are developing. MongoDB can be used with almost every language would offer us flexibility (something difficult in relational ones) in the schema, JSON support (easy to work with), an easy query language, also a simple learning curve and an opportunity to learn something new that can be very valuable for our future.
Look for possible technologies for the database (Carlos)