Hey everyone! I’m working on a new project and I’m not sure how to handle the deployment. My setup is a React/Express frontend with a Loopback backend API. They’re on different ports in my dev environment, but I’m stumped about the best way to put this in production.
I’ve been thinking about two options:
-
Put everything on one server, but give the backend its own subdomain. Is this a good idea?
-
Use two separate servers for frontend and backend. But then how do I keep them under the same domain?
Has anyone dealt with this before? What worked for you? I’d love to hear about your experiences or any tips you might have. Thanks in advance for your help!
hmmm, interesting question! have you considered using a reverse proxy like nginx? it can route requests to different servers based on url paths. that way, you could keep everything under one domain. what kinda scalability do you need? cloud platforms like AWS or Heroku might be worth looking into too. thoughts?
For a decoupled frontend and backend setup, I’ve found that containerization with Docker and orchestration with Kubernetes works exceptionally well. This approach allows you to package each component separately, making deployment and scaling much more manageable. You can then use an ingress controller to route traffic to the appropriate service, keeping everything under a single domain. This method also provides flexibility for future growth and easier maintenance. If you’re not ready for Kubernetes, a simpler alternative is to use a PaaS like Heroku, which can host both your frontend and backend services while providing easy deployment and management tools.
yo, i’ve been there! containerization’s pretty sweet for this. Docker + Kubernetes can handle both front & back. keeps things clean & scalable. but if that’s overkill, maybe try a platform like Netlify for the frontend and Heroku for the API? they play nice together & it’s way simpler to setup. just my 2 cents!