2026-08-10 16:35:56 -04:00
# Sea Haven AP
2026-09-25 22:43:44 +00:00
Internal accounts payable automation for Sea Haven Industries. Local API is `http://127.0.0.1:8787` . CloudFront on seahaven-dev is the first hosted origin.
2026-08-10 16:35:56 -04:00
2026-08-10 19:28:02 -04:00
## Workspace layout
npm workspaces:
- `@seahaven-ap/web` — Vite/React SPA (repo root)
- `@seahaven-ap/shared` — payment ladder, invoice helpers, pay-date parsers, CSV constants ([`packages/shared` ](packages/shared ))
2026-08-10 20:10:49 -04:00
- `@seahaven-ap/api` — Hono API, Drizzle schema, auth/RBAC ([`packages/api` ](packages/api ))
2026-08-10 19:28:02 -04:00
2026-08-10 16:35:56 -04:00
## Local development
2026-08-10 20:10:49 -04:00
### Frontend (mocks)
2026-08-10 16:35:56 -04:00
```bash
npm ci
2026-08-10 16:42:19 -04:00
cp .env.example .env # optional; defaults already use mocks
2026-08-10 16:35:56 -04:00
npm run dev
```
2026-08-10 20:10:49 -04:00
App serves at http://localhost:3000. `VITE_USE_MOCKS=true` is the default data path until AP-15 wires live API calls.
### API + data plane (AP-14)
```bash
docker compose up -d
cp .env.example .env
npm run db:migrate
npm run db:seed
npm run dev:api
```
API listens on http://127.0.0.1:8787. Vite proxies `/api` to that port.
Smoke:
```bash
2026-09-25 22:43:44 +00:00
curl -s http://127.0.0.1:8787/api/health
2026-08-10 20:10:49 -04:00
curl -s http://127.0.0.1:8787/api/me
```
2026-09-25 22:43:44 +00:00
`DEV_AUTH_BYPASS=true` is local-only and only allowed when `NODE_ENV` is `development` or `test` (rejected for production, staging, preview, and any other value). Cookie session names are `ap_*` locally and `__Host-ap_*` outside local.
2026-08-10 20:10:49 -04:00
API roles (source of truth): `admin` , `ap_processor` , `approver` , `viewer` . Frontend mocks still use `ap_operator` until AP-15 remaps them.
### OpenAPI / Redocly
Linting uses the same `redocly.yaml` ruleset as `procurement-ingest` .
```bash
npm run lint:api
npm run docs:preview # builds HTML via redocly build-docs and opens it
```
2026-08-10 16:35:56 -04:00
## Verify
```bash
npm run verify
2026-08-10 16:42:19 -04:00
npm run test:e2e
2026-08-10 16:35:56 -04:00
```