Skip to content

TIP

This page mirrors docs/PACKAGE-DEPENDENCY-GRAPH.md from the repository. Edit it at the source, not here.

Package dependency graph

Last updated: 2026-07-12

This document is the canonical acyclic dependency graph for @saasweave/* packages and runnable apps. Arrows read as "depends on".

Layer responsibilities

LayerPackage / appOwns
ContractscorePure domain schemas, constants, formatters
ConfigenvValidated environment variables (server/*, web/* subpaths)
PersistencedbDrizzle schema, queries, migrations
ApplicationappWorker-safe domain services: Stripe webhook apply, exports, batch processing, storage lifecycle, MRR math
Transport APIapioRPC routers, HTTP auth composition, dispatch to queues, browser/server client split
AsyncjobsQueue contracts, producers, BullMQ processors, orchestration (notifications after export, emails after Stripe)
Processapps/workerSignal lifecycle, readiness HTTP, schedule registration — imports processors only from jobs
Processapps/serverHono HTTP, webhooks, media routes
UIapps/webTanStack Start UI; browser bundles use @saasweave/api/client/browser/orpc or the isomorphic @saasweave/api/client/tanstack-start/orpc

SSR / client boundary

  • Browser bundles must use @saasweave/api/client/browser/orpc (HTTP RPCLink + ENV_WEB_ISOMORPHIC only) or the isomorphic TanStack Start helper, which dynamically imports the browser client on the client and the server client during SSR.
  • SSR loaders use the in-process @saasweave/api/client/server/orpc via the isomorphic helper. This calls appRouter directly with Better Auth session resolution — no extra HTTP hop.
  • Never import @saasweave/db, @saasweave/env/server/*, or @saasweave/auth from browser-targeted modules.

Export policy

  • core, env, and mailer publish explicit subpaths only (no ./* wildcards).
  • Deep imports into src/ internals are unsupported; consume documented package.json#exports entries.
  • Boundary checks live in scripts/__tests__/package-boundaries.test.ts.

Validation

bash
pnpm install
vp check --fix
vp run -w fix
pnpm dotenvx run -f ./packages/env/.env -- vp run -r test:unit
vp run build
pnpm fallow
node scripts/ci/maintainability-gate.mjs
vp test scripts/__tests__/package-boundaries.test.ts

Released under the MIT License.