# Alqove Web

Marketplace front-end for the Alqove platform — Next.js 15 App Router consuming the Alqove API.

## Quick Start

```bash
# Make sure the alqove-api stack is running (docker compose up -d in ~/projects/alqove-api)
npm install
npm run build:types        # generate TS types from contracts/openapi.yaml
npm run dev:web            # http://localhost:3000
```

## Layout

- `web/` — Next.js app (buyer + seller surfaces)
- `packages/`
  - `api-client/` — typed HTTP client (`@alqove/api-client`)
  - `types/` — generated TS types from OpenAPI (`@alqove/types`)
  - `shared/` — shared utilities (`@alqove/shared`)
  - `design-tokens/` — tokens build pipeline (`@alqove/design-tokens`)
  - `design-system/` — component/pattern docs (`@alqove/design-system`)
- `contracts/openapi.yaml` — snapshot of the API contract from alqove-api
- `bin/sync-openapi.sh` — refresh the contract snapshot from the alqove-api repo

## OpenAPI sync

`contracts/openapi.yaml` is a checked-in snapshot copied from `~/projects/alqove-api/api/contracts/openapi.yaml`. When the API contract changes upstream:

```bash
./bin/sync-openapi.sh        # cp from alqove-api → contracts/
npm run build:types          # regenerate TS types
# review the diff in packages/types/src/generated.ts and commit alongside any code that depends on the new shape
```

Override the source location with `ALQOVE_API_DIR` if alqove-api lives somewhere other than `~/projects/alqove-api`.

## Conventions

- Money values are integers in cents (USD); format via `@alqove/shared` `formatPrice()`
- API responses follow the wrapper format from the OpenAPI spec
- Bearer-token auth via `Authorization: Bearer <token>`; no Sanctum stateful SPA mode

## Commands

```bash
npm run build:types          # regenerate types
npm run build:tokens         # build design tokens
npm run typecheck            # type check all packages
npm run lint                 # lint
npm run test                 # vitest (web workspace has its own)
npm run dev:web              # next dev
npm run build:web            # next build
```
