Questions regarding deploying a Next.js and Express web app to heroku and vercel

Viewed 15

I have a project that I want to deploy which uses Next.js for the frontend and Express and Node for the backend. I would like to deploy this to heroku (backend) and vercel (frontend) once I finish building it but I have some concerns. Is this file structure ok?

enter image description here

If I have both my frontend and backend in one folder, would this still be possible? How am I able to connect to my frontend from the backend if I deploy on two different hosting services, is it possible to connect to my Next.js frontend from my heroku backend? In my backend I have a .env file which will contain my MongoDB URL to the database, how do I attach my .env file to the heroku backend so it can read it?

I'm a bit confused on this topic and some help would be greatly appreciated!

0 Answers
Related