An intelligent search application powered by Google Gemini AI that transforms user queries into comprehensive, well-researched responses - similar to Perplexity or Grok AI.
π Quick Start β’ π Features β’ ποΈ Architecture β’ π§ API Reference β’ π€ Contributing
- π§ Query Decomposition: Intelligently breaks down complex questions into sub-questions
- π Chain-of-Thought Reasoning: Connects related concepts and builds logical responses
- π Multi-Source Analysis: Executes targeted searches based on AI analysis
- β‘ Intelligent Synthesis: Uses Gemini AI to analyze and synthesize information from multiple sources
- β Follow-up Questions: Generates relevant follow-up questions to explore topics deeper
- π Real-time Progress: Step-by-step processing updates in the UI
- π Text Search: Comprehensive web search using DuckDuckGo
- π° News Search: Latest news and articles
- πΌοΈ Image Search: Visual content discovery
- β‘ Parallel Processing: High-volume query handling
- π§ Cognitive Bias Analysis: Identifies and categorizes cognitive biases
- πΎ Universal Caching: In-memory, file-based, or Redis caching options
- π‘οΈ Rate Limiting: Conservative API usage with retry logic
- π Security: Helmet, CORS, and input validation
- π± Responsive UI: Modern React interface with Tailwind CSS
- π Error Handling: Graceful degradation and comprehensive error management
graph TB
A[User Interface<br/>React + Tailwind] --> B[API Gateway<br/>Express.js]
B --> C[AI Service<br/>Gemini Pro]
B --> D[Search Service<br/>DuckDuckGo]
B --> E[Cache Service<br/>Universal Cache]
E --> F[Memory Cache]
E --> G[File Cache]
E --> H[Redis Cache]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#fff3e0
style D fill:#e8f5e8
style E fill:#fce4ec
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 18 + Vite + Tailwind CSS | Modern, responsive user interface |
| Backend | Node.js + Express | RESTful API server |
| AI Engine | Google Gemini Pro API | Query analysis and response synthesis |
| Search | DuckDuckGo (duck-duck-scrape) | Web search functionality |
| Caching | Universal Cache System | Performance optimization |
| Security | Helmet + CORS + Validation | Comprehensive security layer |
- Node.js (v16 or higher)
- npm or yarn
- Google Gemini API Key (Get one here)
- Redis (optional, for advanced caching)
git clone https://github.com/yourusername/deepsearch-ai.git
cd deepsearch-aicd backend
npm install
# Configure environment variables
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY
npm startcd ../frontend
npm installCreate .env file in the backend directory:
# π€ AI Configuration (Required)
GEMINI_API_KEY=your_gemini_api_key_here
# π Server Configuration
PORT=3000
NODE_ENV=development
CORS_ORIGIN=http://localhost:5174
# πΎ Caching Configuration
CACHE_TYPE=memory
REDIS_URL=redis://localhost:6379
REDIS_ENABLED=falseπ Important: Get your Gemini API key from Google AI Studio
# Terminal 1: Start Backend
cd backend
npm start
# Terminal 2: Start Frontend
cd frontend
npm run dev- π Frontend: http://localhost:5174
- π§ Backend API: http://localhost:3000
- π Health Check: http://localhost:3000/health
POST /api/ai
Content-Type: application/json
{
"query": "How does quantum computing work?"
}Response Structure:
{
"query": "How does quantum computing work?",
"timestamp": "2024-01-01T00:00:00.000Z",
"decomposition": {
"coreQuestion": "How does quantum computing work?",
"subQuestions": ["What are qubits?", "How do quantum gates work?"],
"chainOfThought": "To understand quantum computing..."
},
"response": "# How Quantum Computing Works\n\n...",
"sources": [...],
"followUpQuestions": [...],
"processingSteps": {...}
}GET /api/ai/healthGET /api/ai/simple?q=machine%20learningGET /api/search?q={query}&type={text|news|images}GET /api/search/bias?q={query}POST /api/search/parallel
Content-Type: application/json
{
"queries": ["AI trends", "Machine learning"],
"type": "text"
}| Cache Type | Speed | Persistence | Use Case |
|---|---|---|---|
memory |
β‘β‘β‘ | β | Development (Default) |
file |
β‘ | β | Simple persistence |
redis |
β‘β‘β‘ | β | Production scaling |
disabled |
β‘β‘ | N/A | Testing |
Switch cache types by changing CACHE_TYPE in .env:
CACHE_TYPE=memory # or file, redis, disabled- Helmet: Security headers and XSS protection
- CORS: Cross-origin request management
- Rate Limiting: DDoS protection with exponential backoff
- Input Validation: Query sanitization and validation
- Error Handling: Secure error responses
- Rate Limiting: 5-second delays between DuckDuckGo requests
- Retry Logic: Exponential backoff for failed requests
- Cache TTL: 1-hour default for search results
- Request Limits: Conservative API usage patterns
# Test main AI functionality
curl -X POST "http://localhost:3000/api/ai" \
-H "Content-Type: application/json" \
-d '{"query": "How does machine learning work?"}'
# Check AI service health
curl "http://localhost:3000/api/ai/health"# Test all cache alternatives
cd backend
node test-cache.js# Test general search
curl "http://localhost:3000/api/search?q=artificial%20intelligence&type=text"
# Test cognitive bias analysis
curl "http://localhost:3000/api/search/bias?q=confirmation%20bias"deepsearch-ai/
βββ π backend/
β βββ π src/
β β βββ π api/
β β β βββ π§ aiSearch.js # Main AI search endpoint
β β β βββ π search.js # Traditional search endpoints
β β βββ π services/
β β β βββ π€ geminiService.js # Google Gemini AI integration
β β β βββ πΎ cacheService.js # Universal caching system
β β βββ π utils/
β β β βββ π¦ duckduckgo.js # DuckDuckGo search wrapper
β β βββ π server.js # Express server setup
β βββ π cache/ # File-based cache storage
β βββ βοΈ .env # Environment configuration
β βββ π¦ package.json # Dependencies and scripts
βββ π frontend/
β βββ π src/
β β βββ π components/
β β β βββ π§ AISearchApp.jsx # Main React component
β β βββ π― main.jsx # React entry point
β β βββ π¨ index.css # Tailwind CSS styles
β βββ π index.html # HTML template
β βββ β‘ vite.config.js # Vite configuration
β βββ π¦ package.json # Dependencies and scripts
βββ π README.md # This file
-
DuckDuckGo Rate Limiting
- Conservative 5-second delays between requests
- Limited to 1-2 searches per AI query to avoid blocking
- Retry logic with exponential backoff
-
Search Engine Constraints
duck-duck-scrape@2.2.7lacks proper news method- News searches approximated via filtered general searches
- Image search may have inconsistent results
-
AI Processing Time
- Complex queries can take 20-30 seconds
- Multiple API calls to Gemini for decomposition and synthesis
- Network latency affects response times
- Universal caching for improved performance
- Graceful degradation when services are unavailable
- Conservative rate limiting to prevent API blocks
- Error handling with fallback responses
-
Enhanced Search Integration
- Multiple search engine support (Bing, Google Custom Search)
- Improved news and image search capabilities
- Real-time search result streaming
-
Advanced AI Features
- Multi-language support
- Voice input/output capabilities
- Conversation memory and context
-
Performance Improvements
- Search result caching optimization
- Parallel AI processing
- CDN integration for static assets
-
User Experience
- Search history and bookmarks
- Customizable UI themes
- Mobile app development
-
Testing Suite
- Unit tests for all components
- Integration tests for API endpoints
- End-to-end testing with Playwright
-
Monitoring & Analytics
- Application performance monitoring
- User analytics and insights
- Error tracking and alerting
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test thoroughly
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow the existing code style and conventions
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
- Use the GitHub issue tracker
- Include detailed reproduction steps
- Provide system information and logs
- Add screenshots if applicable
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Gemini AI for powerful language processing
- DuckDuckGo for privacy-focused search capabilities
- React & Tailwind CSS for modern UI development
- Node.js & Express for robust backend infrastructure
- π§ Email: solomonmatthewss@gmail.com
- π Issues: GitHub Issues
- π Documentation: Wiki
β Star this repository if you find it helpful!
Made with by Solomon Matthews