A minimal, fast search engine built with modern web technologies. Apex uses advanced search algorithms including inverted indices, tries for autocomplete, and intelligent caching for optimal performance.
- β‘ Fast Search - Optimized inverted index with binary search for lightning-fast queries
- π Autocomplete - Real-time search suggestions powered by Trie data structure
- πΎ Smart Caching - Redis-powered result caching for instant subsequent searches
- π― Fuzzy Matching - Find results even with partial queries using Levenshtein distance
- π± Responsive Design - Beautiful, minimal UI that works on all devices
- π URL Persistence - Search results and queries persist in the URL for easy sharing
- π Dark Mode - Toggle between light and dark themes
- π Search History - Track and revisit your recent searches
- π‘οΈ Safe Search - Filter inappropriate content
- π Security - Built-in protection against NoSQL injection and XSS attacks
- π€ Data Export - Export your search history and settings as JSON
- β‘ Performance Tracking - View search response times
- π Pagination - Browse through large result sets
- β¨ Query Corrections - Get spelling suggestions for typos
- React 18 - UI framework
- TypeScript - Type safety
- Vite - Build tool
- Framer Motion - Smooth animations
- Tailwind CSS - Styling
- Axios - HTTP client
- Lucide React - Icons
- React Router v6 - Client-side routing
- Radix UI - 50+ accessible UI components
- React Hook Form - Form handling with Zod validation
- Recharts - Data visualization
- next-themes - Dark mode management
- Sonner - Toast notifications
- cmdk - Command palette
- React Resizable Panels - Flexible layouts
- Express.js 5 - Web framework
- TypeScript - Type safety
- MongoDB - Primary document storage
- PostgreSQL - Alternative database with Prisma ORM
- Redis - Search result caching
- Prisma - Type-safe database queries
- Helmet - Security headers
- Custom Search Algorithms:
- Inverted Index with binary search
- Trie (Prefix Tree) for autocomplete
- MinHeap for ranking suggestions
- Levenshtein distance for fuzzy matching
- Node.js 18+
- MongoDB (local or Atlas) - Primary database
- PostgreSQL (optional, for Prisma)
- Redis (optional, for caching)
- Clone the repository:
git clone https://github.com/DevDad-Main/Apex.git
cd Apex- Install dependencies:
# Install client dependencies
cd client
npm install
# Install server dependencies
cd ../server
npm install- Configure environment variables:
Server (.env in server folder):
MONGO_URI=your_mongodb_connection_string
REDIS_URL=your_redis_url
PORT=3000Client (.env in client folder):
VITE_API_URL=http://localhost:3000- Start the development servers:
# Terminal 1 - Start backend
cd server
npm run dev
# Terminal 2 - Start frontend
cd client
npm run dev- Open http://localhost:5173 in your browser
# Build client
cd client
npm run build
# Build server
cd ../server
npm run build| Method | Endpoint | Description |
|---|---|---|
| GET | /apex/search?query=<query>&page=<page> |
Search for documents |
| GET | /apex/autocomplete?q=<prefix> |
Get search suggestions |
| POST | /apex/scrape |
Scrape and index a URL |
| GET | /apex/document/:id |
Get a specific document |
| GET | /apex/document |
Get all documents |
| DELETE | /apex/document |
Delete all documents |
| GET | / |
Health check endpoint |
# Search for "javascript"
curl "http://localhost:3000/apex/search?query=javascript"
# Get autocomplete suggestions
curl "http://localhost:3000/apex/autocomplete?q=jav"
# Scrape a URL
curl -X POST "http://localhost:3000/apex/scrape" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'- User enters a search query
- Frontend sends request to
/apex/search - Backend checks Redis cache first
- If not cached, searches inverted index using binary search
- Results are cached and returned
- Frontend displays results with animations
- Response time is tracked and displayed
- Inverted Index: Maps terms to documents for fast full-text search
- Binary Search: O(log n) lookup for prefix matching
- Trie: Prefix tree for O(m) autocomplete where m = query length
- MinHeap: Efficient ranking of autocomplete suggestions by relevance
- Levenshtein Distance: Calculate edit distance for fuzzy matching
- Helmet.js: Secure HTTP headers
- NoSQL Injection Protection: Custom middleware to sanitize user input
- XSS Protection: HTML entity escaping for user input
- HPP Protection: HTTP Parameter Pollution prevention
- CORS: Configurable cross-origin resource sharing
- Input Validation: Type-safe request handling
- Search history stored in browser localStorage
- User preferences (dark mode, safe search, history toggle) persisted locally
- Data export functionality to download all user data as JSON
- MongoDB for document storage and search indexing
- PostgreSQL with Prisma as alternative ORM option
- Redis for caching search results
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT
Built with β€οΈ by DevDad










