Docs

Nifra vs. other frameworks

Honest comparison. Nifra is a full-stack framework first - five UI libraries and five runtimes from one core, with loaders, actions, streaming, and a typed data layer - and a standalone typed backend you can use on its own. Here is where each tool fits.

Nifra's lane

Every other full-stack framework here is built around one UI library (TanStack Start supports three), and most reach other hosts through adapters. Nifra bets on the other axis: one core, five front-ends, many runtimes, with a contract-first typed backend in the same project.

FrameworkUI librariesRuntimes
NifraReact · Preact · Vue · Solid · SvelteBun · Node · Deno · Workers · Edge
Next.jsReactNode · Edge runtime · adapters
Nuxt 4VueNitro (many)
SvelteKitSvelteadapters
React Router 8 (Remix)Reactadapters
TanStack StartReact · Solid · VueNitro · host plugins

Full-stack parity

Across the board, Nifra ships the modern full-stack feature set on all five UI frameworks:

  • File routing (dynamic / catch-all / groups / optional) + nested layouts, typed search params, and a route opened in a modal.
  • SSR · SSG · ISR, streaming SSR with out-of-order Suspense, partial prerendering, view transitions, and a ~0 KB-client vanilla adapter with islands and slot swaps.
  • Loaders + actions + server functions (typed serverFn RPC, server code never shipped to the browser) + progressive-enhancement forms; defer() / <Await> streaming data; query cache, optimistic UI, concurrent fetchers, revalidation.
  • Live refresh (a publish reloads only the loaders that read the changed keys) and keep-alive pages (back and forward bring the same page back, state and scroll included).
  • Head/meta, hover/focus prefetch, scroll restoration.
  • First-party auth, i18n, image, uploads - plus content collections + MDX, font optimization, and draft / preview mode.

The data model (loaders, actions, defer, progressive enhancement, fetchers, revalidation) is closest to Remix / React Router - delivered across five UI libraries instead of one.

Server code and server-only views

Nifra provides typed loaders and actions, streaming SSR, islands and typed server functions. Server functions keep their implementation, secrets and database handles off the browser and use the same validated mutation API across the supported UI libraries.

The optional server-components pipeline adds server-only views and state-preserving refresh, but the render protocol depends on the UI library. React uses native RSC/Flight. In Nifra's current certified adapters, Vue, Svelte, Solid 1.x and Preact use an owned server-rendered range with schema-checked JSON props and explicitly registered client islands as separate native roots; they do not emulate Flight. Nested ranges, slots and data crossing those roots are explicit. Solid 2 has its own experimental server-component frames protocol, but Nifra's current Solid tuple does not target it. The shared certification covers admission, ownership, prop validation, limits and safe hydration - it does not mean identical React component semantics. A partially prerendered page can show a server component in a hole. Server functions remain the mutation API; native React "use server" actions are unsupported.

Caching and fresh data

SSG and ISR cover pages that change rarely. Three more tools cover the pages that do not:

  • Partial prerendering (all five adapters). The part of a page that is the same for every visitor is built once, cached and sent at once; each per-visitor hole streams into it as its own loader settles. The build refuses a shell whose code reaches a module that reads the visitor, and checkShellCanaries looks for visitor data in a served shell. A shared hole, such as a price, is cached on its own schedule and tags. Next.js offers the same model for React as partial prerendering under Cache Components.
  • Live refresh. A loader names the keys its data read with live(...keys); a publish, or an action's revalidate(paths, data, { keys }), reloads only those loaders on every open tab that read them, through the hooks, middleware, gates and loaders a navigation runs. One WebSocket per tab carries opaque change tags, never data. Query hooks can refetch on the same keys. A Redis Streams bus spans processes, and on Workers a hibernating Durable Object holds the sockets.
  • Tag purges in one order. An action's revalidate(paths, data, { tags, keys }) clears data caches, then the page store, then live pages, then the CDN, before it answers, so the visitor who wrote reads the write. A page store shared between processes is signed.
  • Keep-alive (all five adapters). export const keepAlive = true keeps a page mounted after the visitor leaves it; back and forward bring it back with its state, scroll and focus.

Also a standalone backend (vs. Hono & Elysia)

