Hacker News new | ask | show | jobs
by smt88 1467 days ago
Don't worry about your deployment being directly related to your dev environment. That's a good goal, but most people make do without it.

You can use Vagrant or Docker[1] locally and then deploy somewhere easy like Render.com[2][3].

Since you're new to fullstack, you may have an easier time with Next.js (definitely use the TypeScript option) because then you're only learning/using a single language in a single repository for both frontend and backend.

1. https://blog.miguelgrinberg.com/post/how-to-dockerize-a-reac...

2. https://render.com/docs/deploy-flask

3. https://render.com/docs/deploy-create-react-app

1 comments

Thanks for the advice and links! Do you know of a Render tutorial that involves getting Flask and ReactJS services to communicate with one another? Your 2nd and 3rd links demonstrate each independently. I don't know whether the same challenge will pop up in NextJS
With React by itself, you need to know the API's URL. You should read about environment variables and how React handles them.

You would have one environmental file for local development, and then in production, you'd use Render.com's environment variable settings.

One of these variables would be something like REACT_APP_API_BASE_URL (doesn't matter what you call it, as long as it begins with REACT_APP).

Then you prepend all of your API calls with that in your React code.

Next.js does not have this setup step because it serves your API and static site from the same s Node server by default, so all of your API URLs would just be /my-api-call (because the API and fronted would have the same hostname, whatever it is).

Thanks for taking the time to explain :)