Cloudflare Search Optimization: A Tiered Methodology (App -> Schema -> Platform)

Cloudflare Search Optimization: A Tiered Methodology#

A CF Workers + D1 + KV search endpoint has three classes of work you can ship to make it faster. They differ by cost-to-ship, not by impact. Order them right and you ship ~50% latency reduction in a day; order them wrong and you burn a week on Vectorize when the real win was a SELECT * you forgot to trim.

This page is the methodology, observed end-to-end on api.agent-zone.ai/api/v1/knowledge/search going from a 677ms baseline to 355ms then unlocking platform-level scale. Each tier is scope -> moves -> measured impact -> shipped commit.

FTS5 vs Cloudflare Vectorize: A/B Results on When Keyword Beats Semantic Search

FTS5 vs Cloudflare Vectorize#

The “FTS5 vs vectors” debate is usually hand-wavy. Both sides cite plausible reasons, neither runs the same queries through both engines on the same corpus, and the conclusion is whichever one the author shipped. With identical data and identical queries you can measure exactly where each wins.

The result: FTS5 and Vectorize have non-overlapping strengths. The right answer for most knowledge-base workloads is “ship both” behind an opt-in flag — not pick one. This page is the measurements, the cost math, and the dual-engine pattern.

Building an API with Cloudflare Workers and D1: From Zero to Production

Building an API with Cloudflare Workers and D1#

This tutorial walks through building a production API on Cloudflare Workers with a D1 database, KV caching, rate limiting, full-text search, and request logging. The patterns come from a real production deployment – not a toy example.

By the end you will have: a TypeScript Worker handling multiple API routes, a D1 database with FTS5 full-text search, KV-based caching and rate limiting, CORS support, request logging with IP hashing for privacy, and a deployment to Cloudflare’s global network.