# Farm.js - Framework for modern integrated apps

Source: /

Build / Ship / Scale

# a framework for product-integrated apps

/agents

Bring the stack you already use. Farm.js turns it into one product for people and agents, with typed APIs, integrations, docs, and deploys built in.

Get Started

Agent npm Yarn pnpm Bun

Farm.js is the framework for modern product-integrated apps. Build this as a production-ready Farm.js product app.

Before editing:

1. Read the Farm.js site skill at https://farmjs.dev/skill.md and the agent working rules at https://farmjs.dev/AGENTS.md.

2. Use https://farmjs.dev/llms.txt as the compact framework map. Start with https://farmjs.dev/docs/getting-started.md, https://farmjs.dev/docs/project-structure.md, and https://farmjs.dev/docs/reference.md, then fetch the smallest task-specific pages linked from the map.

3. Inspect package.json, farm.config.*, src/app, and existing project patterns. Match the installed @farm.js/* versions and verify every import against the current docs. Never invent an export.

Farm.js evolves quickly and may not be represented accurately in your training data, so treat the current docs and installed packages as the source of truth. Do not guess APIs or substitute Next.js or TanStack conventions.

Use Farm's documented App Router, typed APIs and server functions, middleware, Cron, integrations, environment boundaries, data loading and cache, and deployment APIs. If the docs are missing or conflict with the project, report the gap instead of silently improvising with another framework's behavior.

Preserve existing conventions, validate untrusted input, keep secrets server-only, add focused tests, and run typecheck, tests, and a production build before finishing.
CopyCopy

Product stack

React 19StripeCloudflareBetter AuthVercelInngestViteSupabaseTrigger.devDockerClerkResendNitroPolarNetlifyAuth.jsAutumnCloudflarePrismaAuth0shadcn/uiWorkOSUnkey

Development

### A blazingly fast dev server

Start the whole app once, then see every page request and response time as you work.

pnpm dev

```
$ pnpm devFarm.js v0.1.6 ready in 23ms➜ Local:http://localhost:3000/➜ Network:http://192.168.1.24:3000/[FARM] [PAGE] [GET] /contact - 200 (8ms)[FARM] [API] [POST] /api/waitlist - 200 (5ms)[FARM] [PAGE] [GET] /docs - 200 (11ms)
```

Typed APIs

### Types from route to client

Define an API route once. Farm.js generates a client with typed inputs and responses.

GET/api/userstsx

```
const { data, error } = await api.users.get({  query: { limit: "5" },});if (error) throw error;data?.users[0]?.name;//   ^? string | undefined
```

Integrations

### Connect once. Keep full control.

Connect billing, API keys, and more in one place. Pass existing provider instances and call every service through typed APIs.

integrations.ts Typed integration calls ts

```
import Stripe from "stripe";import { stripe } from "@farm.js/stripe";import { unkey } from "@farm.js/unkey";const stripeClient = new Stripe(process.env.STRIPE_SECRET_KEY!);export const integrations = {    billing: stripe({ instance: stripeClient }),    keys: unkey({        rootKey: process.env.UNKEY_ROOT_KEY,        apiId: process.env.UNKEY_API_ID,    }),};
```

Production

### Build once. Deploy together.

Farm.js packages routes, middleware, typed clients, and deployment config into one production build.

production buildbash

```
$ farm build --preset node-server[info] 🚜 Building Farm.js application with preset: node-server...[info] 🔍 Discovering routes and API endpoints...[info] 📦 Building client and SSR bundles in parallel...[bench] Fixture build wall time 527ms median[info] 📁 Output directory: .farm/.output
```

Renderers

### Your UI runtime, your choice

Keep React with zero config, or choose Preact, Solid, Vue, or Svelte. Routing, server features, SSR, and hydration stay on one contract.

farm.config.tsts

```

```

React by default SSR + hydration

React compiler

### React updates optimized ahead of time

Farm prepares safe state updates at build time. In our test, they were 8.5× faster with no extra component renders. React handles anything the compiler cannot safely optimize.

farm.config.tsts CopyCopy

```
import { defineConfig } from "@farm.js/core";import { react } from "@farm.js/react";export default defineConfig({  renderer: react({ experimental: {    compiler: true,  } }),});
```

88.2% lowerMedian update latency

8.5× fasterState update speed

0Extra renders

## Framework benchmarks

Startup advantage

### Farm gets your first page running: 5.47× faster than Next.js; 3.17× faster than SvelteKit; 9.21× faster than Nuxt; 3.17× faster than TanStack Start.

Cold dev startup through the first rendered SSR page, measured against the same routed fixture.

Production build

### Farm builds the same fixture: 4.53× faster than Next.js; 3.19× faster than SvelteKit; 8.47× faster than Nuxt; 1.25× faster than TanStack Start.

A complete production compile of the same SSR project, with generated output ready to boot.

Production boot

### Farm's server is up and answering: 3.96× faster than Next.js; 1.03× faster than SvelteKit; 1.82× faster than Nuxt; 1.24× faster than TanStack Start.

Production server spawn to the first validated, fully read response, from the same build output.

HTML size

### Farm sends a lighter first page: 4.06× smaller than Next.js; 1.10× smaller than SvelteKit; 1.12× smaller than Nuxt; 1.22× smaller than TanStack Start.

Bytes in the production response body for the same page. A lighter page finishes downloading sooner.

01.5Benchmark

Farm.js leads the benchmark app across latency and output size. Raw medians for startup, build, boot, SSR, and HTML.

Farm.jsNext.jsSvelteKitNuxtTanStack Start

X: benchmark setY: raw median / lower is better

2.33s253msDEV START30ms1.72msWARM DEV4.46s527msBUILD254ms64msPROD BOOT3.43ms0.63msSSR30.1 KB7.4 KBHTMLNEXT.JSDEV START MEDIAN · 1.39sRANGE 253ms → 2.33sNEXT.JSWARM DEV MEDIAN · 30msRANGE 1.72ms → 30msNEXT.JSBUILD MEDIAN · 2.38sRANGE 527ms → 4.46sNEXT.JSPROD BOOT MEDIAN · 254msRANGE 64ms → 254msNEXT.JSSSR MEDIAN · 3.43msRANGE 0.63ms → 3.43msNEXT.JSHTML MEDIAN · 30.1 KBRANGE 7.4 KB → 30.1 KBSVELTEKITDEV START MEDIAN · 802msRANGE 253ms → 2.33sSVELTEKITWARM DEV MEDIAN · 1.80msRANGE 1.72ms → 30msSVELTEKITBUILD MEDIAN · 1.68sRANGE 527ms → 4.46sSVELTEKITPROD BOOT MEDIAN · 66msRANGE 64ms → 254msSVELTEKITSSR MEDIAN · 0.63msRANGE 0.63ms → 3.43msSVELTEKITHTML MEDIAN · 8.2 KBRANGE 7.4 KB → 30.1 KBNUXTDEV START MEDIAN · 2.33sRANGE 253ms → 2.33sNUXTWARM DEV MEDIAN · 2.95msRANGE 1.72ms → 30msNUXTBUILD MEDIAN · 4.46sRANGE 527ms → 4.46sNUXTPROD BOOT MEDIAN · 117msRANGE 64ms → 254msNUXTSSR MEDIAN · 1.00msRANGE 0.63ms → 3.43msNUXTHTML MEDIAN · 8.3 KBRANGE 7.4 KB → 30.1 KBTANSTACK STARTDEV START MEDIAN · 803msRANGE 253ms → 2.33sTANSTACK STARTWARM DEV MEDIAN · 4.40msRANGE 1.72ms → 30msTANSTACK STARTBUILD MEDIAN · 658msRANGE 527ms → 4.46sTANSTACK STARTPROD BOOT MEDIAN · 80msRANGE 64ms → 254msTANSTACK STARTSSR MEDIAN · 0.94msRANGE 0.63ms → 3.43msTANSTACK STARTHTML MEDIAN · 9.1 KBRANGE 7.4 KB → 30.1 KBFARM.JSDEV START MEDIAN · 253msRANGE 253ms → 2.33sFARM.JSWARM DEV MEDIAN · 1.72msRANGE 1.72ms → 30msFARM.JSBUILD MEDIAN · 527msRANGE 527ms → 4.46sFARM.JSPROD BOOT MEDIAN · 64msRANGE 64ms → 254msFARM.JSSSR MEDIAN · 0.66msRANGE 0.63ms → 3.43msFARM.JSHTML MEDIAN · 7.4 KBRANGE 7.4 KB → 30.1 KB

Dev start

253ms3.17× edge

Warm dev

1.72ms1.05× edge

Build

527ms1.25× edge

Prod boot

64ms1.03× edge

SSR p50

0.66msnear lead

HTML

7.4 KB1.10× edge

Connected systems

## Bring the tools you already use

Start with built-in Farm Auth, keep full control with Better Auth, then add integrations for billing, email, jobs, KV storage, agents, API keys, and UI—or connect your own.

Explore Integrations

Farm AuthBetter AuthAuth.jsClerkAuth0WorkOSSupabaseAutumnPolarStripeResendPrismaInngestTrigger.devshadcn/uiUnkey

Routing

### The app router you know

Build pages, layouts, API routes, loading states, and typed links in one app directory.

approute explorer

- approot layout.tsxshell
- page.tsx/
- dashboard/dashboard page.tsxroute

- api/api users route.tsGET

04 routesmanifest synced

Deployment

### Deploy where you want

Ship to Vercel, Cloudflare, Netlify, or self-hosted Node with built-in Nitro presets.

Documentation

### Docs for people and agents

Enable a complete docs surface with MDX, navigation, search, MCP, and agent-ready endpoints from the same source.

farm.config.tsts

```
import { defineConfig } from "@farm.js/core";export default defineConfig({    docs: {        enabled: true,        entry: "/docs",        search: true,        mcp: true,    },});
```

Layers

### Share architecture, not boilerplate

Compose routes, middleware, integrations, components, and config from local or package layers. Project files always win.

Share / layer/farm.config.ts Consume / app/farm.config.ts ts

```
import { defineConfig } from "@farm.js/core";export default defineConfig({    routeRules: {        "/products/**": { swr: 300 },    },});
```

KV Storage

### Key/value storage for the runtime

Mount SQLite, Redis, S3, or another key/value driver for caches, settings, counters, idempotency records, and object-backed values.

Configure / farm.config.ts Use / preferences.ts ts

```
export default defineConfig({    storage: {        mounts: {            app: sqliteStorage({ path: "./data.sqlite" }),            cache: redisStorage({ url: process.env.REDIS_URL! }),        },    },});
```

Advanced routes

### Configure the whole route in one place

Validate params, prepare request data, load the page, and run post-load work in one typed route definition.

Route / src/farm.route.ts Use / product-page.tsx ts

```
export const ProductRoute = createRoute("/products/[id]", {    params: ProductParams,    data: {        before: () => auth.user({ required: true }),        main: ({ params, before }) => getProduct(params.id, before.id),        after: ({ data }) => recordView(data.id),    },    pending: ProductSkeleton,    error: ProductError,    component: ProductPage,});
```

Experimental rendering

### Native rendering for static regions

Farm detects large, host-only Server Component regions and renders eligible trees through [Strata](https://github.com/farming-labs/strata)'s Rust-native renderer. Everything else stays on React.

Boundary scan · <article>5 / 5

Host-only treeno client boundary insidepass✓Client codehooks and browser APIsnone✓Events or refshandlers and refsnone✓Size gatelarge enough to pay offpass✓RenderStrata, Rust-nativenative✓

Markdown mirrors

### Every page, readable by agents

Every app page receives a Markdown representation at a .md URL or through content negotiation. Keep the generated output or override it with page.md.

One route/pricing
✓

Browsertext/html

Agenttext/markdown

GET /pricing.md# Pricing- Hobby: free- Pro: $20 / month- Team: $50 / month

Agent systems

## Bring the agent runtime you already use

Run Eve on Vercel or Cloudflare Agents on Workers. Farm joins each runtime to your app in development and production while its native SDK stays intact.

Agent Integrations

Your appsame origin

EveVercel
/eve/*

Cloudflare AgentsWorkers
/agents/*

Agent runtimes

### Run agents beside the app

Choose Eve or Cloudflare Agents. Farm starts the runtime in development, owns its same-origin routes, and composes supported production output.

Eve/eve

Cloudflare Agentsone Worker

Your app · /supportcfAgent()

Now on Cloudflare AgentsDoes my state survive a deploy?this.sql✓142 rowsYes. Each agent is a Durable Object with its own SQLite storage.

Native clients

### Keep the provider-native SDK

Use useEveAgent for durable conversations or useAgent for typed WebSocket state and RPC. Farm does not add a duplicate client layer.

Eve / chat.ts Cloudflare / counter.ts ts

```
"use client";import { useEveAgent } from "eve/react";export function useChat() {    const agent = useEveAgent();    return {        messages: agent.data.messages,        send: agent.send,    };}
```

Built with Farm.js

## Vibe coding, powered by Farm.js

viby is open-source infrastructure for AI app builders.

pnpm add @viby/sdk

SDKviby.farming-labs.devDemoviby-app.farming-labs.dev

Chatdurable

YouBuild a pricing pageVibyDone. Saved as v3.

Versionsimmutable

v1scaffold⌁v2hero + nav⌁v3pricing page⌁

Workspacetools

↳READpricing.tsx✎WRITEpricing.tsx+84$SHELLfarm build✓

Previewready ✓

## One framework. The whole product.

Build routing, APIs, integrations, agents, docs, and deployment together in one React framework.

Get Started
