# Refactoring Round 2 — Design

> 2026-05-19

## Phase 1: Toolchain & Configs

1. Enable `strict: true` in `client/tsconfig.app.json`
2. Add ESLint + Prettier to server (copy rules from client, adapt for JS)
3. Remove dead configs: `server/vitest.config.ts` (duplicate of `.js`)
4. Fix AGENTS.md: `dev` uses `.env` not `.dev_env`; add `db:reset:test` to server
5. Clean .gitignore: remove `.opencode/plans/` reference

## Phase 2: Deduplication & Separation

1. Move order status transition logic to `shared/constants/order.js` as shared data
2. Split `entities/product/api/product-api.ts` into public + admin API files
3. Consolidate review API into `entities/review/`
4. Move delivery-carrier labels into `shared/constants/delivery-carrier.js`
5. Add `db:reset:test` script to `server/package.json`

## Phase 3: Large File Decomposition

1. `AdminProductsPage.tsx` (596 lines) → `features/product-form/` + table page
2. `AdminOrdersPage.tsx` (398 lines) → `features/order-detail/` + table page
3. `AddressesPage.tsx` (318 lines) → `features/address-form/` + list page
4. `ProductPage.tsx` (304 lines) → extend `widgets/reviews-block/`
