Adding Packages
1. Create the package
Section titled “1. Create the package”Create a new folder under packages/<name>.
Recommended package.json shape:
{ "name": "package-name", "version": "1.0.0", "type": "module", "private": true, "main": "index.js", "exports": { ".": "./src/index.ts" }}2. Export from src/index.ts
Section titled “2. Export from src/index.ts”Keep the package entrypoint clean and export the public surface from src/index.ts.
3. Consume from an app or package
Section titled “3. Consume from an app or package”Use the workspace dependency form:
{ "dependencies": { "package-name": "workspace:*" }}4. Prefer shared packages when
Section titled “4. Prefer shared packages when”- logic is used by more than one app
- runtime config should be centralized
- schema or database contracts should stay consistent across services