Monorepo Vue + Nestjs domain and platform object sharing

722 views Asked by At

Objective:

  • Use a monorepo structure, in which I can share domain models and generic implementations (using a provider pattern) across the different Bounded Contexts
  • Ability to deploy each bounded context or client application independently of the others (thus all of this in a monolith under one src directory is not acceptable.

Background: Typical tech stacks for me is Angular + .Net Core. I am starting to move away from Angular and also exploring the code sharing benefits if I do my API development with Nestjs.

I am trying to figure out the best way to set up shared code between the client and API and running into some issues.

I have the following directory structure. I would like to figure out the best way to shared the models that are in the domain/models/comestibles in the api/comestibles and in the web application. I am ok with putting all of the shared code in a packages folder as well (was looking at Lerna)

enter image description here

I can easily point the code to the directory from the api/comestibles, but that is making the dist folder structure undesirable and also messing up things (like Swagger). I also had the change the outDir in the tsconfig.json from

"outDir": "./dist"

to

"outDir": "./dist/api/comestibles/src"

This broke other things in the application though as the directory structure is really altered.

I looked at setting up Bit and I have tracked some files, but I do not see any packages created for those files. Perhaps I am using it incorrectly though. I was also looking at Lerna for this. Given this is the first time I have done a full-stack application via scripting, I am unfamiliar with the best architecture for this solution.

1

There are 1 answers

0
Meester Over On