I have built an e-commerce application using MERN Stack. I've kept two different dedicated servers for APIs and ReactJS. Should I instead be having a single server to manage the APIs as well as ReactJS?
Sure, you should. The simplest way is run them in the separate docker containers. So you can build the whole system just with docker-compose.
Your ReactJS app is static, you could host it from nginx and get the maximum benefit of http2 and caching. You can host node.js api on the same server in a separate docker container for instance, make nginx open to the world hosting ReactJS and proxying requests to node.js api.
Atul Sharma
Full Stack Developer | Cloud Native Applications
If your application is not just that big and you are just starting up. Its good to keep them on single server. Its will reduce overhead of managing two separate applications, and deploying separate applications.
If server side rendering is required for React js and you are expecting a heavy load on servers (High Number of Visitors) keep them on different servers. Rendering templates on server consumes enough of processing power.
If you are seasoned programmer and loves clean and clear architecture then using two docker containers is no doubt a good idea.