Commit 0e07cd0
Add API Playground, tracking refactor, and admin analytics (#118)
* Add API Playground, tracking refactor, admin analytics, and dashboard UX improvements
## API Playground
- New /dashboard/playground page with Tavily-inspired UI
- Left panel: query input, include answer toggle, collapsible additional fields
(API key, max results, ranking mode, include summary, filters)
- Right panel: Code view (Python/JS/Shell/Go with syntax highlighting) and
Response view (Preview with clickable result cards + JSON with line numbers)
- Per-result thumbs up/down feedback stored in playground_feedback table
- Code copy uses full API key; display uses masked version
## Tracking Links Refactor
- Permanent short_id on retrieval_units (deterministic sha256 hash)
- Search no longer writes per-request tracking_links rows (zero DB writes)
- Redirect handler dynamically builds target URL from current video data
- Legacy tracking_links fallback for old links
- query_logs.results_preview stores request-level result snapshots
- search_surface field distinguishes API vs playground searches
## Admin Analytics
- New /admin/analytics page with impression-aware CTR metrics
- Content and creator performance leaderboards with min-impression thresholds
- Search quality views: top queries, empty results, position CTR
- Playground feedback analysis (explicitly labeled playground-only)
## API Key Management
- Key prefix changed from cerul_sk_ to cerul_ (backwards compatible)
- Raw API keys stored in database for later viewing
- Auto-create Default key on user signup
- Prevent deletion of last active key (403)
- Tavily-style key display: masked by default, eye icon reveals for 5s, copy full key
## Dashboard UX
- Playground added to sidebar with terminal icon
- Top nav buttons use opaque backgrounds (fix dark overlay bleed-through)
- Create key dialog: rounded corners, higher z-index
- Dashboard layout: conditional header rendering
- Fixed viewport-height playground layout with internal scrolling
## Migrations
- 015: playground_feedback table
- 016: retrieval_units.short_id + query_logs.results_preview
- 017: query_logs.search_surface
- 018: api_keys.raw_key storage
## Documentation
- CLAUDE.md: Neon ops, proxy/workerd, architecture notes
- docs/tracking-links-refactor.md
- docs/admin-analytics-plan.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Harden API key handling and playground flows
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 513c205 commit 0e07cd0
42 files changed
Lines changed: 7349 additions & 413 deletions
File tree
- api
- src
- middleware
- routes
- services
- db/migrations
- docs
- frontend
- app
- admin/analytics
- dashboard/playground
- v/[shortId]/[[...path]]
- components
- admin
- dashboard
- lib
- workers/unified
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments