A web app that parses a website's sitemap, indexes URLs into Redis, scrapes page content, converts to Markdown, and caches prompts and responses using Redis LangCache to generate a searchable index. It's attempting to hack embedding to build a quick helpful (relevant) search.
- Sitemap Parsing: Automatically discovers and parses XML sitemaps (including sitemap indexes)
- Redis Integration: Uses Redis Cloud with the standard node-redis client for efficient data storage
- URL Indexing: Stores and manages URLs with metadata in organized Redis data structures
- Page Scraping: Fetches page content with retry logic and rate limiting
- Markdown Conversion: Converts HTML content to clean Markdown format
- AI Processing: Generates structured prompts and caches responses using LangCache
- Admin Dashboard: Real-time monitoring of processing status, cache statistics, and URL management
- Node.js 18+
- Redis Cloud account or local Redis instance
- OpenAI API key (or other AI provider)
Create a .env.local file with the following variables:
# Redis Cloud Configuration
REDIS_HOST=redis-xxxxx.c280.us-central1-2.gce.redns.redis-cloud.com
REDIS_PORT=10759
REDIS_USERNAME=default
REDIS_PASSWORD=your-redis-password
# LangCache Configuration
LANGCACHE_API_KEY=your-langcache-api-key# Redis URL Configuration
REDIS_URL=redis://default:your-password@your-redis-host:port
# LangCache Configuration
LANGCACHE_API_KEY=your-langcache-api-key
# Optional overrides (defaults shown)
# LANGCACHE_SERVER_URL=https://gcp-us-east4.langcache.redis.io
# LANGCACHE_CACHE_ID=477bdd847aa841ffa2852797d215dfc4
# LANGCACHE_USE_ATTRIBUTES=falseNote: The application will use explicit host/port configuration if REDIS_HOST is provided, otherwise it falls back to REDIS_URL.
npm installnpm run devOpen http://localhost:3000 to access the admin dashboard.
- Sitemap Discovery: Enter a domain or sitemap URL
- URL Extraction: Parse sitemap XML and extract all page URLs
- Redis Indexing: Store URLs with metadata in Redis sorted sets
- Page Scraping: Fetch HTML content for each URL
- Markdown Conversion: Convert HTML to clean Markdown
- Prompt Generation: Create structured prompts with page data
- AI Processing: Generate responses and cache with LangCache
- Cache Management: Retrieve cached responses for subsequent requests
sitemap:{domain} - Sitemap metadata
urls:{domain} - Sorted set of URL hashes
url:{urlHash} - Individual URL record
content:{urlHash} - Page content (Markdown)
prompt:{urlHash} - Cached prompt
response:{urlHash} - Cached AI response
status:{domain} - Processing status
- Redis Client (
lib/redis.ts): Singleton Redis connection with reconnection logic - Redis Service (
lib/services/redis-service.ts): Data access layer for all Redis operations - Sitemap Parser (
lib/services/sitemap-parser.ts): XML parsing and URL extraction - URL Indexer (
lib/services/url-indexer.ts): Batch URL indexing with progress tracking - Page Scraper (
lib/services/page-scraper.ts): HTML fetching and Markdown conversion - LangCache Service (
lib/services/langcache-service.ts): Prompt generation and caching - AI Processor (
lib/services/ai-processor.ts): AI response generation with cache integration - Processing Pipeline (
lib/services/pipeline.ts): Orchestrates the complete workflow
POST /api/sitemap/process- Process a sitemap URLPOST /api/sitemap/discover- Auto-discover sitemaps from domainPOST /api/process/domain- Process all URLs for a domainPOST /api/process/url- Process a single URLGET /api/status/[domain]- Get processing statusGET /api/urls/[domain]- Get indexed URLsGET /api/cache/stats- Get cache statisticsPOST /api/pipeline/run- Run complete processing pipeline
- Navigate to the dashboard
- Enter a sitemap URL or domain
- Click "Process Sitemap"
- Monitor progress in real-time
- View indexed URLs and cache statistics
curl -X POST http://localhost:3000/api/pipeline/run \
-H "Content-Type: application/json" \
-d '{"domain": "example.com", "sitemapUrl": "https://example.com/sitemap.xml"}'- Batch Processing: URLs are processed in configurable batches
- Rate Limiting: Configurable delays between requests
- Retry Logic: Exponential backoff for failed requests
- Cache TTL: 7-day default for content and responses
- Connection Pooling: Singleton Redis client with reconnection
- Environment variables for sensitive credentials
- Input validation for URLs and domains
- Rate limiting to prevent abuse
- Error handling without exposing internals
- Robots.txt compliance checking
MIT