Elixir server-side library for elixir-ts-rpc — a typed RPC layer between Elixir servers and TypeScript clients.
Status
Early release (0.0.1), pre-1.0 — APIs may change between minor versions.
The full HTTP/Plug RPC stack has landed:
RpcElixir.Context/RpcElixir.Resolution— request-scoped context and result wrapper threaded through middleware into proceduresRpcElixir.Types.FromSpec— BEAM-reading type sourceRpcElixir.Router/RpcElixir.Handler— procedure registration and compile-time@specvalidationRpcElixir.Dispatcher/RpcElixir.Plug— the lookup → validate → invoke → validate → serialize HTTP pipelineRpcElixir.Middleware— request-scoped middleware frameworkRpcElixir.CustomType/RpcElixir.UnixMillis— user-defined and branded wire types- TypeScript codegen via the
mix rpc.gen.tstask and the:elixir_ts_rpccompiler
Realtime transports (SSE, Phoenix Channels) are not built yet.
Type sources
Procedure types come from a compiled module's BEAM debug info — no compile-time macro is required. Two backends are available:
RpcElixir.Types.FromSpec(recommended) reads classic@specdeclarations viaCode.Typespec.fetch_specs/1.RpcElixir.Types.FromInferred(experimental) reads signatures inferred by Elixir's set-theoretic type system from theExCkBEAM chunk. Lossy by design and depends on private compiler internals that change every minor release. To use it, enable inference in your ownmix.exs:defmodule MyApp.MixProject do use Mix.Project Code.compiler_options(infer_signatures: true) def project, do: [...] end
See the README and the supported-types guide for details on
inline shorthand, @spec AST forms, Ecto field mappings, and custom types.
Summary
Functions
In-process convenience caller for tests and server-to-server invocations.
Functions
@spec call(module(), String.t(), map(), RpcElixir.Context.t()) :: RpcElixir.Dispatcher.result()
In-process convenience caller for tests and server-to-server invocations.
Builds a minimal %Resolution{} from path and ctx, dispatches it, and
returns the resolution's :result.