Complete Guide
Everything you need to know about Miata Maestro
Contents
Overview
Miata Maestro is a specialized web scraper designed to help Mazda Miata enthusiasts find NA Miatas (1989-1997) on Facebook Marketplace. Built with modern web technologies and AI integration, it provides intelligent analysis and automation for car hunting.
๐ฏ Purpose
Automate the tedious process of browsing Facebook Marketplace for specific Miata listings with intelligent filtering and AI-powered analysis.
๐๏ธ Design Philosophy
Modular architecture for easy debugging, zero configuration for quick setup, and privacy-first approach with session-only storage.
๐ Performance
Processes 15-25 listings per minute with 2-5 second AI analysis times. Optimized for both speed and accuracy.
Architecture
Miata Maestro uses a clean, modular architecture with three core files, each handling a specific responsibility.
main.js
320 linesResponsibilities:
- Express server setup and configuration
- Session management and authentication
- Route definitions and HTML templates
- Real-time progress tracking via SSE
- Coordinate calls to llm.js and scraper.js
llm.js
131 linesResponsibilities:
- Ollama API client and integration
- Listing evaluation with structured prompts
- Lowball message generation
- Multi-provider LLM support
- Error handling for AI services
scraper.js
580 linesResponsibilities:
- Puppeteer browser lifecycle management
- Facebook login and navigation
- Marketplace search and data extraction
- Anti-detection and human simulation
- Listing filtering and validation
Benefits of This Architecture
Features Deep Dive
๐ Smart Search & Filtering
Advanced filtering system designed specifically for NA Miata hunting:
- ZIP code-based location targeting
- Customizable search radius (1-500 miles)
- Automatic coordinate conversion
- Year range targeting (1989-1997 for NA)
- Mileage thresholds with validation
- Optional price limits
- Transmission type detection
- Automatic Miata keyword detection
- Parts-only listing exclusion
- Duplicate listing removal
- Quality score assessment
๐ค AI-Powered Analysis
Local AI processing for intelligent listing evaluation:
๐ Market Analysis
- Fair market value estimation
- Price comparison with similar listings
- Regional market trends
๐ Condition Assessment
- Pros and cons identification
- Red flag detection
- Maintenance history analysis
๐ฌ Negotiation Support
- Strategic lowball calculations
- Natural message generation
- Contextual negotiation angles
๐จ User Interface
Modern, responsive interface with glassmorphism design:
Configuration
Miata Maestro requires minimal configuration. Most settings are handled through the web interface.
๐ง Search Parameters
zip
radius
yearMin/Max
maxMileage
maxPrice
limit
๐ค AI Configuration
AI Integration
Miata Maestro's AI features provide intelligent analysis using local language models for privacy and speed.
๐ง How AI Analysis Works
๐ Prompt Engineering
Carefully crafted prompts ensure consistent, useful analysis:
Evaluation Prompt Structure:
You are an expert Mazda Miata evaluator. Analyze this NA Miata listing:
LISTING DATA:
- Title: [listing title]
- Year: [year]
- Price: [price]
- Mileage: [mileage]
- Transmission: [transmission]
- Description: [description]
Provide analysis in this exact HTML format:
<strong>Pros:</strong>
โข [positive aspects]
<strong>Concerns:</strong>
โข [potential issues]
<strong>Accurate Price:</strong> $[market value]
<strong>Lowball:</strong> $[strategic offer]
๐ฌ Message Generation
AI creates natural, contextual negotiation messages:
Debugging & Development
Miata Maestro's modular architecture makes debugging straightforward. Issues are isolated to specific components.
๐ Debug Mode
Enable debug mode for detailed logging and limited processing:
๐ Troubleshooting by Component
๐ฅ๏ธ Server Issues (main.js)
- Port conflicts or binding errors
- Session management problems
- Route handling issues
- HTML template errors
๐ค AI Problems (llm.js)
- Ollama connection failures
- Model loading issues
- Prompt formatting errors
- Response parsing problems
๐ Scraping Issues (scraper.js)
- Facebook login failures
- Page navigation errors
- Selector changes
- Data extraction problems
๐ ๏ธ Development Tools
debug-*.png
on errors
Development
Contributing to Miata Maestro or customizing it for your needs.
๐๏ธ Project Structure
Miata Maestro/
โโโ main.js # Express server & routes
โโโ llm.js # AI evaluation logic
โโโ scraper.js # Puppeteer automation
โโโ package.json # Dependencies
โโโ public/
โ โโโ styles.css # Glassmorphism UI
โโโ fb_user_data/ # Browser session storage
โโโ docs/ # Documentation website
โโโ debug-*.png # Debug screenshots
๐ง Development Setup
npm install --save-dev nodemon
npx nodemon main.js
for auto-reload
๐ฏ Extension Ideas
๐ Other Car Models
Adapt filtering logic for different vehicles (S2000, 350Z, etc.)
๐ Analytics Dashboard
Track price trends, listing frequency, and market insights
๐ Notification System
Email/SMS alerts for listings matching specific criteria
๐ Multiple Platforms
Extend to Craigslist, AutoTrader, or other marketplaces
Security & Privacy
Miata Maestro prioritizes user privacy and security with session-only storage and local AI processing.
๐ Privacy Features
โก Security Best Practices
- Credentials stored only in server memory
- Automatic cleanup on session end
- No logging of sensitive information
- HTTPS-only connections to Facebook
- Secure cookie configuration
- Rate limiting to prevent abuse
- Human-like behavior simulation
- Random delays between actions
- Respectful scraping practices
โ ๏ธ Important Notes
- Facebook Terms: Use responsibly and in accordance with Facebook's terms of service
- 2FA: Temporarily disable two-factor authentication if login fails
- Account Safety: Consider using a secondary Facebook account for scraping
- Rate Limits: Don't run multiple instances simultaneously