Examples
Use the examples folder as executable docs for routing, RSC, agents, docs, markdown, auth, billing, email, jobs, and API keys.
Example apps
| Example | Shows |
|---|---|
| examples/basic | Core routing, layouts, deployment config, markdown mirrors, PPR, and framework Cron. |
| examples/deployment-presets | Vercel, Cloudflare Pages, Netlify, self-hosted Node, and direct Nitro preset deployment output. |
| examples/ssr-ssg-demo | SSR, SSG, ISR, API routes, middleware. |
| examples/i18n | Typed ICU messages, locale routing, detection, client switching, API context, and RTL. |
| examples/docs-integration | Docs runtime and /api/docs machine routes. |
| examples/stripe-integration | Stripe checkout, portal, session, webhooks. |
| examples/stripe-integrations/* | Stripe with Prisma, Drizzle, SQLite, org billing. |
| examples/better-auth-integration | Better Auth routes with local SQLite. |
| examples/jobs-trigger | Trigger.dev jobs runtime. |
| examples/jobs-inngest | Inngest jobs runtime. |
| examples/eve-agent | Eve instructions, same-origin chat UI, managed development, and Vercel composition. |
| examples/cf-agent | Cloudflare Agent state, callable RPC, Wrangler development, and combined Worker deployment. |
Run one example
pnpm --filter @farmjs/core buildpnpm --dir examples/basic installpnpm --dir examples/basic dev
What to verify
| Example type | Things to click/test |
|---|---|
| Basic routing | Navigation, route params, layouts, and route config exports. |
| API routes | Typed callers, validation errors, success responses, and generated types. |
| Docs integration | /docs, markdown mirrors, docs API routes, page actions, and search. |
| Stripe | Products, checkout redirect, portal redirect, session/status reads, and webhook handling. |
| Better Auth | Sign-up, sign-in, session read, logout, and protected routes. |
| Jobs | Trigger, batch trigger, schedule, status, and cancel calls. |
| Eve agent | Farm page rendering, /eve/v1/health, streaming messages, and Vercel output. |
| Cloudflare agent | Farm page rendering, WebSocket connection, synchronized state, callable RPC, and Wrangler dry-run deployment. |
| Cron | A schedule in farm.config.ts mapped to a protected API route. |
| Internationalization | Locale 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:
- Config in
farm.config.ts. - Route/page files under
src/app. - Client interaction when the feature has UI.
- Build or dev-server validation.
- 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.