Skip to content
Farm.js 0.2 is outRead the post

Why build on Farm.js. One app for people and their agents.

Your app has a new kind of user. Farm.js gives people, agents, and native screens the same routes, server functions, auth, and deploy, and it stays fast where you wait.

In this article 10 sections

Why build on Farm.js. One app for people and their agents.

KinfeMichael Tariku · Dec 2026

Most teams now ship a web app, an agent, and sooner or later a phone or desktop app. Each gets its own server, auth, and deploy, and they drift apart.

Farm.js is one framework for all three. People, agents, and native screens call the same functions, pass the same auth check, and ship in the same build.

The short version

  • Your agent ships with your app. An agent is a file in src/agents, and a server function with an mcp name is also an MCP tool.
  • Every page answers agents. Ask any page for Markdown and you get Markdown.
  • Fast where you wait. First dev page in 272 ms and a build in 589 ms. Next.js: 1.44 s and 2.48 s.
  • Less JavaScript. Islands load 27.6 KB where React Server Components load 71.0 KB.
  • Your renderer, your language. Five renderers for pages, four languages for API routes.
  • Every screen. Web, desktop, and native mobile from one codebase.
  • Any host. Vercel, Cloudflare, Netlify, Node, Bun, and more.

Your agent ships with your app

Give a server function an mcp name and it's a tool too:

TypeScript
// src/features/orders/server.ts
export const refundOrder = createServerFn({
  input: z.object({ orderId: z.string() }),
  middleware: [withCaller],
  mcp: { name: "refund_order", description: "Refund an order in full." },
  handler: ({ input, context }) => markRefunded(input.orderId, context.caller.id),
});

The Refund button, an MCP client, and your agent all run the same schema, middleware, and handler. withCaller reads a cookie for people and a token for agents.

An agent is a file that imports the same function:

TypeScript
// src/agents/refund.ts
import { defineAgent } from "agent-unit";
import { refundOrder } from "../features/orders/server";

export default defineAgent(async (input: { orderId: string }, run) => {
  const { approved } = await run.interrupt<{ approved: boolean }>("approve-refund", input);
  if (!approved) return { refunded: false };
  return run.step("refund", () => refundOrder({ orderId: input.orderId }));
});
  • run.step saves each finished step.
  • run.interrupt waits for a person, across restarts and deploys.
  • farm build serves the pages, the tools at /api/mcp, and the runs at /api/agent from one server.

Every page answers agents

Every page has a Markdown version. No config:

Terminal
curl https://your-app.com/pricing.md
curl -H "Accept: text/markdown" https://your-app.com/pricing
  • page.tsx is rendered and converted to Markdown.
  • page.md and page.mdx return their own source.
  • A page.md beside a page.tsx overrides what agents get, while browsers keep the React page.

When I asked 105 developer-tool sites for Markdown, a third answered with HTML.

Fast where you wait

One server-rendered route with the same 120-item list in each framework:

Frameworkp50 responseBuildFirst dev page
Farm.js0.74 ms589 ms272 ms
Next.js2.88 ms2.48 s1.44 s
SvelteKit0.63 ms1.73 s804 ms
Nuxt1.03 ms4.49 s2.39 s
TanStack Start0.99 ms690 ms816 ms

Medians on an Apple M1, Farm.js 0.1.51-beta.2, Nov 3.

On a real site, assistant-ui's docs moved from Next.js to Farm.js 0.2:

  • Framework build: 285 s → 64 s
  • Deep docs page in dev: 2.9 s → 1.0 s
  • Build folder: 1,199 MB → 507 MB

Less JavaScript in the browser

TypeScript
// farm.config.ts
export default defineConfig({
  renderer: react({ compiler: true }),
  serverComponents: true,
});
  • Islands (the default with serverComponents: true) send the page as HTML once and hydrate only client components. 27.6 KB of JavaScript instead of 71.0 KB with React Flight.
  • The React compiler updates only the DOM that changed and falls back to plain React when it can't prove a component safe. It scores 1.125 on js-framework-benchmark, level with Solid (1.133). React 19.2 scores 1.555.
  • On assistant-ui: 32% less JavaScript, 26% less script time, 18% less memory than Next.js.

Your renderer, your language

React is the default. Preact, Solid, Vue, and Svelte get the same routing, data, and deploy:

TypeScript
// farm.config.ts
export default defineConfig({ renderer: svelte() });

Need one fast endpoint? Put it in Rust, Go, or Python next to your TypeScript routes:

Code
src/app/api/
├── quote/route.ts       TypeScript
├── primes/route.rs      Rust (beta)
├── slug/route.go        Go (beta)
└── stats/route.py       Python (experimental)

They compile to WebAssembly, run behind your middleware, and show up in the same generated API client.

Web, desktop, and mobile

Terminal
farm dev --desktop     # the app in a desktop window, with HMR
farm build --desktop   # a packaged desktop app

On a phone:

  • export const mobile = { presentation: "modal" } opens a page as a native modal.
  • page.native.tsx beside a page gives that URL a native screen.
  • mobile.native.auto draws the pages Farm.js recognizes with native views, without JavaScript on the phone.

Deploy where you already are

TypeScript
// farm.config.ts
export default defineConfig({
  deploy: { target: "vercel" }, // or "cloudflare", "netlify", "node"
});
  • Any other Nitro preset works through deploy.preset: Bun, Deno Deploy, AWS Lambda, and more.
  • farm deploy --plan shows what a deploy will do before it runs.
  • Coming from Next.js, TanStack Start, SvelteKit, or Nuxt? Each has a migration guide.

Built carefully, shipped fast

  • A written product contract: fast feedback, server code that stays off the client, typed conventions, verified production output, and opt-in features that cost nothing when off.
  • Benchmarks with correctness checks, including the rows where we lose.
  • Model-checked concurrency. TLA-ts models found races in dev restarts, caching, jobs, and shutdown. All are fixed on main.
  • 843 pull requests merged in November.

Try it

Terminal
pnpm create @farm.js/app my-app
cd my-app
pnpm dev

Add a server function, give it an mcp name, put an agent in src/agents, and ask a page for its Markdown. Everything after that goes into the same app.

Thanks for building with us.

Keep exploring