Imports & Boundaries (Frontend Standard)
This document defines boundaries to keep the codebase maintainable.
Boundary rules (required)
- Browser code must not call backend services directly. It calls only the BFF (
/api/v1/...). - Features should not import other features’ internals.
- If code must be shared across features, lift it into
src/components/orsrc/lib/.
- If code must be shared across features, lift it into
src/lib/contains cross-cutting utilities (API client, env parsing, generic helpers).
Import conventions
- Prefer importing from a folder’s public API (
index.ts) rather than deep paths. - Avoid circular dependencies:
- If two features need each other, refactor shared code into
src/lib/orsrc/components/.
- If two features need each other, refactor shared code into
Path aliases
Projects may configure aliases (e.g., @/components, @/features, @/lib) but must keep them consistent and documented in the repo.