How to Deploy React frontend container with backend server container in App Platform correctly

For reference my github repository containing the frontend and server code is available at

I have a frontend container and another container that starts my server.js. The server is an Express application that listens for POST requests on the api/send-email endpoint and sends it as an email using Nodemailer. It seems that my server is started successfully according to build logs on digital ocean. When I attempt to send a POST request I get a 404 error ‘Failed to load resources’. I set my HTTP request route in the server container to /api/send-email, and set the HTTP port in the server container to 5000 as it is in my code. I just am not sure what the issue as I have tried various configurations on digital ocean and changes to my code. I have a feeling the solution is very simple and I just have lack in experience with deploying on digital ocean/configuring servers, or this is just not possible using App Platform. If I can provide any other information to help let me know.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 15, 2024
Accepted Answer

Hi there,

What you would usually do is to deploy two separate components to your App Platform:

That way your static site will be accessible directly via your domain and it will be making all of the requests to the /api route which will be handled by your backend service.

Here is a quick video that shows how to deploy an API backend and a React Frontend:

In the video the backend is Laravel but in theory the setup should be the same for any other framework.

If you are still seeing the 404 errors, I could suggest checking the backend service logs to see if you see any problems there. And also trying to manually make the requests using curl or Postman for example to the /api endpoint.

Let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel