# 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, and deep imports into entity internals. ## 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. ## Constraints - Only modify imports and restructure entities/search and BrokerAccountLayout. Do not change business logic. - Share `request()` from shared/api — `entities/search/api/searchApi.ts` imports `request` from shared. - `entities/broker-account/index.ts` barrel exports remain unchanged. ## 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 `entities/broker-account/model/brokerAccountsOverview` deep imports