Features
- Intelligent Product Recommendations beyond simple spec comparison
- Priority-Based Value Alignment (Best Value, Eco‑Friendly, Ethical, Durability, Made in India)
- Contextual Personalization (skin type, usage patterns, region, etc.)
- Structured Research Output with:
- Research summary and top recommendations
- Value alignment with reasoning
- Pros/Cons and key specifications
- User sentiment and community insights (Reddit, Quora)
- Trade‑off analysis and buying tips
- Transparent Sources with citations for verification
Prerequisites
- Node.js 18+ and npm/yarn
- Python 3.10+ and pip
- Perplexity API key
Installation
Configuration
Create a.env
file in the backend directory:
Usage
-
Start Backend (FastAPI):
-
Start Frontend (Next.js):
-
Open the App: Visit
http://localhost:3000
and search for a product. Select your priority (e.g., Eco‑Friendly) and add optional context (skin type, region).
Code Explanation
- Backend (FastAPI): Orchestrates Sonar calls with dynamic prompt engineering based on query, selected priority, and context
- Structured Outputs: Enforces a strict JSON schema via
response_format
to ensure consistent UI rendering - Live Web Research: Directs Sonar to search e‑commerce platforms, forums, review blogs, and sustainability reports
- Semantic Analysis: Extracts value alignment, pros/cons, sentiment, and cites sources for transparency
- Frontend (Next.js/React): Presents a clear, user‑friendly view of recommendations, trade‑offs, and citations
How the Sonar API Is Used
PerplexiCart leverages the Perplexity Sonar API as its intelligence core, dynamically generating customized prompts based on user inputs like search queries, priorities and context. The API performs comprehensive web research across e-commerce sites, forums, and review platforms, with responses structured in a consistent JSON format. Through semantic analysis, it extracts key product insights including alignment with user priorities, pros/cons, and sentiment - all backed by cited sources. The FastAPI backend processes these structured responses before serving them to the Next.js frontend for a polished user experience.Links
- Live Demo: https://perplexicart.vercel.app/
- GitHub Repository: https://github.com/fizakhan90/perplexicart