# HelixOdds — Commercial V1 Closure Plan

Five large units, not thirty mini-phases. When the Master Gate at the end passes,
V1 is closed and feature work stops.

```
8B   Client operations · health · usage
 ↓
9    BYO Provider architecture + BetsAPI
 ↓
10   Public API v1
 ↓
11   Security and production hardening
 ↓
12   Manual commercial plans
 ↓
13   Docs and release gate
 ↓
COMMERCIAL V1 — CLOSED
```

---

## 8B — Client Operations

**Done when:** an admin can understand the state of a client without opening a
JSON file or a log.

### Client Detail Page
- subscriptions view · features view · allowed origins
- token rotation · suspend / reactivate / revoke

### Health
- Engine health · Live Intelligence health · Provider health (placeholder)

### Usage counters
- API requests · successful / failed · last request
- provider calls · MarketEngine requests · Live Intelligence requests
- daily and monthly counters

### Audit history
- client actions · subscription actions · token rotation
- origin changes · feature changes

---

## 9 — Provider Platform + BYO Provider

**Done when:** a client enters their own BetsAPI token → Test Connection →
`CONNECTED` → processing is active.

This is what keeps HelixOdds from being welded to one provider.

### `provider_connections`

```
id · client_id · provider · status
credential_ciphertext · credential_hint
created_at · updated_at · verified_at · last_success_at · last_error_at
capabilities · rate_limit
```

### Status

```
UNCONFIGURED · VERIFYING · CONNECTED · DEGRADED · INVALID_CREDENTIAL · DISABLED
```

### Credential handling

- encrypted at rest
- the encryption key lives **outside** the database and the registry file
- plaintext exists only for the duration of the upstream request
- zero plaintext in logs, UI or audit entries
- the UI shows a mask or hint only

### Adapter contract

```
providers/
  betsapi/adapter.js      implemented for real in V1
  odds_api/adapter.js     interface and capability declaration only
  oddspapi/adapter.js     interface and capability declaration only
```

Other providers get the interface and the capability architecture — **not a fake
implementation.**

### Capability flags

```
prematch · live_odds · live_stats · timeline · player_events
```

---

## 10 — Public API v1

**Done when:** HelixOdds is a product another developer can integrate against.

```
GET /api/v1/status
GET /api/v1/schema

GET /api/v1/fixtures
GET /api/v1/fixtures/:id
GET /api/v1/fixtures/:id/markets
GET /api/v1/fixtures/:id/markets/:market_id

GET /api/v1/changes

GET /api/v1/live
GET /api/v1/live/:id
GET /api/v1/live/:id/timeline
GET /api/v1/live/:id/momentum

GET /api/v1/account
GET /api/v1/account/provider
GET /api/v1/account/usage
```

### Frozen contracts

```
pagination · cursor · limits · filters · timestamps · freshness
request_id · error format · rate limits · tenant isolation
```

**No endpoint returns a 700 MB snapshot.**

```
bootstrap   GET /fixtures?limit=…
updates     GET /changes?cursor=…
```

Socket.IO, when it arrives, uses the same delta contract — it is a transport,
not a second model.

---

## 11 — Security and Production Hardening

Not left to the very end, because by then we are holding client credentials.

```
tenant isolation gate      client A can never read client B
provider credential encryption gate
API rate limiting · request ids · structured logs · secret redaction
CORS / allowed_origins · payload size limits · timeouts
upstream retries · provider circuit breaker · health endpoints
backup/restore registry test · startup integrity check · graceful shutdown
```

### The secret-leakage gate

```
SEARCH   token · secret · authorization · api_key · credential
ASSERT   no plaintext credential in logs, responses, audit entries or exceptions
```

---

## 12 — Commercial V1 (manual)

Kept minimal on purpose, so billing does not eat a month.

### Plans

```
Engine · Live Intelligence · Engine + Live
```

### Admin can

create client · activate product · set expiry · extend subscription ·
enable add-ons · suspend · revoke

### Client sees

current plan · products · features · `expires_at` · provider status · usage ·
API credentials · docs link

Invoices and a crypto watcher are **not blockers for the first client.** The
first payment is taken manually and the subscription activated from the admin
panel. Crypto automation comes after the first client, not before launch.

---

## 13 — Developer Experience and Release

```
OpenAPI v1 · Integration Quickstart · Provider Setup Guide
Authentication Guide · Errors Reference · Market Schema Reference
Live Intelligence Guide

examples: curl · Node · Python · PHP · C#
```

### Domains

```
api.helixodds.com
app.helixodds.com
docs.helixodds.com
status.helixodds.com
```

The product name, URLs and support address come from **one** configuration
module, never hardcoded across twenty files — see `branding.js`.

---

## MASTER COMMERCIAL V1 GATE

One end-to-end proof. When it passes, V1 is closed.

```
create client
→ activate subscription
→ connect BetsAPI
→ authenticate
→ discover fixtures
→ process markets
→ call Public API
→ call Live Intelligence
→ usage increments
→ tenant isolation holds
→ expire subscription
→ premium access disappears
→ renew subscription
→ access returns
→ rotate client token
→ old token rejected
→ new token works
→ provider credential unchanged
→ zero secret leakage
```

---

## Explicitly out of scope before Commercial V1

Backlog, not refusals:

```
multiple providers simultaneously · automatic provider fallback
provider blending · automated crypto billing · SDK packages
webhooks · Socket.IO in production · advanced analytics packages
reseller accounts · teams / multiple users per client
full billing portal · marketing automation
```

---

## Already closed, built on by the above

| | |
|---|---|
| Client registry, subscriptions, entitlements | schema v3, English, frozen |
| Hourly recovery + large-data I/O | `CLOSED + FREEZE` |
| Admin and client panels | English, loopback + password |
| Legacy name containment | gate-enforced |
