How k3tikvats/perplexity_clone works
Main Components
A. Frontend Layer (Flutter)
• Present as a multi-platform application container
• Main UI components:
• Home Page
• Chat Page
• Search Components
• Sidebar Navigation
B. Backend Server (Python)
• FastAPI/Python server structure
• Three main services:
• LLM Service (Gemini API integration)
• Search Service (Tavily API integration)
• Source Sorting Service
C. External Services
• Gemini API
• Tavily API
• Vector Embedding Service
[Client Layer]
• ↕️
[Backend Layer]
• ↕️
[External Services Layer]
Component Details
Frontend (Flutter):
• Main widget tree structure:
• Pages (home_page.dart, chat_page.dart)
• Widgets (search_bar_button.dart, search_section.dart, side_bar.dart)
• Services (chat_web_service.dart)
Backend (Python):
• Main service components:
• main.py (API endpoints)
• services/
• llm_service.py
• search_service.py
• sort_source_service.py
• pydantic_models/
• chat_body.py
User Query Flow
• User Input → Frontend → Backend → External Services
Response Flow
• External Services → Backend Processing → Frontend Display
Architectural Patterns to Highlight
• Service-oriented architecture
• Clean separation between UI and business logic
• Microservices-like backend structure
• API Gateway pattern for external service integration
Implementation Details
[Flutter UI Layer]
• Pages
• Widgets
• Services
[Python Backend Layer]
• API Endpoints
• Services
• Models
[External Services Layer]
• Gemini API
• Tavily API
• Vector Embeddings
Additional Elements
• Version/environment information
• Security boundaries
• Stateless/stateful components