Welcome, to my First Post!
About Me:
Hi, My name is Aasim Ashraf, I am a Full-Stack dev.
What is Monorepo?
A monorepo is a version-controlled code repository that contains multiple logical projects within a single repository.
Let's Create our Own MonoRepo using Nest.js
Before we dive into creating our monorepo, make sure you have the following:
- Node.js installed on your system.
- npm
Let's Get Started.
Install the Nest.js CLI:
npm i -g @nestjs/cli
Create a New Project::
nest new [project name]
like we will create a demo app.nest new demo
Select the Package manager npm, pnpm, yarn any of these and hit enter.
Wait for the dependencies to install and open the demo app in your preferred code editor, such as VSCode.
- Convert the Nest.js App into a Monorepo, Open the Terminal and type
nest g app my-app1
This command will delete the src directory and create a new apps directory. Inside this directory, you'll find the demo and my-app1.
- Your Monorepo is Ready. You have successfully converted the basic nest.js app into a mono-repo.
You can add libraries that could contain the common logic etc.
use Command nest g lib [library name]
eg. nest g lib auth
this auth lib will contain the code related to the authentication only.
I hope you have enjoyed this.
Thanks for bearing with me.
Top comments (0)