Repository navigation
feat(prompts): add Competition column with a 5-bar difficulty meter - #82
Merged
Merged
Conversation
Wires DataForSEO competition data end-to-end (API -> DB -> UI) for the
All Prompts tab, reusing the existing search-volume call (no extra spend):
- migration 00004 adds competition_index + competition to prompt_volumes
- getSearchVolumes now returns { volume, competitionIndex, competition }
per keyword; callers updated (volumes.js, test-volumes.js)
- fetchAndSaveVolumes aggregates a volume-weighted average per prompt and
stores both the index and a LOW/MEDIUM/HIGH label
- CompetitionBars renders an Ahrefs-style 5-bar meter (green -> dark red),
'-' when unknown
- All Prompts tab gains a Competition column with a header tooltip noting
it's a Google Ads proxy for topic difficulty
Closes #44
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Competition column to the All Prompts tab (
/dashboard/prompts?tab=all) with an Ahrefs/SEMrush-style 5-bar difficulty meter. The competition data already comes back on every DataForSEO search-volume call — this wires it end-to-end (DataForSEO → DB → UI) with no extra API spend.Closes #44
Changes
00004_prompt_competition.sql— addscompetition_index(int) +competition(LOW/MEDIUM/HIGH) toprompt_volumes. Additive,IF NOT EXISTS, no RLS change.getSearchVolumesnow returns{ volume, competitionIndex, competition }per keyword. Callers updated:volumes.jsandtest-volumes.js.fetchAndSaveVolumescomputes a volume-weighted average competition index per prompt and derives the LOW/MEDIUM/HIGH label.google_volumesstays a{ keyword: number }map for the existing UI.prompt_volumesRow/Insert/Update insupabase.ts;PromptVolumeintypes/index.ts.CompetitionBars: 5 equal-height bars, green → dark red by level,—when null.AllPromptsTabwith a header tooltip clarifying it's a Google Ads proxy for topic difficulty.Honest framing
This is Google Ads paid-bid competition — a proxy for general topic difficulty, not true AEO difficulty (being cited by AI engines). The header tooltip says so. An AEO-native metric can replace it later.
Verification
typecheck+format:checkpass; no new lint errors.—(correct null state).Migration note
The migration is additive and idempotent. Apply via Supabase Studio SQL Editor or
supabase db push— safe to run before or after merge (IF NOT EXISTSmakes a re-run a no-op).Out of scope (per the issue)
Per-keyword competition breakdown, AEO-native composite difficulty, other pages, sort/filter by competition, MCP/REST exposure — all noted as follow-ups.