What I learned from Developing a MEAN Stack Project!
Tags: javascript, node, webdev, career
Published: 2022-08-19 14:38:44

I have been working on a MEAN stack project for the last 1 and half years. I choose this tech stack due to reason of unconfirmed requirements and also not being able to determine the structure of the database as well. This tech has provided us both facilities and also some problems as well. I am writing this from my side and all views and experiences are my own and it is quite possible that the views or others will be different as well.
In this article I will discuss both Pros and Cons of the MEAN Stack in the light of project I have built and I will also discuss at what stages it made me worried and at what stages it provided me ease.

![Positivity](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zk85s6xkmi551f4xuaxe.png)
## Pros
### Flexibility of MongoDB
As we know that MongoDB is a Document Based Database and it is flexible in terms of the structure or we can say properties. Flexibility means the ability to change the structure of the collection easily. Due to unconfirmed requirements the requirements increased or decreased rapidly so MongoDB provided us an excellent way of handling this abrupt change in requirements as After adding a new variable it did not break the previous data entries and worked fine with new entries as well.

### Excellent Support for Angular
Currently Angular 14 is available so due to fact that Angular is available in the Software Industry for a long time, it is very easy to find proper libraries and also the solution to any problem due to its vast community. This made the development process fast and easy. Every time when we as team faced any problem either it was related with UI or any other TypeScript we went out and we found solution very easily due to excellent support and huge community provided solutions.

![Being Positive](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/up3tfg8suobbns91v18n.jpg)

### Fast Back-End Running JavaScript
Due to fact that Node.JS use the Even Detection and it works Asynchronously and also with single thread, it was best choice for the project because we do not have tasks that were to be completed at a same time (Multi-Threading) so Node.JS proved to be an excellent Back-End framework that proved to be fast enough to process requests from server side very fast and effectively,

### Easy Work Flow
Writing Back-End APIs in the Node.JS is very easy and now here comes the role of the good programming practices and also the experience of developer as well. If the developer has some basic understanding of Design Patterns and how to write good and modular code than it becomes very easy to work with any scale of Back-End. Due to Express.JS it became very easy to work with the API End-Points and also with the Response as well.

![UX Design](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7s3mndnlg3ylj78map84.jpg)

### Well Handled Errors and Response
Node.JS being a JavaScript has provided the facility to manage the errors effectively and easily. We were able to customize the error messages so that the Front-End developers does not have to be worried about handling strange kind of errors coming from the Back-End. JavaScript provided the ability to interact directly with the Back-End as well. We felt very comfortable working with it as well.

Now these were the things that we enjoyed very much now let's see what were things that made us a bit angry sometimes.

## Cons
### Difficulty to Map Relationships in MongoDB
Our project did not contains to much relations but some relations. But in those some relations some were deeply nested and some were not that deeply nested. The one to two level deep relationships were easily managed but when it comes to handle more deeper relationships it became very difficult and writing Mongoose Queries were not that simple.

### Usage of Strict TypeScript
Due to fact that Angular uses that TypeScript as processing language sometimes it became very difficult to write strict and highly modular Angular code. That resulted the usage of the 'any' keyword that describe the arbitrary object type to the variables.

![Thinking](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lhc0ttdtyxhaxnq344ux.jpg)

### Processing Large Amount of Data
The one problem that remains even with Node.JS is that if we fetch large amount of data it still takes sometime to send response to Front-End as well. At first I thought that Node.JS will perform better in this case but it is not completely true.
When building highly data intensive applications Node.JS can prove to be a bad choice.

### Depreciation of Libraries
Node.JS and Angular both uses external libraries that relies on other libraries so it is a problem because some base libraries get removed so main library does not work, so it creates the problem of constantly updating the both Node and Angular libraries.

So, this was some problems that we faced while working with MEAN Stack framework. It was a fun project and we learned a lot of new things including how to gather requirements and how to analyze and work with requirements in a better and correct way.