Deploy monolithic next.js app : frontend file inside express backend file

Hello !

We’re trying to deploy our next.js app (linked to a Mongo DB by an Express backend).

The structure of our files is the following :

  • project
    – backend (express)
    —frontend (next.js)

The frontend folder is inside the backend one. And the next build command is not working.

By the way, we so have two .env files (one for the backend, the other one for the frontend), two package.json (front and back), etc.

Is this possible to deploy an app this way with Netlify ? How could we do this so ?

Many thanks !

I don’t see why not. Simply setting base directory to your frontend folder should be enough to get this working.

Hi, thank you for answering ! It did’nt work but we found an other solution. Thanks !

glad to hear you found a solution that worked for you.

Hey, i am facing the same problem and spent a lot of time in research. I have the same architecture for my project which has frontend and backend.
Frontend is based on Nextjs with app dir and Backend based on Nodejs-express and mongodb.

Could you please share, how did you solve?

Hi !
We finally split the folders to put one on Netlify or Vercel (frontend) and one on Render (backend). We just had to rebuild the communication between both, but it was better than taking three more days searching a solution XD
Sorry not being able to help further…
Nice day