React app to consume django api

I deployed a django backend with fly, and it works as intended. I would like now to deploy a react app on fly, that will use this API. Is it something that can be done?

Generally, is geared toward full stack apps, so something like Next.js or Remix that uses a react client would be a good use case for the platform. In your case, a static hosting platform like Netlify would be best for hosting the React client. You’d need to make sure the react app on Netlify is pointed to the right IPv4/IPv6 address so it can make the proper API calls to your Django app on Fly. To do this:

  1. Run fly ips allocate-v4 --shared to allocate an IPv4 address for your django app hosted on fly.
  2. Set up a DNS only (no proxy) A name record pointing to the IP address generated from the first step

Hope that helps!

This could also be Django, Rails, Laravel, or Phoenix that uses a react client.

The way this works is that your React app has a build steps that produces bundled javascript (typically through webpack, rollup, esbuild or another tool), and can serve this javascript through the use of [[static]] in fly.toml or though your server (in this case Django).

1 Like

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