Nifra's core is a Bun-native, Web-standard server, so it stands on its own as an API - and graduates to full-stack later without a rewrite.

  • Throughput - the realistic case. Router micro-benchmarks flatter Hono (a single compiled regex), but a real request also pays for middleware and validation, context, and serialization. In the current matrix Nifra runs level with Elysia on Bun - 100% of Elysia on GET /users/:id and 100% on the validated POST - and level with Fastify on Node (104% of Fastify on GET, 104% on the validated POST), with Elysia, Hono, and Express behind. On Deno it runs at 106% of Elysia on GET and 130% on the validated POST. In the realistic shape (security headers + CORS + bearer auth + cookies + validated query/body + a ~2.4 KB JSON response, measured on Bun with oha) Nifra runs at 111% of Elysia on GET and 113% on POST. Treat benchmark rows as same-run evidence, not a permanent law of nature.
  • End-to-end types. client<typeof app>() derives request inputs and res.data from the route contracts - the compiler catches frontend/backend drift. Hono's hc and Elysia's Eden are typed too, but backend-only - no full-stack page/loader story.
  • Validation + OpenAPI. Any Standard Schema plus t (TypeBox - free JSON Schema), emitting a real 3.1 doc with field-level request/response schemas (+ Scalar UI).
  • Batteries. @nifrajs/better-auth + session guards, @nifrajs/otel (W3C traceparent, OTel semantic conventions), and create-nifra scaffolding (framework × deploy × CI × DB × auth, with an AGENTS.md).

Run it yourself: bun run bench:realworld and bun run bench:http:compare.

The AI-agent toolchain

Agent tooling is no longer rare: Next.js 16 serves a dev-server MCP endpoint, and Svelte publishes an MCP server for its docs. Nifra covers both sides of the agent loop: agents that edit your codebase and agents that are part of the product. Every surface is anchored to the same typed capability boundary:

  • nifra mcp - an MCP server exposing nifra_context (the project's typed surface), nifra_example (snippets typechecked against the installed version - no hallucinated APIs), nifra_scaffold (URL → correct routes/ file), nifra_run (verify via HTTP), and nifra_check (a drift gate that returns the fix). One MCP, two transports: the docs tools are also hosted at mcp.nifra.dev (no checkout needed), while the project tools run only on your machine - your code never leaves it.
  • llms.txt + llms-full.txt served at the site root, an AGENTS.md in every scaffold, and a docs corpus that can't drift from the code.
  • nifra assure + nifra levels - a route-assurance gate: a policy file classifies every reflected route and CI fails naming exactly which evidence is missing (authentication on writes, validation, declared effects). Spectral lints the OpenAPI document and Semgrep pattern-matches source text; neither sees the real route graph. This is what makes agent-written routes safe to merge - an agent (or a human) cannot ship an unauthenticated write past it.
  • @nifrajs/webmcp - explicit page-local tools using the browser WebMCP standard, deterministic predictive UI, bounded receipts, and versioned reconciliation. @nifrajs/ag-ui streams the same run into a product UI, while @nifrajs/agent-app provides negotiated browser views, approvals, handoffs, and Run Studio projections.
  • @nifrajs/agent - bounded typed agent turns with budgets, approvals, cancellation, resumable evidence, shared state, and provider-neutral model ports. @nifrajs/a2a exposes the same runner to other agents without rewriting the core.

Where Nifra fits

Reach for Nifra when you want:

  • One codebase, every front-end + runtime - ship the same app on React, Vue, Solid, Svelte, or Preact, running on Bun, Node, Deno, and the edge, with no rewrite to switch either.
  • A type-locked stack - the typed client derives requests and res.data from your route contracts, so the compiler catches any frontend/backend drift.
  • The full modern toolkit on your UI of choice - loaders, actions, streaming SSR with out-of-order Suspense, SSG/ISR, partial prerendering, live refresh, keep-alive, server components, islands, query cache, progressive-enhancement forms.
  • A framework AI agents edit accurately - the nifra mcp toolchain, version-checked examples, and gates that name the fix when a change drifts from the contract.
  • To start lean and grow - begin as a typed API, graduate to full-stack on the same core, no rewrite.