Considering a refactor to the existing monolith at the moment. We have a big Nest app and would like it to instead be comprised of multiple smaller lambdas with lazy loaded modules/services, bundled with swc or webpack. It will continue to serve as a graphql backend to multiple react-dom and react-native applications (think cms, a user-facing app, and internal apps that speak to the same gql api) and could therefore hugely benefit from code reuse.
Namely, the idea is to make Zod schemas be the source of truth that can be used for scaffolding the database schema, graphql inputs and object types (for automatic complex validation), and frontend validation.
I've sandboxed a working turborepo proof of concept last year that actually worked fantastically with good modular tsconfigs and eslint, a couple of ts packages that were imported into two mock services (back and front) and I was satisfied that this was the direction to go. Now picking it back up, of course I did not mock the backend service using nest, and instead just a thin fastify file. Nest no like. The shared libs have to be compiled first and won't trigger a recompile. Other fails include discovering that tsconfig.references is no go. Esbuild does not support decorators. Finding chatter about Nest being very sensitive to versions of packages for some reason (I don't get this deeply at the moment, but it seems like a big problem to walk into at a later stage - is that real?).
What are our options here? I can see that Nest has its own take on a monorepo that is well supported by nest-cli, but strays from what would be a more generic structure that suits us very well. Nest is currently the big boss in our project, but it would be nice that commonly shared code was agnostic with the monorepo structure mirroring that: turborepo succeeds here.
Should I use my own from-scratch webpack config for development, that I could then also reuse for deployment?
I hope I am getting my Q across, head is spinning atm