Monorepo allows us to manage multiple packages in a single repository. This is useful for us to manage our packages and dependencies. This is also useful for sharing code between apps (e.g. apps/web and apps/mobile).
Copy paste .env.example to .env and fill in the values.
The underlying monorepo we use is Turborepo. To start all dev commands, run yarn dev
- Clone this repo
- Run
yarn install - Run
yarn devto start all dev commands
All packages are in the
packagesfolder. There is apackages/sample-packagefolder that you can use as a template. It is in Typescript. You can copy and paste the folder, make some adjustments and you are ready with a new package.
Within sample-package,
- All files are in
src/ - The build output is in
dist/ - Remember to rename your package in
package.json. Make sure to prefix it with@your-username/(e.g.@lifehack/ui) - In the workspace where you need to use this package, add
@your-username/sample-packageas a dependency (in the devDependencies). For example, if you are inapps/web, modify yourpackage.jsonto include@your-username/sample-packagein thedevDependenciessection.
"devDependencies": {
"@your-username/sample-package": "*"
}- Run
yarn installto use the new package.