API
The Elysia HTTP API — a thin Bun runtime shell around the shared @halostack/elysia app.
apps/api is the HTTP API: an Elysia server running on the Bun runtime, listening on API_PORT (Railway's injected PORT in production, or 3000 by default). It is deliberately a thin shell. The application itself — its routes, OpenAPI surface, and the Eden client — all live in @halostack/elysia. This package's only job is to wire up runtime concerns such as observability, start listening, and drain cleanly on shutdown.
Stack
The runtime is composed from a handful of shared pieces:
- Elysia, the Bun web framework, running on the Bun runtime.
@halostack/elysia— the sharedappinstance, which carries the routes, the auth mount, and OpenAPI.@halostack/telemetry— OpenTelemetry traces, metrics, and logs, initialized viainitObservability.@halostack/env— validated configuration (API_PORT,API_HOST, and so on); never readprocess.envdirectly.
Structure
The package is just two files, each with a clear responsibility:
src/index.tsis the entry point. It boots observability, callsapp.listen(), and registersSIGINTandSIGTERMhandlers that flush telemetry before the process exits.src/instrument.tsinitializes Sentry. It is imported first inindex.tsso that it wraps everything booted afterward, and it is a no-op unlessSENTRY_ENABLEDis set. The split of responsibilities is intentional: Sentry owns error grouping, while@halostack/telemetry(OpenTelemetry) owns traces, metrics, and logs.
Running
Conventions
Keep this package thin. Route logic does not belong here — add a feature module in @halostack/elysia (under packages/elysia/src/modules/*) instead, so the Eden client stays type-synced with the API. Read all configuration through @halostack/env. The interactive OpenAPI docs are served at /openapi.