GraphQL gateway generated from an OpenAPI contract using GraphQL Mesh Compose and served by Hive Gateway.
This repository is focused on a simple, explicit flow:
swagger-spec.jsonis the source of truth for REST operations.mesh.config.tscomposes that contract intosupergraph.graphql.gateway.config.tsserves the supergraph and applies runtime concerns (headers, endpoints, OpenTelemetry).
Client -> /graphql (Hive Gateway)
-> supergraph.graphql (generated by mesh-compose)
-> EdgeAPI subgraph (REST transport)
-> EDGE upstream base URL
| Path | Purpose |
|---|---|
swagger-spec.json |
OpenAPI contract (source of truth) |
mesh.config.ts |
Mesh Compose config using @omnigraph/openapi |
supergraph.graphql |
Generated federation artifact (do not hand-edit) |
gateway.config.ts |
Hive Gateway runtime config (headers, endpoints, OTel) |
docs/project-capabilities.md |
Current capability map and where to make changes |
tests/openapi.spec.js |
Guardrails for OpenAPI/gateway wiring |
.github/workflows/ |
CI, deployment, and spec-sync automation |
.github/skills/ |
Local reusable skills for doc-driven agent workflows |
AGENT.md |
Agent-agnostic operating guide for contributors/assistants |
- Node.js
24.15.0(from.nvmrc) - npm
- Copy environment template:
cp .env.example .env
- Set at least:
EDGE(upstream REST base URL)
- Install dependencies:
npm ci
- Build supergraph:
npm run build
- Start gateway:
npm run dev
npm run dev— composesupergraph.graphqland start Hive Gatewaynpm run start— same as dev (production runtime entry)npm run build— compose supergraph onlynpm run lint— ESLintnpm run typecheck— TypeScript checksnpm test— Node test runner (tests/**/*.js)
When changing API surface area:
- Edit
swagger-spec.json. - Recompose:
npm run build. - Inspect
supergraph.graphqldiff. - Validate runtime configuration in
gateway.config.ts(headers, endpoints, tracing). - Run verification:
npm run lintnpm run typechecknpm test
supergraph.graphqlis generated output. Always modify source files, then regenerate.
Current REST paths and their generated Query fields:
| REST path | Method | GraphQL Query field |
|---|---|---|
/v1/config |
GET | config |
/v1/news/feed |
GET | newsFeed |
/v1/news |
GET | news |
/v1/episodes |
GET | episodes |
/v1/series |
GET | series |
/v1/studios |
GET | studio |
/v1/people |
GET | person |
/v1/characters |
GET | character |
/v1 |
GET | index |
- Uses
loadOpenAPISubgraph('EdgeAPI', ...) - Reads
EDGEfrom env - Loads
swagger-spec.json
- Serves
./supergraph.graphql - Custom transport header forwarding for
EdgeAPI - Health/readiness endpoints
- GraphiQL toggle via env
- OpenTelemetry bootstrap + graceful shutdown
Detailed plan: docs/otel-enrichment-plan.md
Current state:
- Node SDK initialized when OTLP endpoint(s) are present
- Supports traces, metrics, and logs over OTLP HTTP
openTelemetry.tracesenabled in Hive Gateway- Graceful shutdown flushes SDK on
SIGINT/SIGTERM - Telemetry bootstrap is centralized in
telemetry.tswith env-driven signal toggles and batch controls
Phase 1 tuning knobs (examples):
OTEL_TRACES_ENABLED,OTEL_METRICS_ENABLED,OTEL_LOGS_ENABLEDOTEL_SERVICE_NAME(service version auto-resolves frompackage.json; override withOTEL_SERVICE_VERSIONonly when needed)OTEL_METRIC_EXPORT_INTERVAL,OTEL_METRIC_EXPORT_TIMEOUTOTEL_BSP_MAX_QUEUE_SIZE,OTEL_BSP_MAX_EXPORT_BATCH_SIZE,OTEL_BSP_SCHEDULE_DELAY,OTEL_BSP_EXPORT_TIMEOUT
Recommended enrichment plan:
- Trace quality controls
- Add configurable sampling strategy (ratio/env-based)
- Tune batching/export intervals for your collector latency profile
- Span signal quality
- Add targeted custom spans around upstream fetch behavior and auth/header propagation decisions
- Add selective span filters to reduce noise from low-value operations
- Correlation + diagnostics
- Enforce request ID/log correlation and include selected context attributes
- Enable OTEL diagnostics (
OTEL_LOG_LEVEL) only for debug windows
- Operational baselines
- Define latency/error SLO dashboards and alert thresholds tied to generated spans
Build image:
docker build -t edge-graphql:local .
Run container:
docker run --rm -p 8800:8800 --env EDGE=http://host.docker.internal:9800 edge-graphql:local
ci.yml: lint, typecheck, tests, build matrixquality.yml: dependency audit/outdated checksapi-spec-gen.yml: syncsswagger-spec.jsonfrom release artifacts via PRdeploy.yml: builds/pushes multi-arch GHCR image
- GraphQL:
POST /graphql - Health:
/health - Readiness:
/ready