mock-helix
A local HTTP service that impersonates the Helix public API. Same endpoints, same OAuth flow, same JSON shapes — backed by an in-memory store instead of the real Helix database. Build and test integrations without touching production or needing credentials.
Every run starts from the same in-memory fixtures: brands, categories, terminals, products, inventory. Tests are deterministic.
Implements the OpenAPI contract at openapi/helix-sandbox.yaml. Code written against the mock works against real Helix.
Tokens are stored in a Map, nothing is persisted, and writes are gated by an env flag. Local dev / CI only.
Three ways to run it. Pick one.
From the helix-toolkit repo root. Also starts the sample app.
Confirm it's up:
The mock speaks OAuth2 client-credentials. Exchange a client id for a Bearer token, then call /api/v1/* with it.
Tokens live in memory for the lifetime of the process. Restart the server and existing tokens stop working.
All /api/v1/* paths require a Bearer token.
| Method | Path | Description |
|---|---|---|
| GET | /health | Liveness (unauthenticated) |
| GET | /.well-known/helix-sandbox | Issuer, token endpoint, API base |
| POST | /oauth/token | client_credentials or authorization_code |
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/me | Current principal |
| GET | /api/v1/tenant | Tenant summary |
| GET | /api/v1/integrations | Paginated list (limit, cursor) |
| GET | /api/v1/integrations/{id} | Single integration |
| POST | /api/v1/integrations | Create (gated โ see Writes) |
| GET | /api/v1/ping | Authenticated ping |
| POST | /api/v1/echo | Echoes JSON body |
The surface that embedded iframe apps call via helix.apiGet(...). The SDK prefixes /api automatically — you pass /stores, the request hits /api/stores on the mock.
| Method | Path | Description |
|---|---|---|
| GET | /api/stores | List stores |
| GET | /api/store_stats | Store sales, transactions, labor (filter ?store_id=) |
| GET | /api/store_stats/transactions | Transaction rows (filter ?store_id=) |
| GET | /api/kra/day_data | KRA daily metrics (filter ?store_id=, ?date=) |
| GET | /api/kra/stores | Active stores for KRA dashboards |
| GET | /api/kra/blocks | KRA data-block definitions |
| GET | /api/kra/transactions | KRA-filtered transactions |
| GET | /api/employee_stats | Per-employee performance (filter ?store_id=) |
| GET | /api/distribution_products | Distribution product catalog |
| GET | /api/idr_reports | IDR report data |
| GET | /api/auth/authenticate | Current user info and roles |
Mirrors Blaze partner /store/inventory/... under the blaze namespace so Blaze client code works unchanged.
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/blaze/inventory/brands | List brands |
| GET | /api/v1/blaze/inventory/categories | List categories |
| GET | /api/v1/blaze/inventory/inventories | Stock rows (product ร terminal) |
| GET | /api/v1/blaze/inventory/products | List products |
| GET | /api/v1/blaze/inventory/products/{productId} | Product by id |
| GET | /api/v1/blaze/inventory/products/dates | Products where modified_at > ?modified_after= |
| GET | /api/v1/blaze/inventory/products/terminals/{terminalId} | Products at a terminal with on-hand quantity |
| GET | /api/v1/blaze/inventory/sku/{sku} | Product by SKU with per-terminal quantities |
| GET | /api/v1/blaze/inventory/terminals | List terminals |
Each tenant gets the same fixtures on first request. Writes persist in-memory for the process lifetime.
| Variable | Default | Purpose |
|---|---|---|
| HELIX_MOCK_PORT | 47100 | HTTP listen port |
| MOCK_TENANT_ID | tenant-sandbox-001 | Tenant id stamped onto issued tokens |
| HELIX_MOCK_ALLOW_WRITE | (unset) | Set to 1 to allow POST /api/v1/integrations. Otherwise returns 403 write_forbidden. |
By default, write endpoints return 403 write_forbidden — the same error shape real Helix sends when your integration lacks the scope. This catches scope mistakes early.
You don't have to hand-craft requests. The toolkit ships clients that point at the mock by default.
Expose the mock as tools to Claude, Cursor, or any MCP-aware agent. Set HELIX_API_BASE_URL to the mock's URL and the MCP wraps every endpoint as a tool.
The full contract lives at helix-toolkit/openapi/helix-sandbox.yaml. Feed it to code generators, Postman, or the MCP server (exposed as resource helix://sandbox/openapi.yaml).