Farm.js

Examples

Use the examples folder as executable docs for routing, RSC, agents, docs, markdown, auth, billing, email, jobs, and API keys.

Example apps

ExampleShows
examples/basicCore routing, layouts, deployment config, markdown mirrors, PPR, and framework Cron.
examples/deployment-presetsVercel, Cloudflare Pages, Netlify, self-hosted Node, and direct Nitro preset deployment output.
examples/ssr-ssg-demoSSR, SSG, ISR, API routes, middleware.
examples/react-compilerSide-by-side React AOT and normal reconciliation paths with visible render counts.
examples/preact-rendererPreact TSX routes, streaming SSR, hydration, hooks, and a typed FARMJS server call.
examples/solid-rendererSolid TSX routes, SSR, hydration, signals, and a typed FARMJS server call.
examples/vue-rendererVue SFC routes, SSR, hydration, refs, and a typed FARMJS server call.
examples/svelte-rendererSvelte 5 routes, SSR, hydration, runes, and a typed FARMJS server call.
examples/i18nTyped ICU messages, locale routing, detection, client switching, API context, and RTL.
examples/docs-integrationDocs runtime and /api/docs machine routes.
examples/federation-demoSeparate producer and host builds with a federated browser component.
examples/search-demoStatic Pagefind indexing, route selection, and a headless React search interface.
examples/stripe-integrationStripe checkout, portal, session, webhooks.
examples/stripe-integrations/*Stripe with Prisma, Drizzle, SQLite, org billing.
examples/farm-authBuilt-in Farm Auth config, client APIs, sessions, and local SQLite.
examples/jobs-triggerTrigger.dev jobs runtime.
examples/jobs-inngestInngest jobs runtime.
examples/eve-agentEve instructions, same-origin chat UI, managed development, and Vercel composition.
examples/cf-agentCloudflare Agent state, callable RPC, Wrangler development, and combined Worker deployment.

Run one example

pnpm --filter @farm.js/core build
pnpm --dir examples/basic install
pnpm --dir examples/basic dev

What to verify

Example typeThings to click/test
Basic routingNavigation, route params, layouts, and route config exports.
Renderer adaptersServer HTML, hydration, native client state, and the typed greeting server call.
API routesTyped callers, validation errors, success responses, and generated types.
Docs integration/docs, markdown mirrors, docs API routes, page actions, and search.
Browser federationProducer manifest, cross-origin loading, shared renderer, failure state, retry, and host callback.
Static searchProduction indexing, typed browser queries, result navigation, and excluded routes.
StripeProducts, checkout redirect, portal redirect, session/status reads, and webhook handling.
Farm AuthSign-up, sign-in, session read, logout, and authenticated server requests.
JobsTrigger, batch trigger, schedule, status, and cancel calls.
Eve agentFarm page rendering, /eve/v1/health, streaming messages, and Vercel output.
Cloudflare agentFarm page rendering, WebSocket connection, synchronized state, callable RPC, and Wrangler dry-run deployment.
CronA schedule in farm.config.ts mapped to a protected API route.
InternationalizationLocale URLs, browser and cookie detection, translated server/client content, RTL, and generated message types.
Markdown.md mirrors for public pages and cache headers.

Example-driven development

When adding a new framework feature, add or update an example that proves the whole flow works:

  1. Config in farm.config.ts.
  2. Route/page files under src/app.
  3. Client interaction when the feature has UI.
  4. Build or dev-server validation.
  5. Docs content that explains the same shape.

Examples should be small but complete enough that a user can copy the pattern into a real app.