Search code examples
node.jsreactjsmongodbsocketsmern

MERN stack and Socket to Mongodb - real time data to frontend from database


I am setting up a website with MERN stack. in the backend I will be constantly fetching data from api/socket and saving that to the Mongodb database. Now the frontend React I want to real-time show/update data with Socket.

I am a bit worried about the amount of request/connections the server side and Mongodb can handle. Its not clear how to setup a proper system to handle millions of users.

If someone can give me some info on what, how and/or where to search on how to setup a stable system.

Any info is welcome, thank you.


Solution

  • This is a suggestion for the MongoDB portion.

    You may want to try out their official course on MongoDB to understand how their transaction works. MongoBD University, for hands-on try their "MongoDB for JavaScript Developers" course.

    Here are some things to look out for:

    1. Connection Pooling
    2. Understand how transactions work
    3. Indexes, especially on how to create a good one like following the ESR
    4. MongoDB Clusters, Write into primary and read from secondary

    I will update the list if I have time and remember some of the stuff.