notiz-dev / nestjs-prisma-starter

Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker
MIT License
2.37k stars 336 forks source link

Maintain frontend in same repo without sharing dependencies #431

Closed some-user123 closed 2 years ago

some-user123 commented 3 years ago

Hi,

thanks a lot for this starter, really appreciate it!

I'm trying to put this starter together with same frontend project in the same repo using yarn workspaces.

My approach so far:

That works for the starter. However, for my existing project with frontend included already I'm experiencing several issues (e.g. nest-cli-plugins not working, VSCode configuration getting tricky, ...). I haven't really found out why (maybe the hoisting is problem...) and it is difficult to debug (for me).

I would assume having a frontend as well is kind of usual and I'm not the only one facing this problem ;-)

What is the standard way to approach this challenge?

I know, that Nestjs has some its own support for monorepos (https://docs.nestjs.com/cli/monorepo). However, this approach does not allow to have a different dependencies (package.json) etc. per app (which I would like to have to avoid dependency problems...).

Is there some middle ground between keeping everything in separate repos and completely sharing all dependencies, that is proven and well established in the community?

Pirastrino commented 3 years ago

Hi, I am working on project where I want to combine an nestjs api, prisma and a nextjs FE all in one monorepo and dockerized. I am following this course. Sometimes it can be tricky, especially if you want to use containers in development. I agree, nestjs deserves a more 'production-ready' starter as it is not easy to make things working.

yassinebridi commented 3 years ago

I'm currently using NestJS with with Next.js in a yarn workspace context, i don't have any issues with it so far. The NestJS app is dockerized too.

some-user123 commented 3 years ago

@yassinebridi Do you mind sharing a link to the repo?

yassinebridi commented 3 years ago

It's a private repo unfortunately, but i will make a minimal repo when i have time.

marcjulian commented 2 years ago

Here is a great example for monorepo including Nestjs + Prisma: https://github.com/alitnk/nest-prisma-monorepo

Maybe its also valid to look into Nx or Turborepo. Awesome video by fireship about monorepos.