Reputation: 67
We've been using the NestJS to build the backend service(=original project from now on). We're also going to create another NestJS application which is depending on same database with the original one so I need to access the entities(typeorm's entities) in original project. What's the best way of the sharing the entities(or modules) between multiple NestJS applications? Some ways I've thought are
Any ideas or suggestion? Thanks in advance!
Upvotes: 2
Views: 4238
Reputation: 545
The optimal effort/result solution may be a monorepo. The idea is to create a nestJS project of type library
which can hold assets you want to share. Other instances can import assets/interfaces/classes very easly from there.
If you go further than that into monorepos, tools like Nx are also an option but also require more time to set up.
Copy/paste would be a maintenance nightmare in my opinion and manual library/dependency share is pretty much the same effort if not more as using provided solutions like monorepo pattern.
Upvotes: 4