Keyword Viewer
Search keyword analytics viewer (Vite + React)
Keyword Viewer
Web app for viewing search keyword analytics collected by the Search API.
Architecture
sub-packages/keyword-viewer/ # Vite + React web app
| Property | Value |
|---|---|
| Stack | Vite + React 19 + Tailwind CSS v4 + React Router |
| Port | 60622 |
| Start | cd sub-packages/keyword-viewer && pnpm dev |
| API | Fetches from VITE_API_BASE_URL (default: https://takazudomodular.com) |
Features
Dashboard (/)
- Total searches, unique keywords, today’s count, weekly count
- Top 10 keywords table
- Daily volume chart with 7/30 day toggle
Keywords List (/keywords)
- Full keyword list with count and last-searched date
- Sortable by keyword name, count, or last searched
Data Fallback
When the API is unreachable (e.g., local development without Netlify Functions), the app falls back to deterministic mock data with a “demo data” banner.
Data Flow
User searches on site
-> search.ts logs to Netlify Blobs ('keyword-logs' store)
-> keyword-logs.ts reads from same store
-> keyword-viewer fetches /api/keyword-logs
-> Displays analytics
Environment Variables
| Variable | Default | Description |
|---|---|---|
VITE_API_BASE_URL | https://takazudomodular.com | Base URL for API requests |
Configure in sub-packages/keyword-viewer/.env.
Key Files
src/App.jsx— Route configuration (Dashboard, Keywords)src/components/dashboard.jsx— Dashboard with stats and tablessrc/components/keyword-list.jsx— Sortable keyword tablesrc/components/layout.jsx— App shell with navigationsrc/utils/api.js— API client with mock data fallbacksrc/utils/stats.js— Keyword statistics aggregationsrc/utils/mock-data.js— Deterministic mock data generator