2026-06-12 11:41:07 -03:00
# SeaHaven Admin
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
Vite + React SPA for SeaHaven facility management (work orders, vendor portal, uplifts, and related admin features).
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
## Requirements
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
- Node.js 20+
- npm 10+
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
## Setup
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
```bash
npm ci
cp .env.example .env
```
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
### Environment variables
2025-08-11 19:13:42 -05:00
2026-06-17 09:32:43 -03:00
| Variable | Description | Default |
| ----------------- | ----------------------------------------------- | ----------------------- |
| `VITE_API_URL` | Ky API prefix (baked into the production build) | `/api` |
| `VITE_API_TARGET` | Dev proxy target for `/api` (Vite only) | `http://localhost:5141` |
`VITE_API_URL` is the full API base prefix. Route paths in `API_PATHS` do **not** include `/api` — only this variable supplies it.
- **Development:** use `VITE_API_URL=/api` . The Vite dev server proxies `/api` to `VITE_API_TARGET` .
- **Production:** use an absolute URL that **ends with `/api`** (e.g. `https://api.example.com/api` ). Absolute URLs without `/api` will produce broken API requests.
See [`.env.example` ](.env.example ) and [`.env.production` ](.env.production ) for reference values.
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
## Scripts
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
| Command | Description |
| ---------------------- | ------------------------------------------ |
| `npm run dev` | Start Vite dev server on port 3000 |
| `npm run build` | Type-check and production build to `dist/` |
| `npm run preview` | Preview production build locally |
| `npm test` | Run Vitest unit tests |
| `npm run test:watch` | Run Vitest in watch mode |
| `npm run lint` | ESLint |
| `npm run lint:fix` | ESLint with auto-fix |
| `npm run format` | Prettier write |
| `npm run format:check` | Prettier check (used in CI) |
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
## Architecture
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
New code lives under `src/domain/` , `src/app/` , and `src/api/` following the IrisLoan conventions documented in `docs/ARCHITECTURE_PLAN.md` .
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
## CI
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
GitHub Actions workflow (`.github/workflows/ci.yml` ) runs on push and pull requests:
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
1. `npm run format:check`
2. `npm run lint`
3. `npm run build`
4. `npm test`
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
Local pre-commit hooks (Husky + lint-staged) run ESLint and Prettier on staged files.
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
## Development proxy
2025-08-11 19:13:42 -05:00
2026-06-12 11:41:07 -03:00
During `npm run dev` , requests to `/api` are proxied to `VITE_API_TARGET` (see `vite.config.ts` ).