2.5 KiB

FSD Final Cleanup

Goal

Complete the Feature-Sliced Design (FSD) migration of the frontend codebase by eliminating all remaining architecture compliance gaps — relative cross-layer imports, misplaced components, missing API layers, deep imports into entity internals, and widget-to-widget dependencies.

Requirements

R1: All imports use @/ path aliases

No ../../../ or ../../ relative imports across the entire src/ tree. Every import must use the @/ alias pointing to src/.

R2: BrokerAccountLayout lives in widgets layer

The BrokerAccountLayout component (layout with routing + useOutletContext) currently lives in entities/broker-account/ui/. It must be moved to widgets/broker-account-layout/ since it is a page layout, not a business entity.

R3: entities/search has an api/ layer

The searchSecurities function — a domain API call — currently lives in shared/api/client.ts. It must be moved to entities/search/api/searchApi.ts so that each entity owns its domain calls.

R4: App layer uses barrel imports

Files in app/ must import from entity barrel files (@/entities/session) rather than deep-importing into model/ or api/ subdirectories.

R5: Tests use @/ path aliases

All test files must import test/server and test/test-utils via @/ prefix instead of relative paths.

R6: BrokerAllocationChart lives in shared/ui

The BrokerAllocationChart and BrokerAllocationBar components are pure UI (SVG charts) without business logic, consumed by multiple widgets and pages. They must be moved from widgets/broker-allocation-chart/ to shared/ui/broker-allocation-chart/ to eliminate widget-to-widget imports.

R7: No cross-entity deep relative imports

entities/broker-position/model/brokerDisplay.ts must not use relative paths to import from broker-operation/model/. It must use the @/entities/broker-operation barrel.

R8: All entities fully export their public API

entities/broker-account/index.ts must export the BrokerAccountsAggregate type. Consumers must use the barrel instead of deep-importing into model/.

Constraints

  • Only modify imports and restructure components. Do not change business logic.
  • Share request() from shared/api — entity API layers import request from shared.
  • Do not restructure code that is not part of the specified changes.

Out of Scope

  • Moving styles.css or main.tsx into app/
  • Type deduplication (responses.ts vs types.ts)
  • Moving src/test/ to shared/lib/tests/
  • Refactoring other entity barrel exports