API Reference elixir_ts_rpc v#0.0.1

Copy Markdown View Source

Modules

Elixir server-side library for elixir-ts-rpc — a typed RPC layer between Elixir servers and TypeScript clients.

Generates TypeScript type definitions directly from an RPC router.

Request-scoped context threaded through middleware and into handlers.

Escape hatch for teaching elixir-ts-rpc how to handle custom or third-party types.

Core dispatch pipeline: lookup → middleware → validate input → invoke handler → validate output → serialize.

Captures @spec and @type ASTs at handler-compile time and exposes them via __rpc_specs__/0 / __rpc_types__/0 accessors.

Behaviour for procedure middleware.

Built-in middleware that puts static values into ctx.assigns.

HTTP transport adapter for RpcElixir implemented as a Plug.

Envelope threaded through the middleware pipeline for a single procedure invocation. Middleware receive and return a %Resolution{}.

Macro-based DSL for defining RPC procedures in a router module.

Structured error returned from the dispatcher pipeline.

Type system for RPC procedure input/output specs.

EXPERIMENTAL backend that reads signatures inferred by Elixir's set-theoretic type system from the ExCk BEAM chunk, instead of user-written @spec.

Reads classic @spec declarations from a compiled module's BEAM debug info (via Code.Typespec) and translates them into the internal %{kind: ...} representation used by handlers, routers, and codegen.

Built-in branded-number custom type: a DateTime crossing the wire as epoch milliseconds. Emits the TypeScript brand EpochMillis (a number & { readonly __brand: "EpochMillis" }), so callers can't accidentally pass a bare number where an instant is expected.

Dev-only GenServer that watches every source file contributing to an RPC router — the router module itself and every handler module — and triggers recompilation when one of them changes.

Mix Tasks

Mix compiler that regenerates the TypeScript client after Elixir recompiles.

Generates a TypeScript client file directly from an RPC router module.

Watches Elixir sources and regenerates the TypeScript client on every change.