a framework for product-integrated apps
/agentsBring 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.
Farm.js is the full-stack framework for the web and agents. Build this as a production-ready Farm.js 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.Developer experience
A blazingly fast dev server
Start the whole app once, then see every page request and response time as you work.
$ pnpm devFarm.js v0.2.0-beta.0 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)Types from route to client
Define an API route once. Farm.js generates a client with typed inputs and responses.
const { data, error } = await api.users.get({ query: { limit: "5" },});if (error) throw error;data?.users[0]?.name;// ^? string | undefinedConnect once. Keep full control.
Connect billing, API keys, and more in one place. Pass existing provider instances and call every service through typed APIs.
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, }),};Build once. Deploy together.
Farm.js packages routes, middleware, typed clients, and deployment config into one production build.
$ 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 589ms median[info] 📁 Output directory: .farm/.outputYour 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.
React updates optimized ahead of time
Farm prepares safe state updates at build time and updates the DOM directly, so a row swap runs 19× faster than plain React. React handles anything the compiler cannot safely optimize.
import { defineConfig } from "@farm.js/core";import { react } from "@farm.js/react";export default defineConfig({ renderer: react({ compiler: true, }),});Framework benchmarks
Farm gets your first page running: 5.31× faster than Next.js; 2.96× faster than SvelteKit; 8.78× faster than Nuxt; 3.00× faster than TanStack Start.
Cold dev startup through the first rendered SSR page, measured against the same routed fixture.
Farm builds the same fixture: 4.21× faster than Next.js; 2.94× faster than SvelteKit; 7.62× faster than Nuxt; 1.17× faster than TanStack Start.
A complete production compile of the same SSR project, with generated output ready to boot.
Farm's server is up and answering: 3.25× faster than Next.js; 0.89× faster than SvelteKit; 1.53× faster than Nuxt; 1.07× faster than TanStack Start.
Production server spawn to the first validated, fully read response, from the same build output.
Farm sends a lighter first page: 3.76× smaller than Next.js; 1.02× smaller than SvelteKit; 1.04× smaller than Nuxt; 1.13× smaller than TanStack Start.
Bytes in the production response body for the same page. A lighter page finishes downloading sooner.
Farm.js starts, builds and ships the least of the benchmark app. Raw medians for startup, build, boot, SSR, and HTML. The tiles below name the framework to beat where one is faster.
Dev start
Warm dev
Build
Prod boot
SSR p50
HTML
Runtime benchmarks
- Plain React3.80 ms
- Farm compiler0.20 ms
- Vanilla JS1.033
- Farm.js React1.125
- Solid 1.91.133
- React 19.21.555
- React Compiler1.601
Row swaps 19× faster than plain React. What it cannot prove safe stays with React.
The same app with the compiler off and on: a swap takes 0.2 ms instead of 3.8 ms. On the independent js-framework-benchmark, Farm.js is the fastest React entry and level with Solid.js-framework-benchmarkCompiler benchmark
- Docs page: 87 ms with islands, 168 ms with React Server Components.
- Shop page: 80 ms with islands, 162 ms with React Server Components.
- Blog post: 106 ms with islands, 216 ms with React Server Components.
- Guide post: 105 ms with islands, 216 ms with React Server Components.
Server components with 61% less JavaScript. 27.6 KB on first load instead of 71.0 KB.
Islands mode renders server components on islx and hydrates a client component only when it is needed: about half the main-thread work of React Flight on pages whose client components wait for a click, and 7.2× the requests per second on a long blog post. Both engines run the same server components contract tests.How islands compare
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.
The app router you know
Build pages, layouts, API routes, loading states, and typed links in one app directory.
Deploy where you want
Ship to Vercel, Cloudflare, Netlify, or self-hosted Node with built-in Nitro presets.
Docs for people and agents
Enable a complete docs surface with MDX, navigation, search, MCP, and agent-ready endpoints from the same source.
import { defineConfig } from "@farm.js/core";export default defineConfig({ docs: { enabled: true, entry: "/docs", search: true, mcp: true, },});Share architecture, not boilerplate
Compose routes, middleware, integrations, components, and config from local or package layers. Project files always win.
import { defineConfig } from "@farm.js/core";export default defineConfig({ routeRules: { "/products/**": { swr: 300 }, },});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.
export default defineConfig({ storage: { mounts: { app: sqliteStorage({ path: "./data.sqlite" }), cache: redisStorage({ url: process.env.REDIS_URL! }), }, },});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.
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,});Native rendering for static regions
Farm detects large, host-only Server Component regions and renders eligible trees through Strata's Rust-native renderer. Everything else stays on React.
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.
Keep the backend you already have
Mount any app with a fetch handler, like Hono or Elysia, or any Node.js framework, like Express, Koa, Fastify, or NestJS, on one API route. It runs in development and production beside your typed routes.
The same pages, as a native app
farm dev --mobile puts your pages in a native frame with tabs, stacks, sheets, and the back gesture. Draw a route with native views or React Native when it needs more. In preview on emulators and simulators.
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.
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.
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.
"use client";import { useEveAgent } from "eve/react";export function useChat() { const agent = useEveAgent(); return { messages: agent.data.messages, send: agent.send, };}Vibe coding, powered by Farm.js
viby is open-source infrastructure for AI app builders.
pnpm add @viby/sdkOne framework. The whole product.
Build routing, APIs, integrations, agents, docs, and deployment together in one React framework.