nazar-studio

Balaur REST API gateway

The first gateway surface is a tiny Bun-native REST API over Balaur’s runtime gateway contract.

It is deliberately basic:

Run it with:

bun run api

Optional environment variables (or values loaded from .env):

BALAUR_API_HOST=127.0.0.1
BALAUR_API_PORT=8787

Endpoints:

GET /health
POST /api/messages
content-type: application/json

{ "clientId": "local", "text": "hello" }

Returns 202 { "ok": true } after the message has been queued for the runtime bus. Poll /api/events for output.

GET /api/events?clientId=local&after=0

Returns buffered runtime output for that client:

{
  "ok": true,
  "events": [
    { "id": 1, "sourceId": "local", "kind": "outbound", "text": "..." }
  ]
}

Keep it loopback-only unless there is an explicit auth and threat model.