--- description: SeaHaven Admin — IrisLoan architecture, selective rebuild conventions alwaysApply: true --- # SeaHaven Admin — IrisLoan conventions ## Stack - Vite SPA + React Router 7, TypeScript strict, Tailwind v4 + MUI - HTTP: Ky with `credentials: "include"` (httpOnly cookies) - Server state: TanStack Query; forms: React Hook Form + Zod - **Do not use** in new code: Next.js, Redux, axios, `apiUtil.js`, `tokenUtility.js` ## Target structure (`src/`) ``` api/ domain// app/ infra/query-key/ lib/ hooks/ components/ui|common|layout/ config/menu.ts providers/ main.tsx ``` - `@/` alias for imports; new files in **kebab-case** (`use-debounce.ts`, `query-key.ts`) - `pages/` is **reference only** for endpoints and business rules — delete after delivery in `domain/` + `app/` ## HTTP and auth - Centralize paths in `api/api-paths.ts` and responses in `api/handle-api-response.ts` - Auth via AuthProvider + cookies; do not create Redux slices for session ## State and data - Cache and mutations: React Query + `infra/query-key/query-key.ts` - Client defaults in `lib/query/query-client.ts` ## Forms and UI - Zod schemas in `domain//schemas/`; thin views in `app/` - Utility Tailwind + MUI components; **do not** import `site.css` in new code ## Feature implementation flow 1. Consult legacy in `pages//` (endpoints, fields, rules) 2. Create `domain//` (schemas, hooks, use-cases) 3. Thin view in `app/` + route in `app/routes.tsx` 4. Delete `pages//` when the new feature is ready ## Tooling - Strict ESLint only on new architecture `.ts/.tsx`; legacy in `pages/` ignored - Commits: Conventional Commits (`feat(scope): subject`) Reference: `docs/ARCHITECTURE_PLAN.md`