Farm.js

Migrate from Nuxt

Nuxt and Farm.js share Vue, file-based routing, server rendering, API routes, Vite, and Nitro deployment output. Farm.js uses a different application and server contract, but the @farm.js/vue renderer lets route UI remain in Vue Single-File Components. Preserve route URLs and server contracts while replacing Nuxt-specific macros, composables, modules, and runtime behavior.

Using a coding agent?

Point it at /docs/migrations/nuxt.md. That version maps every Nuxt feature to its Farm.js equivalent and ends with a verification checklist.

Why move from Nuxt

Keep Vue components while adopting Farm.js's application, integration, and agent contracts. Nuxt already combines Vue, Vite, Nitro, modules, and server rendering. The reason to move is a fit with Farm.js's particular APIs and tools, rather than gaining those shared foundations for the first time.

  • Retain the Vue work you have. Templates, refs, computed values, scoped styles, and ordinary components remain Vue. Replace Nuxt macros and composables deliberately instead of rewriting the interface in React.
  • Use explicit hydration boundaries. Farm.js's Vue routes render HTML without hydration until you opt in. This gives content pages an explicit way to avoid component hydration work. Enable hydration for interactive routes and test them; removing interactivity is not an optimization.
  • Connect services through typed endpoints. Server integrations can own routes, configuration, callers, and lifecycle. Vue consumes their server APIs without adopting React providers.
  • Reuse a framework contract across projects. If your team maintains both Vue and React apps, Farm.js gives their server routes, storage, deployment, plugins, and diagnostics a common vocabulary.
  • Agent native at the core, including Vue apps. Markdown, discovery, capability manifests, and read-only MCP come from @farm.js/core. Opt-in tools and agent runtimes extend that surface when the product needs them.

Performance evidence

The published November 3, 2026 snapshot compares Nuxt 4.5.0/Vue 3.5.40 with Farm.js 0.1.51-beta.2 using React 19.2.4. It does not measure Farm.js's Vue renderer or a migrated Nuxt application. Lower durations are better.

MeasureNuxtFarm.js, React fixture
Process launch to first dev page, median2,387.53 ms271.78 ms
Warm dev response, median3.16 ms2.08 ms
Clean fixture build, median4,487.00 ms589.12 ms
Production boot to first response, median118.56 ms77.69 ms
Production response, median / p951.03 / 1.51 ms0.74 / 1.64 ms

The Farm.js React fixture reaches the first dev page about 8.8× sooner and builds about 7.6× faster. Nuxt has the lower production-response p95 in this run. Neither result tells you the speedup of keeping Vue and moving the same app to Farm.js; measure that path separately.

The workload is one fresh SSR page with 120 list items and shared CSS. The run used an Apple M1, 16 GB RAM, macOS 26.2, Node 24.21.0, one discarded burn-in, and seven position-balanced measured rounds. Each server received 30 warmup and 30 measured requests per round over local HTTP/1.1, requesting identity encoding. Generated framework caches were removed for dev and build; OS and product-enabled Node compile caches stayed warm. Farm.js package preparation and dependency installs are outside the build timer. See the method and raw samples. This measures neither browser hydration nor the cost of Nuxt modules in your application.

Developer experience after the move

Use Farm.js's validated API routes and a renderer-neutral typed client to keep request and response contracts connected. In Vue code, follow the imports in the Vue renderer guide, including @farm.js/vue/bindings and @farm.js/core/api/client; React client hooks are not Vue composables.

Move shared app foundations into layers. Use Farm.js's i18n configuration, storage mounts, and deployment targets where they meet your requirements. Nuxt already has layers and Nitro deployment; review the behavior changes instead of assuming matching names mean matching semantics.

Run farm doctor for diagnostics, farm explain /products/42 for resolved route behavior, and farm generate --check for generated declarations. DevTools can inspect served Vue modules; Hints checks the live page and Analyzer explains output size. These make the migration's server and browser boundaries easier to inspect.

Agent experience after the move

The agent surface belongs to @farm.js/core, so you keep it when you choose Vue. Core supplies the public-page reading and discovery defaults without an agent integration or a separate MCP server. Its AI catalog advertises MCP servers already present; the core defaults and limits explain ownership, overrides, and opt-ins.

Farm.js's Markdown mirrors, discovery metadata, and read-only MCP server work at the framework level. An agent can discover and read eligible public static pages without understanding Vue's component tree. The app manifest describes configured capabilities.

For approved operations, API MCP exposes selected server endpoints with validation and authorization. WebMCP offers explicit browser tools; register and dispose of them through Vue's lifecycle. It requires a supporting browser and is experimental. The agent integration can host durable server-side agent work beside your Vue app. Its server capabilities do not require a React chat interface.

Integrations and plugins to replace Nuxt-specific wiring

  • Start with the integration catalog for auth, billing, email, jobs, and agents. Keep server adapters separate from renderer-specific UI; port React examples to Vue rather than installing React providers into a Vue tree.
  • Use Content for validated local collections and Search for a headless index of emitted static pages. They are migration destinations, not automatic replacements for all Nuxt Content features.
  • Use Scripts for external SDK loading, PWA for offline navigation, and Health or Sentry for production operations.
  • Extend the app through server/build hooks and client hooks when a Nuxt module has no direct adapter. The complete catalog also covers navigation, request mocks, workers, and WebAssembly.

Decide what must remain Nuxt-compatible

