farm-to-door
v0.1.0
Published
Official JavaScript SDK for the farm-to-door API. Find local farms, raw milk, pastured eggs, grass-fed meat, and CSA shares across the US.
Maintainers
Readme
farm-to-door SDK
Official JavaScript SDK for the farm-to-door public API. farm-to-door is a free, searchable directory of working farms across the US, connecting people to raw milk, pastured eggs, grass-fed meat, and CSA shares near them.
Install
npm install farm-to-doorQuickstart
import { farmToDoor } from 'farm-to-door';
const farms = await farmToDoor.farmsNearby({ lat: 40.7, lng: -74, limit: 5 });
console.log(farms);No API key is required for read endpoints. If you need a custom base URL, fetch implementation, or headers, use createClient instead of the default export:
import { createClient } from 'farm-to-door';
const client = createClient({ baseUrl: 'https://farm-to-door.com/api' });
const summary = await client.farmsSummary({ origin_lat: 40.7, origin_lng: -74, radius_miles: 25 });API surface
| Method | Endpoint | Notes |
| --- | --- | --- |
| farmsSummary(params) | GET /farms/summary | Full farm records for a geo area or bounding box. |
| farmPins(params) | GET /farms/pins | Lightweight map pins for the same geo area. |
| farmsNearby({lat, lng, limit}) | GET /farms/nearby | Nearest farms to a point. |
| farm(farmId) | GET /farms/{farm_id} | A single farm by id. |
| farmsCount() | GET /farms/count | Total, prerender-eligible, and estimated farm counts. |
| categories() | GET /categories | Category vocabulary. |
| practices() | GET /practices | Farming practice vocabulary. |
| specialties() | GET /specialties | Specialty vocabulary. |
| attributes() | GET /attributes | Full attribute vocabulary. |
| states() | GET /states | Farm counts by state. |
| seasonal() | GET /seasonal | Seasonal availability data. |
Bulk data
If you need most or all of the directory, do not page through the API. Use the static bulk exports instead:
https://farm-to-door.com/reports/direct-farm-food/summary.jsonhttps://farm-to-door.com/reports/direct-farm-food/summary.csv- the sitemap at
https://farm-to-door.com/sitemap.xml
These are cheap to fetch and refreshed regularly. Hammering /farms/summary or /farms/pins in a loop to reconstruct the full directory is unnecessary and will get you rate limited.
Links
- Developer page: https://farm-to-door.com/developers
- OpenAPI spec: https://farm-to-door.com/api/openapi.json
- Interactive docs: https://farm-to-door.com/api/docs
- Agent guide: https://farm-to-door.com/llms.txt
For AI agents
If you are an AI agent working in this repository or calling the farm-to-door API, read AGENTS.md first. If you are looking for a packaged skill definition, see SKILL.md.
License
MIT
