← Back to blog

How I built PoaIndex

Visit PoaIndex →

Choosing a grass variety for your lawn shouldn't require reading decades of agricultural research reports.

I built PoaIndex to make published turfgrass research easier to explore. It brings historical trial results into a searchable application, helping people compare varieties based on regional evidence rather than what's currently available in stores.

This article explains how I collected and organized the research, built the ranking system, and deployed the application.

If you have ever tried to pick grass seed for a yard using actual agronomic data instead of bag marketing, you eventually land on the National Turfgrass Evaluation Program (NTEP). NTEP runs multi-year, multi-site university turfgrass trials across North America and publishes the results openly.

The catch is usability. The data lives across decades of plain-text tables, PDFs, HTML pages, and CSV files with inconsistent headers, legacy character encodings, and cultivar designations that change once an experimental line becomes a commercial variety. Comparing how cultivars actually performed near your ZIP code meant opening dozens of files and mentally reconciling names across trial cycles.

I built PoaIndex to bridge that gap: enter a ZIP code, answer a few questions about sun, irrigation, traffic, and maintenance, and see cultivar rankings grounded in local and regional NTEP trial evidence—with no accounts, no paywalls, and no affiliate bias.

1. Starting with an offline, certified data pipeline

The first commits in early August 2026 were not a web app at all—they were an ingestion and verification pipeline (apps/ntep). Rather than scraping or parsing NTEP files dynamically, PoaIndex treats the corpus like a build artifact:

pnpm ntep:discover
pnpm ntep:plan:validate
pnpm ntep:fetch -- --species kentucky-bluegrass --year 2012
pnpm ntep:build -- --species kentucky-bluegrass --year 2012
pnpm ntep:audit
pnpm ntep:verify

Parsing real-world NTEP archives meant dealing with grouped-month table layouts, Latin-1 HTML encodings, orphan report versions, and PDF tables from older trial cycles. Every parser behavior is pinned against golden fixtures (fixtures/txt/, fixtures/pdf/, fixtures/html/, fixtures/expected/), and nothing gets promoted to production without passing an audit gate. Raw authoritative sources live in Git and a Cloudflare R2 cold-storage bucket (poaindex-source-archive) so the entire corpus can always be rebuilt from scratch.

Reconciling Cultivar Names and Geography

Raw trial scores are only half the problem. Two other pieces had to be modeled cleanly in shared workspace packages:

  • Geography (packages/location-data, packages/turf-zones): Resolving USPS ZIP codes and ZCTAs into turf zones so recommendations can weight nearby NTEP trial sites instead of flattening the country into a single national average.
  • Cultivar identity (packages/aosca-data): Enriching NTEP entries with AOSCA identity records and a reviewed commercial-to-designation equivalence overlay, so an experimental code tested in one trial is properly linked to its commercial name without merging distinct cultivars.

2. How the recommendation engine evolved

The recommendation methodology went through four distinct iterations—and each cutover ran in shadow mode first:

  1. rec-v2: An initial evidence-plan scorer over a curated product corpus.
  2. rec-v3: Replaced the curated subset with the full historical cool-season (Kentucky bluegrass, perennial ryegrass, tall fescue, fineleaf fescue) and warm-season NTEP quality-history corpora, validated at 31/31 parity against staging before cutting over.
  3. rec-v3.1: Added local NTEP site anchoring so nearby trial evidence carries appropriate weight.
  4. rec-v4-c1: Built as an internal shadow scorer, evaluated against a certified-corpus holdout set, canary-tested live, and human-certified before becoming the production default on POST /v1/app/recommendations.

Keeping methodology versions explicit and running shadow parity checks made it possible to improve the scoring math without guessing whether rankings drifted for edge-case ZIP codes.

3. Adding retail and sod availability without biasing the science

Once the rankings worked, the obvious next question from any user is: "Okay, this cultivar tested well near me—where can I actually buy it?"

I wanted to answer that without ever letting commercial availability influence the scientific rankings. The rule became a hard architectural boundary: retail and vegetative supplier evidence is attached strictly post-scoring.

  • Seeded cultivars (apps/retail): Offline adapters for Twin City Seed, United Seeds, Seed World USA, and Ernst (via its WooCommerce Store API) match observed retail listings conservatively against canonical cultivars using a reviewed alias table, tracking preorder and discontinued states.
  • Vegetative cultivars (apps/vegetative): Warm-season grasses like bermudagrass, zoysiagrass, and paspalum are often sold as sod or sprigs rather than seed. Separate adapters ingest licensed producer directories from GCIA, Tahoma 31, Georgia paspalum, Sod Solutions, and NCCIA, alongside a consumer market-eligibility classification.