Audit modules, auto-imports, useAsyncData, payload transfer, route middleware, and Vue plugins before moving. Farm.js's Vue app setup can install Vue plugins, but it does not automatically transfer their server store state to the browser. Hydration is opt-in, and ordinary anchors perform full document navigation; use the renderer's router bindings when client navigation is required.

Nuxt's rendering modes already support several delivery strategies. Compare equivalent rendering and cache behavior. React server components, React hooks, and experimental React compiler results are not capabilities or measurements of Farm.js's Vue renderer.

Create the Farm.js shell

Add Farm.js and the Vue renderer without removing Nuxt first:

pnpm add @farm.js/core @farm.js/vue vue
pnpm add -D @farm.js/cli

Create the smallest Farm.js config:

import { defineConfig } from "@farm.js/core";
import { vue } from "@farm.js/vue";

export default defineConfig({
  renderer: vue(),
});

Point the application scripts at Farm.js when the first route is ready to run:

{
  "scripts": {
    "dev": "farm dev",
    "build": "farm build",
    "start": "node .farm/.output/server/index.mjs"
  }
}

Map pages and layouts

Nuxt 4 normally keeps pages under app/pages; projects using the earlier layout may use pages at the root. Both map into Farm.js's src/app.

Nuxt sourceFarm.js output
app/pages/index.vue or pages/index.vuesrc/app/page.vue
app/pages/about.vue or pages/about.vuesrc/app/about/page.vue
app/pages/posts/[id].vuesrc/app/posts/[id]/page.vue
app/pages/docs/[...slug].vuesrc/app/docs/[...slug]/page.vue
app/layouts/default.vue or layouts/default.vuesrc/app/layout.vue
nested Nuxt layoutsnested src/app/**/layout.vue files
error.vuethe nearest error.vue and not-found.vue

Create a root layout before moving pages:

<script setup lang="ts">
defineOptions({ inheritAttrs: false });
</script>

<template>
  <slot />
</template>

Keep ordinary templates, <script setup>, refs, computed values, and scoped styles. Replace Nuxt auto-imports and macros with explicit Vue imports and Farm.js route exports. Use a normal <script lang="ts"> block for named exports such as metadata and hydrate, and add defineOptions({ inheritAttrs: false }) so route props do not fall through to the root DOM element.

See Vue Renderer for the complete SFC conventions.

Replace Nuxt navigation

Nuxt APIFarm.js Vue equivalent
<NuxtLink to="/about"><a href="/about">
navigateTo("/sign-in")redirect("/sign-in") in server code
client navigateTo()assign window.location or use an ordinary anchor
useRoute().paramstyped page props declared with defineProps
useRoute().querytyped page props or URLSearchParams in client code
definePageMeta()named metadata, generateMetadata, and route exports

Keep dynamic segment names stable so existing links and external URLs continue to work.

Move data fetching

Classify every useFetch, useAsyncData, and $fetch call by where it should run:

Nuxt behaviorFarm.js destination
server-rendered page dataserver module called while rendering or an API endpoint
cached reusable readcreateServerQuery with an explicit structured key
browser request to an app endpointgenerated API client or fetch
mutation or privileged server actionserver function behind a validated API route
route guard dataroute middleware

Keep database clients, secrets, and privileged provider SDKs in server-only modules. Validate untrusted params, query values, form data, and API bodies before using them.

Convert server routes

Move Nitro server handlers into Farm.js API route modules:

Nuxt sourceFarm.js output
server/api/hello.get.tssrc/app/api/hello/route.ts with GET
server/api/users/[id].patch.tssrc/app/api/users/[id]/route.ts with PATCH
server/routes/health.tsan API route or programmatic Farm.js route
server/middleware/*.tsFarm.js middleware or a server plugin

Farm.js handlers use Web Request and Response objects:

export async function GET() {
  return Response.json({ ok: true });
}

Use createEndpoint when the endpoint needs schema validation and a typed generated client.

Move middleware and plugins

Nuxt route middleware and server middleware do not share one lifecycle, so migrate them by responsibility:

  • move authentication redirects and route gates into src/app/**/middleware.ts
  • move global request behavior into farm.config.ts middleware
  • move reusable server lifecycle behavior into a Farm.js plugin
  • move provider setup into a Farm.js integration when it owns routes, middleware, or client context
  • replace Nuxt client plugins with Vue components or Farm.js client plugin hooks

Repeat sensitive authorization in API routes and server functions. A page redirect is not an authorization boundary.

Move runtime configuration

Review nuxt.config.ts, app.config.ts, modules, auto-imports, aliases, and runtimeConfig explicitly:

Nuxt configurationFarm.js destination
private runtimeConfigtyped server environment variables
runtimeConfig.publictyped public environment variables
app metadatapage or layout metadata exports
Vite plugins and aliasesthe vite field in farm.config.ts when still needed
Nuxt modulesFarm.js integrations, plugins, or ordinary packages
auto-imported componentsexplicit Vue component imports

Do not expose a private Nuxt runtime value through Farm.js's public environment configuration.

Verify and remove Nuxt

Run both applications during the transition and compare:

  • static, dynamic, optional, and catch-all routes
  • layouts, metadata, error states, and redirects
  • server-rendered data and client navigation
  • API status codes, headers, cookies, and response bodies
  • middleware order and authorization
  • image and public asset URLs
  • production output on the target deployment platform

After the Farm.js application passes those checks, remove Nuxt, Nuxt modules, .nuxt, and Nuxt-specific deployment configuration. Keep Vue and @farm.js/vue as application dependencies.

For source behavior, refer to Nuxt's official pages, data fetching, and directory structure documentation while auditing the original app.