Deploying React Project with JSON-Server API

I’m working on a React project that uses json-server as its API to serve JSON data. Locally, everything is working smoothly, but I’m now looking to deploy my project to a hosting platform.

I was wondering if anyone could provide guidance or share their experiences with deploying a React project along with a json-server API on a hosting platform like Vercel, Netlify, or others.

Specifically, I’d like to know:

  • Which hosting platform you recommend for this setup?
  • Any special configurations needed to deploy the React frontend?
  • How to handle deploying the json-server API alongside the frontend?

why not use “expressjs” instead and host it someplace and then make your “fronentend” code call those “endpoints”

1 Like

Yeah, I know that is a way to do it. But I haven’t started backend yet, will do after completing this frontend course.
I was just finding a simple way to do it for the time being.

Heroku might be a good option for deploying the backend, I see there’s a post about deploying json-server to heroku here: How to Deploy JSON-Server to Heroku (3 Easy Steps) - DEV Community

What are you using the mock api for? if just mocking GET requests hosting the JSON files would also be an option and fairly straightforward since you could host the files with the react app.

I’m currently learning ReactJS, the current project which I am working on is using a JSON file to Read/Write data. I tried some JSON hosting services, but most of them were not helpful to me.
Heroku is also an option, but unfortunately it doesn’t work in India. I tried for Vercel and Netlify but couldn’t get hold of anything.

For now I’m using this website to host my JSON file
https://my-json-server.typicode.com/

I hope this would be helpful.