{"id":16755700,"url":"https://github.com/scopsy/nestjs-monorepo-starter","last_synced_at":"2025-04-09T10:08:25.715Z","repository":{"id":38993144,"uuid":"224831595","full_name":"scopsy/nestjs-monorepo-starter","owner":"scopsy","description":"A full-stack nestjs starter project. Includes authorization, authentication, MongoDB, Redis queue support, Crons jobs, and end-to-end testing.","archived":false,"fork":false,"pushed_at":"2023-01-12T01:43:35.000Z","size":7960,"stargazers_count":280,"open_issues_count":75,"forks_count":34,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T08:12:03.672Z","etag":null,"topics":["boilerplate","nestjs","nodejs","starter"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scopsy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-29T10:26:42.000Z","updated_at":"2025-03-25T19:36:00.000Z","dependencies_parsed_at":"2023-02-09T09:17:54.901Z","dependency_job_id":null,"html_url":"https://github.com/scopsy/nestjs-monorepo-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopsy%2Fnestjs-monorepo-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopsy%2Fnestjs-monorepo-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopsy%2Fnestjs-monorepo-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopsy%2Fnestjs-monorepo-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scopsy","download_url":"https://codeload.github.com/scopsy/nestjs-monorepo-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018060,"owners_count":21034048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","nestjs","nodejs","starter"],"created_at":"2024-10-13T03:23:31.897Z","updated_at":"2025-04-09T10:08:25.695Z","avatar_url":"https://github.com/scopsy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NestJS Mono repo starter\n\n![CI](https://github.com/scopsy/nestjs-monorepo-starter/workflows/CI/badge.svg)\n\n\u003cdiv align=\"center\"\u003e\n\tSupported by:\n  \u003c/div\u003e\u003cdiv align=\"center\"\u003e\n\t\t\u003ca href=\"https://github.com/notifirehq/notifire\"\u003e\n\t\t\t\u003cimg src=\"https://camo.githubusercontent.com/3ca722f7a9be6a1c65edd8297eaf978e70917c3a9344f182adcbe19a7df78474/68747470733a2f2f75706c6f6164732d73736c2e776562666c6f772e636f6d2f3631333062346432396262306162303965313461653965652f3631333065363933316637353564663330323230336663635f536964654c6f676f2532302d253230424c61636b2d702d3830302e706e67\" width=\"200\"\u003e\n\t\t\u003c/a\u003e\n    \u003c/div\u003e\n    \u003cdiv align=\"center\"\u003e  \u003csup\u003eOpen-source multi-channel notification management\u003c/sup\u003e\n\u003c/div\u003e\n    \n\u003cbr/\u003e\n\u003cbr/\u003e\n\nThis is a monorepo boilerplate to quickly start nestjs projects, this start includes an api, client and shared libraries.\n\n- [Overview](#overview)\n  - [What's inside](#whats-inside)\n- [Tweaking for your project](#tweaking-for-your-project)\n- [Referencing packages from other packages/apps](#referencing-packages-from-other-packagesapps)\n- [Installing](#installing)\n- [Development](#development)\n- [Package Management](#package-management)\n    - [Installing a module from Yarn](#installing-a-module-from-yarn)\n    - [Uninstalling a module from a package](#uninstalling-a-module-from-a-package)\n- [Package Versioning and TS Paths](#package-versioning-and-ts-paths)\n- [Docker image](#docker-image)\n- [Running the tests](#running-the-tests)\n- [Inspiration](#inspiration)\n\n## Overview\n\nThe repository is powered by [Lerna](https://github.com/lerna/lerna) and [Yarn](https://yarnpkg.com/en/).\nLerna is responsible for bootstrapping, installing, symlinking all of the packages/apps together.\n\n### What's inside\n\nThis repo includes multiple packages and applications for a hypothetical project called `nest-starter`. Here's a rundown of the components:\n\n- `shared`: Shared utilities between server and client (TypeScript)\n- `core`: Shared utilities between servers\n- `client`: Angular app (depends on `shared`)\n- `api`: NestJS Api server (depends on `shared` + `core`)\n- `landing`: A static landing page\n\n## Tweaking for your project\n\nYou should run a search and replace on the word `nest-starter` and replace with your project name.\n\n## TypeScript\n\n### Referencing packages from other packages/apps\n\nEach package can be referenced within other packages/app files by importing from `@\u003cname\u003e/\u003cfolder\u003e` (kind of like an npm scoped package).\n\n```tsx\nimport * as React from 'react';\nimport { Button } from '@nest-starter/shared';\n\nclass App extends React.Component\u003cany\u003e {\n  render() {\n    return (\n      \u003cdiv className=\"App\"\u003e\n        \u003cheader className=\"App-header\"\u003e\n          \u003ch1 className=\"App-title\"\u003eWelcome to React\u003c/h1\u003e\n        \u003c/header\u003e\n        \u003cButton\u003eHello\u003c/Button\u003e\n        \u003cp className=\"App-intro\"\u003e\n          To get started, edit \u003ccode\u003esrc/App.tsx\u003c/code\u003e and save to reload.\n        \u003c/p\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nexport default App;\n```\n\n**IMPORTANT: YOU DO NOT NEED TO CREATE/OWN THE NPM ORGANIZATION OF YOUR PROJECT NAME BECAUSE NOTHING IS EVER PUBLISHED TO NPM.**\n\nFor more info, see the section on [package versioning](#package-versioning-and-ts-paths)\n\n### Installing\n\nInstall lerna globally.\n\n```\nnpm i -g lerna\n```\n\n```\ngit clone git@github.com:scopsy/nestjs-monorepo-starter.git\ncd typescript-monorepo-starter\nrm -rf .git\nlerna bootstrap\n```\n\n### Development\n\nLerna allows some pretty nifty development stuff. Here's a quick rundown of stuff you can do:\n\n- _`yarn start`_: Run's the `yarn start` command in every project and pipe output to the console. This will do the following:\n  - api: Starts the api in dev mode on port 3000\n  - client: Starts the app in dev mode on port 4200\n  - shared: Starts TypeScript watch task\n  - core: Starts TypeScript watch task\n- _`yarn build`_: Build all projects\n- _`lerna clean`_: Clean up all node_modules\n- _`lerna bootstrap`_: Rerun lerna's bootstrap command\n\n### Package Management\n\n\\*\\*IF you run `yarn add \u003cmodule\u003e` or `npm install \u003cmodule\u003e` from inside a project folder, you will break your symlinks.\\*\\* To manage package modules, please refer to the following instructions:\n\n#### Installing a module from Yarn\n\nTo add a new npm module to ALL packages, run\n\n```bash\nlerna add \u003cmodule\u003e\n```\n\nTo add a new npm module(s) to just one package\n\n```bash\nlerna add \u003cmodule\u003e --scope=\u003cpackage-name\u003e \u003cother yarn-flags\u003e\n\n# Examples (if your project name was `nest-starter`)\nlerna add classnames --scope=@nest-starter/api\nlerna add @types/classnames @types/jest --scope=@nest-starter/api --dev\n```\n\n#### Uninstalling a module from a package\n\nUnfortunately, there is no `lerna remove` or `lerna uninstall` command. Instead, you should remove the target module from the relevant package or packages' `package.json` and then run `lerna bootstrap` again.\nReference issue: https://github.com/lerna/lerna/issues/1229#issuecomment-359508643\n\n### Package Versioning and TS Paths\n\nNone of the packages in this setup are _ever_ published to NPM. Instead, each shared packages' (like `shared` and `core`) have build steps (which are run via `yarn prepare`) and get built locally and then symlinked. This symlinking solves some problems often faced with monorepos:\n\n- All projects/apps are always on the latest version of other packages in the monorepo\n- You don't actually need to version things (unless you actually want to publish to NPM)\n- You don't need to do special stuff in the CI or Cloud to work with private NPM packages\n\nThis project works great with WebStorm when opened from the root, this means all imports, Go to should work correctly when navigating between packages.\nYou are welcome.\n\n### Docker image\n\nBuild the docker image:\n\n```shell\ndocker build -t api -f Docker.api .\n```\n\nRun the Docker Container:\n\n```shell\ndocker run -p 3000:3000 api\n```\n\n## Inspiration\nA LOT of this has been shameless taken from [palmerhq/monorepo-starter](https://github.com/palmerhq/monorepo-starter).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscopsy%2Fnestjs-monorepo-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscopsy%2Fnestjs-monorepo-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscopsy%2Fnestjs-monorepo-starter/lists"}