MERN Project deployment Issue

I have the client side and server side self contained in same folders .
My issue is that client side is not rendering in the browser but my backend code is deployed successfully . I have tested my backend api from postman and they are working perfectly .

Please let me know what changes should i make in package.json and in setting of render to run my client side as well.

My code structure

Project1(root)/
├── client/
│   ├── src
│   ├── public
│   ├── node_modules
│   ├── .gitignore
│   ├── package-lock.json
│   └── package.json
├── config
├── models
├── routes
├── controllers
├── .env
├── .gitignore
├── package-lock.json
├── package.json
└── server.js

What i have written in script of package.json

"scripts": {
    "start": "node server.js",
    "render-postbuild": "npm install && npm install --prefix client && npm run build --prefix client"
  },

And in render setting in build command I have written
npm run build

Hi there,

Thanks for reaching out.

We’re not able to support your code, as every app is different, and can be implemented in lots of different ways.

A common pattern for this type of setup (a monorepo) would be to have two services, a Static Site for the client and a Web Service for the backend/API. I cover this in another recent community post: https://community.render.com/t/how-to-deploy-frontend-and-backend-on-render/7449/3

It’s also possible to have a single Web Service to serve the “client” pages and serve-side, it depends on how your project/code is set up.

If you have a specific issue, please share some specific details that may help us troubleshoot it with you, e.g. any logs/errors/output, specific URLs, service name/ID, reproduction steps, etc. If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Contact Support” link at the bottom of the Dashboard.

Kind regards

Alan

Just a heads up that I am having this problem. There is a popular tutorial on google for MERN stack Render Deployment that I (and I assume OP) is using that is causing this issue.

Bascially backend is running on root. And front end CRA is running in a folder called Client.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.