Add Pharmacy Panic — real-time medicine price comparison across Vietnam's pharmacy chains#84
Conversation
…cout Add Vietnam Bike Price Scout cookbook example
- Initialize pharmacy-panic/ directory at repo root - Match exact dependency versions from viet-bike-scout (Next 16.1.6, React 19.2.3, Zod 4.3.6) - Copy all config files: tsconfig, next.config, postcss, eslint, components.json - Add Tailwind 4 theme with oklch variables - Add layout with Pharmacy Panic metadata + Geist fonts - Add placeholder page.tsx - Add .env.example and .gitignore
… components - Add PharmacyProduct, PharmacyResult, StreamingPreview, SearchState types - Add VND price normalization with Vietnamese format handling - Add dosage form, stock status, and per-unit price normalization - Add Zod env validation (API key required, Supabase optional) - Add Supabase client with tryGetSupabase() graceful degradation - Install shadcn/ui: button, card, badge, skeleton components
- POST /api/search with SSE streaming response - Parallel scraping of 5 pharmacy chains via Promise.allSettled - GOAL_PROMPT for Vietnamese pharmacy product extraction - Cache-aside pattern with optional Supabase (fire-and-forget writes) - normalizePharmacyResult + isEmptyResult for anti-bot detection - runtime=nodejs, maxDuration=800
- Add usePharmacySearch() hook with SSE stream consumption - Handle STREAMING_URL, PHARMACY_RESULT, SEARCH_COMPLETE events - Max 5 iframes, dedup by siteUrl, abort support - Add LivePreviewGrid component (near-verbatim from viet-bike-scout)
- Add pharmacy-badge, product-card, pharmacy-group, savings-banner components - Add results-grid container component - Build main page with search input, category presets, live preview - Preset buttons auto-search on click (Paracetamol, Vitamin C, etc.) - Progress bar, loading skeletons, error state, empty state - No inline styles — all Tailwind classes
- Add vitest config with path aliases - Test normalizePrice: VND formats, null handling, edge cases - Test normalizeDosageForm: Vietnamese to English mapping - Test normalizeStockStatus: stock status normalization - Test computePricePerUnit, formatVND, isEmptyResult - Test normalizePharmacyResult: full pipeline integration
- Add README.md with all 7 CONTRIBUTING.md-required sections - Fix unused variable lint warnings (REQUEST_STAGGER_MS, PharmacyResult import) - Architecture diagram, API snippet, setup instructions included
- Fix auth header: X-API-Key not Authorization Bearer - Remove fake output_schema from API snippet - Update pharmacy count to 5 (add Guardian, Medicare) - Update architecture diagram to show all 5 chains - Remove unused REQUEST_STAGGER_MS constant
…acies - Fix event field names: streaming_url (snake_case), event.result (not resultJson) - Fix COMPLETE event check: type=COMPLETE + status=COMPLETED - Restore Guardian and Medicare to PHARMACY_SITES - Fix search URLs to match plan spec (key= for Long Chau, q= for Pharmacity)
…on partial success - Hide LivePreviewGrid when isSearching becomes false (iframes removed from DOM) - Suppress network error if results already received (connection drop after partial success) - Mark elapsed as 'partial' when connection drops mid-stream with results
… drop - setInterval sends ': keepalive' SSE comment every 15 seconds - Prevents proxy/browser from killing idle connection during long TinyFish scrapes - Cleared before controller.close() to avoid writing to closed stream
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can suggest fixes for GitHub Check annotations.Configure the |
- Dosage forms: Viên nén→Tablet, Viên nang→Capsule, Siro→Syrup, etc. - Stock status: Còn hàng→In Stock, Hết hàng→Out of Stock, Cần toa→Rx Required - Error/empty states: Lỗi→Error, Không tìm thấy→No results found - Contact for price, product count labels - Product names remain Vietnamese (from pharmacy sites)
|
PR link: #84 Part of a 3-app contribution batch for Vietnamese market tools:
|
Summary
pharmacy-panic/— real-time medicine and health product price comparison across Vietnam's 5 major pharmacy chains (Long Châu, Pharmacity, An Khang, Guardian, Medicare)What it does
Users search for any medicine or health product (e.g. "Paracetamol", "Vitamin C"). TinyFish browser agents scrape all 5 pharmacy chains simultaneously via SSE, streaming results back in real-time with:
Tech Stack
Next.js 16 (App Router) · React 19 · TypeScript (strict) · Tailwind CSS 4 · shadcn/ui · Zod · Supabase (optional) · TinyFish SSE API
Key files
src/app/api/search/route.tssrc/hooks/use-pharmacy-search.tssrc/lib/normalize.tssrc/lib/env.tssrc/app/page.tsxVerification
npm run build✅npm run lint✅ (0 errors, 0 warnings)npx tsc --noEmit✅npx vitest run✅ (54 tests pass)