If a cultivar ranks high in NTEP trials but isn't carried by any tracked retailer, it stays ranked high. Availability is helpful context, never a ranking signal.

4. Retiring Postgres for a Cloudflare-only stack (D1 + R2)

PoaIndex originally served its read-only API from PostgreSQL behind Cloudflare Hyperdrive (hosted on Supabase). That worked for early iteration, but for a read-only, periodically refreshed scientific dataset, maintaining a live Postgres instance and connection pooler was unnecessary overhead.

In mid-August 2026, I moved both staging and production serving entirely to Cloudflare D1 (serverless SQLite) paired with R2 for archived dumps and raw source blobs, retiring Postgres and Hyperdrive completely. Because updates are offline snapshots (d1:import:snapshot and retail:d1:publish), production serving is simple, fast, and cheap:

  • Switched percentile lookups to batched IN queries and concurrent D1 reads to cut tall fescue recommendation latency.
  • Added a same-origin Cloudflare Pages Functions BFF (/resources/...) in front of the private API Worker so workers.dev stays locked down, with plan-aware edge rate limiting and Cloudflare Turnstile protecting recommendation endpoints.
  • Added an Access-JWT-gated Admin v2 dashboard for monitoring data freshness and runner health, plus external readiness checks (/resources/health/ready) wired into my central Uptime Kuma instance.

5. Static prerendering meets an interactive SPA

The frontend (apps/web) is a Vite + React + TypeScript application styled with CSS custom properties bridged to Tailwind CSS v4 and shadcn/ui. It has to do two different jobs well:

  • Serve 68 statically prerendered SEO pages—including editorial Guides, Grass Types landing pages, Methodology, and 45 Cultivar Explorer profiles (/cultivars/...)—with complete HTML, canonical URLs, and Open Graph metadata before JavaScript runs.
  • Serve an interactive 3-step SPA flow (/ → /z/:postalCode/conditions → /z/:postalCode/results) plus same-species cultivar comparisons.

Two production gotchas surfaced along the way and led to clean fixes:

  • The SPA fallback split: Prerendering / directly into dist/index.html meant dynamic routes like /z/03053/results briefly inherited the homepage's <title>, meta tags, and <h1> when Cloudflare Pages served index.html as a 200 fallback. The fix was saving the clean Vite shell to dist/spa.html before overwriting dist/index.html with the prerendered homepage, then having apps/web/functions/_middleware.ts serve /spa (using the pretty URL to avoid Cloudflare Pages' 308 redirect on /spa.html) for allowlisted SPA routes.
  • Trimming the public JS bundle: Shared Zod + OpenAPI contracts (@poaindex/api-contract) were pulling AdminV2* schemas and .openapi(...) metadata into the public entry bundle. Splitting the package into /public, /admin, and /errors subpaths, stripping .openapi(...) calls via a Vite AST transform for browser builds (while keeping the Worker's /openapi.json intact), and lazy-loading the results routes cut the main JS entry chunk by 26.7% (from ~640 KB down to ~469 KB raw).

6. Privacy-first observability

I initially wired up Cloudflare Zaraz for product analytics, then moved to a first-party, same-origin PostHog ingest proxy (/resources/ph) with session recording and autocapture disabled, hidden source-map uploads for clean stack traces, and explicit filters to drop browser-extension noise and automated probe traffic.

What I'd repeat on future projects

Looking back at the repository history, three habits paid off more than anything else:

  1. Treat data pipelines as certified build artifacts. Fixture-tested parsers, R2 source archives, and read-only D1 snapshots turn data updates from stressful migrations into repeatable publishes.
  2. Separate scoring from enrichment. Keeping retail and sod-grower lookups strictly post-scoring preserved trust in the core NTEP rankings and made both halves easier to test independently.
  3. Verify production directly. Running live E2E canaries and curl header/HTML checks caught subtle edge behaviors—like Cloudflare Pages returning 200 with the prerendered homepage on SPA routes—that local dev servers never showed.