Sign In

@cropgraph/core

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cropgraph/core

CropGraph core library: curated crop calendar (1,000 entries), 333 companion planting relationships, 12 rotation families, 33 succession planting chains, 158 pest/disease associations, USDA hardiness zone lookup, and climate classification. Offline, zero

Source
npmnpm
Version
1.4.0
Version published
Weekly downloads
110
100%
Maintainers
1
Weekly downloads
 
Created
Source

@cropgraph/core

Curated agricultural intelligence as a pure TypeScript library. No network calls, no API keys, no runtime dependencies beyond Zod.

What's in here

AssetDetail
Crop calendar1,000 entries: 319 vegetables, 186 herbs, 173 fruits, 163 flowers, 59 legumes, 55 cover crops, 45 roots. Frost-anchored planting windows with optional climate modifiers for six climate types.
Companion planting333 directed relationships: 281 beneficial, 52 antagonist, 11 mechanism categories (nitrogen_fixing, pest_repellent, trap_crop, ...).
Rotation families12 botanical families (nightshades, brassicas, cucurbits, alliums, legumes, umbellifers, grasses, amaranthaceae, composites, mints, malvaceae, miscellaneous). Every calendar slug is mapped. Year-gap, follow-with, and never-follow rules per family.
Succession chains33 time-sequenced planting chains: greens cycles, root cadences, legume relays, brassica spring/fall, cucurbit replacements, herb successions, cut-flower staggers, cover-crop relays. Frost-anchored phases with per-climate notes.
Pest/disease associations158 crop-to-pest edges with diagnostic symptoms, ordered organic management options, prevention practices, and regions of significance. OMRI-listed materials, biocontrols, and physical/cultural practices only. Curated against Cornell, UC IPM, UF/IFAS, Penn State, OSU, WSU, and Texas A&M Extension publications.
USDA hardiness zones40,283 ZIP-code centroids from PRISM 2023 + waldoj/frostline, with offline lookup by coordinates or ZIP. Frost-date table by zone.
Climate typesSix-type classifier (maritime, mediterranean, continental, humid_subtropical, arid, semi_arid) from a coordinate-based heuristic.

All datasets are validated against JSON Schemas at module load. A malformed fixture breaks import "@cropgraph/core" immediately rather than at runtime.

Install

npm install @cropgraph/core

Usage

import {
  getHardinessZone,
  getClimateType,
  getPlantingPlan,
  findCrop,
  searchCrops,
  getCompanions,
  checkCompanionPair,
  getRotationAdvice,
  checkRotationSequence,
  getSuccessionChain,
  getSuccessionPlan,
  getPestsByCrop,
  getPestDetail,
} from "@cropgraph/core";

// Zone lookup from coords.
const zone = getHardinessZone({ lat: 48.118, lng: -123.43 });
// → { ok: true, data: { zone: "8b", ... } }

// Climate classification from coords.
const climate = getClimateType({ lat: 48.118, lng: -123.43 });
// → { ok: true, data: { climateType: "maritime", ... } }

// Planting plan for a zone.
const plan = getPlantingPlan({ zone: "8b", climateType: "maritime" });
// → { ok: true, data: { plantNow: [ ... ] } }

// Crop lookup.
findCrop("tomato");
searchCrops("squash");

// Companion planting.
getCompanions("tomato");                // 33+ companion entries
checkCompanionPair("tomato", "basil");  // beneficial

// Rotation families.
getRotationAdvice("tomato");
// → { family: "nightshades", rotationYears: 3, followWith: [...], ... }
checkRotationSequence(["tomato", "bush-bean", "sweet-corn", "cabbage"]);
// → { ok: true, issues: [] }

// Succession planting.
getSuccessionChain("lettuce-leaf");
// → { slug: "lettuce-succession", chains: [phase 1, phase 2, phase 3], ... }
getSuccessionPlan({ slug: "lettuce-leaf", zone: zone.data, climateType: "maritime" });
// → { phases: [{ windowStart: "2026-02-15", sowingDates: [...] }, ...] }

// Pests and diseases.
getPestsByCrop("tomato");          // ~21 entries sorted by severity
getPestDetail("tomato-hornworm");  // every crop the pest affects + management

Data sources

Every entry cites a USDA Cooperative Extension publication or a peer-reviewed source. See the per-entry source field in src/data/crop-calendar.json, src/data/companions.json, src/data/rotation-families.json, src/data/succession-chains.json, and src/data/pest-disease.json, and the file-level descriptions in the matching *.schema.json files for the methodology rundown.

License

MIT.

Keywords

cropgraph

FAQs

Package last updated on 13 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts