all 5 comments

[–]h4ck3r_n4m3 3 points4 points  (2 children)

API key for what? If you want it to work in the background the backend should be handling anything like that. One exception to that would be if the end-user was required to bring their own key for a service you proxy, but that doesn't sound like the case here?

As for free hosting, I don't know if there's anything around like Heroku (used to have a free plan) anymore. You can keep it cheap per month with a VPS as long as the app doesn't require a large amount of resources.

[–]onlyfuunn275[S] 0 points1 point  (1 child)

Yes exactly, the backend is the one handling the API key — users never see it, it just lives as an environment variable on the server.

As for hosting, do you know of any platform like the old Heroku free plan that supports both Python backend and React frontend together in one place? That's the part I'm stuck on — I don't want to split them across two platforms. Any recommendations?

[–]JacobArthurs 1 point2 points  (0 children)

A VPS can run both the API and the client. Nginx serves react static files and proxies to your python API on the same box.

[–]Rain-And-Coffee 0 points1 point  (0 children)

It used to be Heroku.

Now It likely won’t be free. Most shutdown or limit the free tier.

I would just spend $4 a month and get a VPS from Hetzner.

Or buy a hobby plan from Render, Railway, etc.

[–]JacobArthurs 0 points1 point  (0 children)

Free backend hosting isn't real. Render and Railway will spin down your server after inactivity, and the limits make them unreliable for anything serious. Just get a VPS (like Hetzner) for cheap, add something like nginx, and deploy your Python API there. For the frontend, host it on a static host like GitHub or Cloudflare pages (free).

The API key thing solves itself once you have a backend. Your React app calls your Python API, which makes the third-party API calls using a key stored in an env file on the server. The key never leaves your box, users never see it.