Skip to main content

Monorepo & Self-Contained App Structure

ClauseShield uses npm workspaces ("workspaces": ["apps/*"]) in the root package.json.

Why Each App Is Self-Contained​

Rather than maintaining a separate packages/shared build step, each app owns its own src/shared/ directory:

  • apps/api/src/shared/ (brand.ts, types.ts, index.ts)
  • apps/web/src/shared/ (brand.ts, types.ts, seo-data.ts, index.ts)
  • apps/admin/src/shared/ (brand.ts, types.ts, index.ts)

This ensures:

  1. Zero cross-package build failures on Vercel, AWS Amplify, or AWS SAM.
  2. Independent deployments — you can deploy apps/api to AWS Lambda without bundling frontend code.
  3. Single-file rebranding — update BRAND in brand.ts to rename the product or switch domains.

Root Scripts​

CommandDescription
npm run devStarts api (4000), web (3000), admin (3001), and docs (3002) concurrently
npm run dev:apiRuns NestJS backend in watch mode
npm run dev:webRuns User Next.js frontend
npm run dev:adminRuns Admin Next.js panel
npm run dev:docsRuns Docusaurus documentation server
npm run buildBuilds all 4 workspaces