RpcElixir (elixir_ts_rpc v0.0.1)

Copy Markdown View Source

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:

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 @spec declarations via Code.Typespec.fetch_specs/1.

  • RpcElixir.Types.FromInferred (experimental) reads signatures inferred by Elixir's set-theoretic type system from the ExCk BEAM chunk. Lossy by design and depends on private compiler internals that change every minor release. To use it, enable inference in your own mix.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

call(router, path, input, ctx \\ %Context{})

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.