{
  "markdown": "<p align=\"center\">\n  <a href=\"https://nifra.dev\"><img src=\"site/public/logo-mark.png\" alt=\"Nifra\" width=\"88\"></a>\n</p>\n\n<h1 align=\"center\">Nifra</h1>\n\n<p align=\"center\"><b>The AI-native TypeScript framework.</b><br>\nTyped APIs and full-stack SSR on five UI libraries, one app across Bun, Node, Deno, and the edge -<br>\nbuilt so both humans and coding agents can change it safely.</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@nifrajs/core\"><img src=\"https://img.shields.io/npm/v/@nifrajs/core?label=npm\" alt=\"npm\"></a>\n  <a href=\"https://www.npmjs.com/package/@nifrajs/core\"><img src=\"https://img.shields.io/npm/dm/@nifrajs/core?label=downloads\" alt=\"downloads\"></a>\n  <a href=\"https://github.com/nifrajs/nifra/actions/workflows/ci.yml\"><img src=\"https://github.com/nifrajs/nifra/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"></a>\n  <a href=\"https://bun.sh\"><img src=\"https://img.shields.io/badge/Bun-%3E%3D1.3-000?logo=bun\" alt=\"Bun >= 1.3\"></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"MIT\"></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://nifra.dev/docs\">Documentation</a> ·\n  <a href=\"https://nifra.dev/play\">Playground</a> ·\n  <a href=\"https://nifra.dev/benchmarks\">Benchmarks</a> ·\n  <a href=\"https://nifra.dev/docs/comparison\">vs. other frameworks</a>\n</p>\n\n---\n\nMost code is now written with an AI agent in the loop - and agents drift. They call an endpoint that moved, expect a response shape that changed, or hand-roll `fetch` with types that rot. Nifra removes that class of bug at the framework level: the client is inferred from the server's TypeScript (drift is a compile error), the docs are a live MCP server (agents read the real API, not stale memory), and a route-assurance gate fails the build when any route - human- or agent-written - ships without its required security evidence.\n\n## Quick start\n\n```sh\nbun create nifra my-app            # full-stack app: pick framework, runtime, DB, auth, CI\n```\n\nor start with just a typed API:\n\n```sh\nbun add @nifrajs/core @nifrajs/schema @nifrajs/client\n```\n\n## The core loop\n\nRoutes are typed automatically from their path literals, handler context, and return values. Add a\nStandard Schema when you need runtime validation/coercion or an explicit request/response contract:\n\n```ts\n// server.ts\nimport { server } from \"@nifrajs/core/server\"\nimport { t } from \"@nifrajs/schema\"\n\nexport const app = server()\n  .get(\"/users/:id\", (c) => ({ id: c.params.id })) // params + response inferred from the route\n  .post(\"/users\", { body: t.object({ name: t.string() }) }, (c) => {\n    // c.body is validated + typed - invalid input is a structured 422 before this runs\n    return { id: crypto.randomUUID(), name: c.body.name }\n  })\n  .listen(3000)\n```\n\n```ts\n// anywhere.ts - fully typed from the server, zero codegen\nimport { client } from \"@nifrajs/client\"\nimport type { app } from \"./server\"\n\nconst api = client<typeof app>(\"http://localhost:3000\")\n\nconst res = await api.users({ id: \"42\" }).get()\nif (res.ok) res.data.id     // typed from the route - tsc fails the moment the route changes\nelse res.error              // failures are returned, never thrown\n```\n\nChange a route and every caller stops compiling until it's updated. That one property is what keeps agent-edited codebases correct. For a decoupled, versionable surface, use [`defineContract` + `implement`](https://nifra.dev/docs/contract).\n\n## Agent-native, by construction\n\nRegister the MCP server and any coding agent reads your live routes, fetches version-checked examples, runs real requests against the app it just edited, and gates its own drift:\n\n```sh\nclaude mcp add nifra -- bunx nifra mcp     # Claude Code (Cursor/VS Code: same command in mcp.json)\nnifra init-agents                          # or: write .mcp.json + AGENTS.md + CLAUDE.md for you\n```\n\nThe loop covers live project context and routes, verified docs/examples/types, checks with structured\nfixes, real requests and SSR renders, request inspection, tests, assurance, and verification levels.\n`nifra_context` and `nifra_example` are version-aware; `nifra_run`, `nifra_render`, and\n`nifra_inspect` verify what the edited app actually does; `nifra_check` and `nifra_assure` close the\ndrift and security gates. [Full tool list →](https://nifra.dev/docs/agents)\n\nAgents that read skills get the conventions too - the same four skills on every surface:\n\n```sh\npi install npm:@nifrajs/skills                                     # Pi\n/plugin marketplace add nifrajs/nifra && /plugin install nifra@nifra  # Claude Code\n```\n\nNot in a Nifra repo? The docs tools are also hosted - add `https://mcp.nifra.dev` to Claude, Cursor, or ChatGPT and it learns Nifra from the same verified corpora, no checkout. One MCP, two transports (the same hosted-plus-local pairing Supabase, Stripe, and GitHub use): project tools run only on your machine over stdio - **your code never reaches our servers**.\n\n### Build and host agents\n\nThe same public contracts also cover applications that are agent products:\n\n| Use case | Packages | What it provides |\n|---|---|---|\n| Bounded agent turns | [agent](packages/agent) | Typed tools, budgets, approvals, resumable token-only evidence, token streaming, and shared run state. Model, storage, and policy stay injected ports. |\n| Coding-agent host | [coding-agent](packages/coding-agent) · [agent-protocol](packages/agent-protocol) · [pi](packages/pi) | A standalone nifra-agent host with sessions, workflows, extensions, post-turn verification with bounded automatic repair, native approval events/resolution, local RPC, and an optional Pi backend. |\n| Browser and desktop UI | [agent-app](packages/agent-app) · [runner](packages/runner) · [apps/workbench](apps/workbench) | Content-free negotiated views, ordered/resumable event handling, capability registry, decision inbox, Run Studio projections, and structured in-process request runs. |\n| Protocol bridges | [a2a](packages/a2a) · [ag-ui](packages/ag-ui) | A2A 1.0 JSON-RPC/SSE and AG-UI SSE endpoints over the same agent runner, including typed human-in-the-loop resume. |\n| Observability and skills | [agent-telemetry](packages/agent-telemetry) · [skills](packages/skills) | Token-only OpenTelemetry run traces and portable skills that keep agents pointed at the live MCP contract. |\n\n   bun add @nifrajs/coding-agent @nifrajs/pi\n    bunx nifra-agent --backend pi --message \"run the checks and explain failures\" \\\n      --verify-after-turn check --max-repair-attempts 2\n\nProvider credentials, durable state, authorization, and approval policy are application ports rather\nthan hidden framework state. The local process adapter contains crashes and accidents but is **not** a\nhostile-code sandbox; use OS-level isolation for untrusted code. A2A and AG-UI mounts likewise require\nthe host application to add authentication and authorization at its route boundary.\n\n## Proof, not promises\n\nThree CI gates turn security posture into build failures:\n\n```sh\n$ nifra assure\n✖ POST /notes (authenticated-write) is missing nifra.authenticated\n```\n\n- **`nifra assure`** - a policy file classifies every route by reflection and fails CI naming exactly what evidence is missing: authentication on a write, a rate limit, CSRF, a body cap. No other framework ships this.\n- **`nifra capabilities check`** - routes declare effect tokens (`{ capabilities: [\"db.write\"] }`); the check compares what a route *says* against what its module graph can actually *reach*, pinned in a lockfile. A `GET` that can reach a domain write is an error.\n- **`nifra manifest diff`** - one hash-verified artifact of contracts + assurance + effects + response sensitivity; deploy promotion fails closed on breaking contracts, lost assurance, or newly exposed sensitive fields.\n\n[Security & hardening →](https://nifra.dev/docs/security) · [Effect provenance →](https://nifra.dev/docs/capabilities) · [Verification ladder →](https://nifra.dev/docs/verification)\n\n## Full-stack, five UI libraries\n\nThe same routes, loaders, actions, streaming SSR, `defer()`/`<Await>` progressive rendering, islands,\nand typed data layer work on **React, Vue, Solid, Svelte, or Preact** - switching is one adapter\nimport, not a rewrite. File routing, SSG/ISR, progressive-enhancement forms, query cache, and server\nfunctions whose bodies never ship to the browser.\n\n```sh\nbun create nifra my-app --framework svelte   # or react | vue | solid | preact\n```\n\n[Frameworks →](https://nifra.dev/docs/frameworks) · [Rendering →](https://nifra.dev/docs/rendering) · [Server functions →](https://nifra.dev/docs/server-functions)\n\n## StyleX and Tailwind migration\n\nNifra includes a conservative Tailwind → StyleX codemod for static JSX class lists:\n\n```sh\nnifra migrate --from tailwind --to stylex          # inspect the proposed changes\nnifra migrate --from tailwind --to stylex --write  # apply safe changes\n```\n\nThe codemod rewrites supported `className=\"...\"` attributes to `stylex.props(...)` and a local\n`stylex.create(...)` table. It understands responsive breakpoints and element-local pseudo-classes.\nDynamic class expressions, arbitrary values, parent-dependent variants, and unknown utilities are\nleft untouched with file/line diagnostics for manual review. Use `--dir <path>` to scan a subdirectory.\n\nStyleX compilation is built into Nifra's Bun pipeline. Install the runtime and optional compiler peers,\nthen register both browser and SSR transforms in `nifra.config.ts`:\n\n```sh\nbun add @stylexjs/stylex\nbun add -d @babel/core @stylexjs/babel-plugin @babel/plugin-syntax-flow \\\n  @babel/plugin-syntax-jsx @babel/plugin-syntax-typescript\n```\n\n```ts\nimport { stylexBunPlugin } from \"@nifrajs/web/plugins/stylex\"\n\nexport const clientPlugins = [stylexBunPlugin(\"dom\")]\nexport const serverPlugins = [stylexBunPlugin(\"ssr\")]\n```\n\nThe same adapter also exposes `stylexVite()` for projects whose transforms intentionally run through\nVite. See the [StyleX migration guide](https://nifra.dev/docs/cli#tailwind-to-stylex) for the complete\nsetup and supported-syntax details.\n\n## One app, every runtime\n\nThe whole lifecycle is `app.fetch(Request): Promise<Response>` - Bun first-class, and the same app deploys to Node (`@nifrajs/node`), Deno, Cloudflare Workers, and Vercel Edge with one line of adapter code. [Deployment →](https://nifra.dev/docs/deployment)\n\nMeasured, published, reproducible ([methodology + every row, including the ones we lose](https://nifra.dev/benchmarks)):\n\n- **Bun:** ~131k req/s - 101% of the raw-runtime ceiling, level-to-ahead of Elysia\n- **Node:** ahead of Fastify by ~12% on the validated POST (96% of the raw-Node ceiling), tie on GET\n- **SSR:** React rendered per-request at ~25x Next.js throughput on the same machine\n\nRun it yourself: `bun run bench:http` · `bun run bench:ssr`\n\n## Batteries (53 packages, all typed, all optional)\n\n| | |\n|---|---|\n| Core | [`core`](packages/core) router + server · [`client`](packages/client) typed client · [`schema`](packages/schema) validation + OpenAPI · [`middleware`](packages/middleware) CORS/headers/rate-limit |\n| Full-stack | [`web`](packages/web) SSR core · `web-react` / `web-vue` / `web-solid` / `web-svelte` / `web-preact` adapters |\n| App services | [`auth`](packages/auth) · [`jobs`](packages/jobs) · [`cron`](packages/cron) · [`cache`](packages/cache) · [`storage`](packages/storage) · [`uploads`](packages/uploads) · [`image`](packages/image) · [`i18n`](packages/i18n) · [`env`](packages/env) · [`content`](packages/content) |\n| Quality | [`testing`](packages/testing) contract-derived tests · [`mock`](packages/mock) contract mocks · [`otel`](packages/otel) tracing · [`devtools`](packages/devtools) |\n| Agents | [`cli`](packages/cli) the `nifra` toolchain · [`mcp`](packages/mcp) build MCP servers · [`prompt`](packages/prompt) schema-validated LLM output · [`skills`](packages/skills) portable agent skills · [`runner`](packages/runner) structured app runs |\n| Agent runtime | [`agent`](packages/agent) bounded turns · [`agent-protocol`](packages/agent-protocol) versioned sessions/events · [`agent-app`](packages/agent-app) content-free browser views · [`agent-telemetry`](packages/agent-telemetry) OTel traces |\n| Agent host & protocols | [`coding-agent`](packages/coding-agent) host/CLI · [`pi`](packages/pi) Pi adapter · [`a2a`](packages/a2a) A2A bridge · [`ag-ui`](packages/ag-ui) AG-UI bridge |\n\nEvery package documents its own surface; the root stays lean and everything advanced is an opt-in subpath, so you never pay for a concept you don't import. [All packages →](https://nifra.dev/docs)\n\n## Principles (enforced, not aspirational)\n\n- **Reject invalid input at three boundaries** - compile-time, boot-time, request-time (structured `422`).\n- **Speed is a measured goal** - benchmark-regression tests; the published matrix is regenerated, not curated.\n- **Production-grade by default** - graceful shutdown, redacting logs, idempotent guards; nothing is \"we'll fix it later\".\n- **Docs cannot lie** - examples are compiled against the live API in CI; the MCP corpus regenerates from built packages.\n\n## Develop\n\n```sh\nbun install\nbun run check          # lint + typecheck (incl. type-level tests) + tests with coverage\nbun run build          # emit dist/ (js + d.ts) for all packages\nbun run bench:http     # the oha HTTP matrix across Bun/Node/Deno\n```\n\nContributions welcome - see [CONTRIBUTING.md](CONTRIBUTING.md). Upgrading from 1.x: [migration guide](https://nifra.dev/docs/migrate-2).\n\nMIT licensed.\n",
  "bytes": 13472,
  "sha": "b61546be4b8d88174722b155291fd656f5c482cd8a132abbd3e15962416b0b99",
  "repo_slug": "nifrajs/nifra",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_nifrajs_nifra_docs_3663c0c6/readme"
}