0👍
in dotenv or rather in .env file you put your dburl, username and password for accessing that db. On your local comp you would have creds for accessing your local db, while when you upload your app to e.g. heroku, you would not upload .env file, but use Heroku config panel to create same vars you had in .env file just with values for live db. Also add .env to .gitignore
as for api’s, your frontend needs to know where backend is located so yeah you need to update that base api url. Since this is backend no way to know the live url where those data would be served, on which web server so you need to update this url manualy once in your frontend and thats all.
Source:stackexchange.com