# Bosstox backend blueprint

## Next persistent slice

Use a hosted relational database for companies, products, events, sources, relationships, review decisions, and customer watchlists. The public dashboard should read approved records only. Scout candidates should remain private until a human review decision exists.

## Route contract

- `GET /api/companies?category=&status=&q=` — approved company records.
- `GET /api/companies/:id` — company, products, events, and cited sources.
- `GET /api/signals` — approved recent signals.
- `GET /api/review-queue` — owner/editor-only Scout candidates.
- `POST /api/review-queue/:id/approve` — approve a candidate with reviewer identity.
- `POST /api/review-queue/:id/reject` — reject with reason.
- `GET /api/watchlists` — current user’s saved company lists.
- `POST /api/watchlists` — create a private watchlist.

## Authorization

Use the Site’s authenticated-user identity on every write. Public or workspace viewers can read only approved records. Only the owner or explicitly assigned editor can approve Scout candidates. Never trust a client-provided reviewer id.

## Migration order

1. `companies`, `categories`, and `sources`
2. `products`, `events`, and `relationships`
3. `review_queue` and `review_decisions`
4. `watchlists` and `watchlist_companies`

The current static build deliberately stops before this migration because the hosted database and server route are not yet wired. The schema contract is stable and the front-end already has a clear fallback state.
