This PR introduces Yarn Workspaces with two packages: frontend and backend. The frontend package will contain the UI built with Next.js, and the backend is just our current Node.js service built with Express. Because Next.js runs its own server by default, we must figure out how to run them all together.
A. Run just Next.js and implement our backend as API routes inside the Next.js frameworks.
pros: one Node.js server handling everything
cons: no separate of concerns, requires significant changes in our project
B. Run two Node.js servers on a different port
pros: better separation of concerns (API and UI are independent services), we can keep our backend code untouched as is and just add frontend package
cons: running two separate Node.js services, either each in one docker container or one container for both exposing two ports for each service
I already dismissed the first option because it would require significant changes, and I feel that running two services shouldn't be so difficult, it might be beneficial long-term. Or we can always move our endpoint to the frontend Next.js as API routes.
I only set up the project in a way that it should run just Node.js backend as we have done it so far. Later, we can figure out how to run the frontend part.
This PR introduces Yarn Workspaces with two packages: frontend and backend. The frontend package will contain the UI built with Next.js, and the backend is just our current Node.js service built with Express. Because Next.js runs its own server by default, we must figure out how to run them all together.
A. Run just Next.js and implement our backend as API routes inside the Next.js frameworks.
B. Run two Node.js servers on a different port
I already dismissed the first option because it would require significant changes, and I feel that running two services shouldn't be so difficult, it might be beneficial long-term. Or we can always move our endpoint to the frontend Next.js as API routes.
I only set up the project in a way that it should run just Node.js backend as we have done it so far. Later, we can figure out how to run the frontend part.