I have Frontend and Backend

I have my frontend and backend in separate directories. Deploying the static frontend site on Netlify is straightforward. However, when deploying on Vercel, instead of using the backend URL specified in the frontend’s .env file under REACT_APP_API_URL, it defaults to the Vercel-hosted domain. How can I resolve this?

Directory structure (example):

backend/
├── models/example.model.js
├── routes/example.js
├── .env
└── server.js

frontend/
├── public/
├── src/
│ ├── components/
│ ├── .env
│ ├── App.js
│ ├── index.js
│ └── index.css
└── other files

Hey, do you have a minimal reproducible repo that we can take a look?

2 Likes

Is the public repo fine for this issue?

Fit-Track Repo Link

In my Fit-Track project, I’ve used ${backendURL} to reference the backend URL from REACT_APP_API_URL. This works perfectly on Netlify, but I’m encountering issues on Vercel due to its use of a custom domain.

Hi @swarnava,

I’ve resolved the issue, and it’s now working fine on Vercel as well. Thanks for your quick response! I’ll reach out if I encounter any further issues in the future.

1 Like

im facing the same issue can i get your help

Hi, @hanamaraddi!

It’d be helpful to give us an example, as @swarnava wrote above.