Farm.js

Anonymous telemetry

Farm.js includes optional anonymous product telemetry in both published CLI packages: @farm.js/cli (farm) and @farm.js/create-app (the generator behind commands such as pnpm create @farm.js/app). Telemetry is enabled by default for interactive local commands. It helps the maintainers understand which coarse framework paths are useful and where compatibility work should be focused.

This is separate from application observability. OpenTelemetry describes what your application does and is configured by the application owner. Farm.js product telemetry only describes use of Farm's own CLI and starter generator, and is sent to Farm's infrastructure after the CLI displays its one-time notice unless you opt out.

Control telemetry

farm telemetry status
farm telemetry enable
farm telemetry disable

The first eligible event creates a random anonymous installation ID in the operating system's local configuration directory. farm telemetry disable opts out and deletes that ID. Running farm telemetry enable later creates a different ID. Saved opt-out preferences remain respected across upgrades.

Environment variables can provide an explicit per-process or organization-wide policy:

VariableBehavior
FARM_TELEMETRY=1Enables telemetry, including non-interactive and CI commands.
FARM_TELEMETRY=0Disables telemetry for the process.
FARM_TELEMETRY_DISABLED=1Disables telemetry for the process.
DO_NOT_TRACK=1Disables telemetry and takes precedence over Farm's enable setting.

Without the explicit FARM_TELEMETRY=1 override, Farm skips test, CI, and non-interactive processes even when the saved local preference is enabled.

The preference file is stored at:

  • macOS: ~/Library/Application Support/farmjs/telemetry.json
  • Linux: $XDG_CONFIG_HOME/farmjs/telemetry.json, or ~/.config/farmjs/telemetry.json
  • Windows: %APPDATA%\farmjs\telemetry.json

Data that is sent

Farm currently sends two versioned event types across both CLI packages:

EventFields
command_invokedAllowlisted command from farm or create-farm-app, package/version, optional deploy target, runtime.
project_createdAllowlisted starter, renderer, package manager, TypeScript/install booleans, runtime fields.

The farm binary records each actionable command path, including nested commands such as auth:migrate, cron:list, cron:run, and add:integration. The app generator records create or list-templates, and a completed scaffold also records project_created. Help, version, and the farm telemetry privacy-control commands do not emit events.

Every request also has a random event ID for deduplication and the random local installation ID. The server immediately converts the installation ID into an HMAC hash using a server-only salt; the raw ID is not stored. Receipt time is assigned by the server instead of trusting a client timestamp.

Farm does not collect or store:

  • project names, filesystem paths, Git remotes, repository names, source code, or route names;
  • usernames, email addresses, account IDs, cookies, application payloads, or application events;
  • environment variable names or values, database URLs, credentials, tokens, or other secrets;
  • IP addresses or user-agent strings.

The client uses a short timeout and ignores network or server failures. Telemetry can never make a Farm command fail. There is no persistent retry queue.

Endpoint, validation, and retention

Events are posted to https://farmjs.dev/api/telemetry/v1/events. The endpoint accepts a strict, versioned JSON schema, rejects unknown fields and bodies larger than 8 KiB, rate-limits traffic, and deduplicates event IDs.

Raw telemetry events are retained for 90 days by default and are pruned by the ingestion service. Aggregated package-download counts remain available independently through npm's public download statistics. A deployment operator can shorten the event retention window with FARM_TELEMETRY_RETENTION_DAYS.

For local endpoint development only, FARM_TELEMETRY_ENDPOINT can point at an HTTPS URL or an HTTP localhost address. Released clients use the Farm-owned endpoint by default.

Maintainer deployment setup

The Farm-owned docs deployment uses four server-only environment variables:

VariablePurpose
DATABASE_URLPooled Postgres connection used by Prisma.
FARM_TELEMETRY_IDENTITY_SALTLong random secret used to HMAC-hash local anonymous IDs.
FARM_TELEMETRY_DASHBOARD_TOKENLong random secret used to open the internal /telemetry dashboard.
FARM_TELEMETRY_RETENTION_DAYSOptional raw-event retention window; defaults to 90.

These values must be encrypted deployment variables and must never use a PUBLIC_ prefix or be committed to the repository. The public CLI does not contain an ingestion secret; the endpoint is protected with strict validation, body limits, rate limits, and idempotent event IDs instead.

After connecting Postgres, generate the Prisma client and apply the schema from the repository:

pnpm --dir docs prisma:generate
pnpm --dir docs db:push

/telemetry exchanges the dashboard token through a server-side form for a 12-hour HttpOnly, SameSite cookie. The token is not placed in the URL, local storage, or client-side JavaScript.