---
title: "Why build on Farm.js. One app for people and their agents."
description: "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."
---


# 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.**

<span id="the-short-version" className="blog-heading-anchor" />

## 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.

<span id="your-agent-ships-with-your-app" className="blog-heading-anchor" />

## Your agent ships with your app

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

```ts
// 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:

```ts
// 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.

<span id="every-page-answers-agents" className="blog-heading-anchor" />

## Every page answers agents

Every page has a Markdown version. No config:

```bash
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.

<span id="fast-where-you-wait" className="blog-heading-anchor" />

## Fast where you wait

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

| Framework      | p50 response |      Build | First dev page |
| -------------- | -----------: | ---------: | -------------: |
| **Farm.js**    |      0.74 ms | **589 ms** |     **272 ms** |
| Next.js        |      2.88 ms |     2.48 s |         1.44 s |
| SvelteKit      |  **0.63 ms** |     1.73 s |         804 ms |
| Nuxt           |      1.03 ms |     4.49 s |         2.39 s |
| TanStack Start |      0.99 ms |     690 ms |         816 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

<span id="less-javascript-in-the-browser" className="blog-heading-anchor" />

## Less JavaScript in the browser

```ts
// 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.

<span id="your-renderer-your-language" className="blog-heading-anchor" />

## Your renderer, your language

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

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

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

```text
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.

<span id="web-desktop-and-mobile" className="blog-heading-anchor" />

## Web, desktop, and mobile

```sh
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.

<span id="deploy-where-you-already-are" className="blog-heading-anchor" />

## Deploy where you already are

```ts
// 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.

<span id="built-carefully-shipped-fast" className="blog-heading-anchor" />

## 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.**

<span id="try-it" className="blog-heading-anchor" />

## Try it

```bash
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.
