@nifrajs/client
A browser-safe, end-to-end-typed client for nifra servers — an Eden-style proxy that never throws.
bun add @nifrajs/clientimport { client } from "@nifrajs/client"
import type { App } from "./server" // `typeof app` from @nifrajs/core
const api = client<App>("http://localhost:3000")
const { ok, status, data, error } = await api.users({ id: "42" }).get()
// ^? typed from the server route- Zero codegen. Types flow from
typeof app(coupled) — or from a contract viaclient(contract, url)(decoupled), with no dependency on the server's source. - Proxy chaining. Path segments are properties,
:paramsare calls, verbs are methods:api.users({ id }).posts({ postId }).get(). The root isapi.index. - Result, never exceptions. Every call resolves to
{ ok, status, data, error }, so the failure path is in the types. Bodies are positional (api.users.post({ name })); pass{ query, headers, signal }as call options. - Environment-agnostic. No Bun/Node APIs — runs in the browser, workers, or any
runtime with
fetch.
ESM-only. MIT.
For AI agents
Start with LLM.md — this package's contract card (the exports you call + its footguns),
one cheap read instead of the whole corpus. For the wider framework: the repo's
AGENTS.md is the copy-paste quick reference, and
llms-full.txt is the full machine-readable corpus. Run nifra check as the
done-gate, or nifra mcp to give the agent live project tools.