Clear server vs client boundary
Tag every lib `scope:server`, `scope:client`, or `scope:isomorphic` — enforce at the bundler boundary.
nx-isolation-deps-server-client-boundary
Why it matters
| Stake | If ignored |
|---|---|
| Secret exposure |
|
| Layer mixing |
|
How to fix
In a monorepo with backend and frontend apps, every library must declare which side it runs on. A "both" library is one the bundler will catch importing fs in production. Tag libs scope:server, scope:client, or scope:isomorphic and enforce via enforce-module-boundaries.
Examples
ts
// libs/shared/utils/src/lib/index.ts
export { formatDate } from './format-date'; // browser-safe
export { signJWT } from './sign-jwt'; // server-only, uses crypto
export { parseCSV } from './parse-csv'; // browser-safetext
/libs/shared
/util-formatting [scope:isomorphic] # both sides
/util-server [scope:server] # backend only
/util-browser [scope:client] # frontend only