Skip to content

pbuchman/motorscope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

276 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MotorScope MotorScope - Car Listing Tracker

CI License: MIT TypeScript React Chrome Extension Gemini AI Terraform GCP

MotorScope is a Chrome extension that helps you collect and track data from car listing platforms. It uses Google Gemini AI to extract vehicle information and monitor price changes over time.

πŸ“¦ Deployment

For infrastructure deployment and setup instructions, see terraform/DEPLOYMENT.md.

This is the single source of truth for deploying the MotorScope infrastructure to Google Cloud Platform.

🌐 Supported Marketplaces

Marketplace Country Status
OTOMOTO Poland πŸ‡΅πŸ‡± βœ… Fully tested
Autoplac Poland πŸ‡΅πŸ‡± βœ… Supported
Facebook Marketplace Global 🌍 βœ… Supported
Facebook Groups (buy/sell) Global 🌍 βœ… Supported

πŸ“ Note: Some features may require you to be logged in to the marketplace platform. Facebook listings require you to be logged into Facebook.

Facebook Support Details

MotorScope supports two types of Facebook car listings:

  1. Marketplace Items: Standard Facebook Marketplace listings

    • URLs like: facebook.com/marketplace/item/{id}
    • URLs like: facebook.com/commerce/listing/{id}
  2. Group Posts: Car listings posted in Facebook buy/sell groups

    • URLs like: facebook.com/groups/{groupId}/permalink/{postId}
    • URLs like: facebook.com/groups/{groupId}/posts/{postId}

Important: Facebook requires authentication and blocks server-side fetch requests. MotorScope opens Facebook listings in background tabs for refresh operations, which requires you to be logged into Facebook in your browser.

🎯 Why MotorScope?

Tracking car prices manually is tedious. MotorScope automates the process:

  • Collect historical price data automatically - no more manual spreadsheets
  • Track multiple listings from a single dashboard
  • Get notified when prices change
  • Archive listings to keep a record of expired or sold vehicles

✨ Features

Core Features

  • πŸ–±οΈ One-click Tracking: Open the extension popup on any car listing to start tracking
  • πŸ€– AI-Powered Extraction: Uses Gemini 2.5 Flash to parse page content into structured data (VIN, mileage, engine specs, seller info)
  • πŸ“ˆ Automated Price History: Builds historical price data over time with interactive charts - track price drops and increases
  • πŸ”„ Background Refresh: Periodically checks for price updates on tracked listings

Dashboard Features

  • πŸ“Š Grid & Compact Views: Switch between detailed grid cards and compact list view
  • πŸ” Advanced Filtering: Filter by status (Active/Sold/Expired), archive status, make, model, and marketplace source
  • πŸ“‹ Listing Details: Click on any listing to view comprehensive details in an overlay modal
  • 🏷️ Source Tags: See which marketplace each listing comes from at a glance
  • πŸ“‰ Price Comparison: Compact view shows total price change since first tracked
  • πŸ—„οΈ Archive System: Archive listings to exclude them from auto-refresh while keeping the data
  • πŸ”΄ ENDED Listing Handling: ENDED listings (sold/expired) are visually highlighted, price history is frozen, and they're excluded from auto-refresh after a configurable grace period (1-30 days)

Data Management

  • πŸ’Ύ Cloud Sync: Data synchronized with backend (when logged in with Google)
  • πŸ” Google Authentication: Secure sign-in to sync data across devices

πŸ—ƒοΈ Data Schema

Car listings are stored using a normalized JSON structure. See the full schema documentation:

πŸ“„ Car Listing JSON Schema

Key data fields extracted:

Category Fields
Vehicle VIN, make, model, generation, trim, body type, year, mileage, engine specs, drivetrain
Pricing Current price, original price, price history with dates, currency, negotiable flag
Origin Import country, registration country, seller location (city, region, postal code)
Condition New/used status, accident-free declaration, service history
Seller Type (private/dealer), name, phone number, company status
Tracking Posted date, first seen, last checked, status (active/sold/expired)

πŸ“‹ Prerequisites

  1. Node.js: v18 or higher
  2. Google Gemini API Key: Required for AI-powered data extraction

πŸš€ Installation

From Source

  1. Clone the repository

    git clone https://github.com/pbuchman/motorscope.git
    cd motorscope
  2. Install dependencies

    npm install
  3. Build the extension

    npm run build
  4. Load in Chrome

    • Open chrome://extensions/
    • Enable "Developer mode"
    • Click "Load unpacked"
    • Select the dist folder

πŸ› οΈ Development

# Install dependencies
npm install

# Run extension in development mode with hot reload
npm run dev:extension

# Run API in development mode
npm run dev:api

# Build everything for production
npm run build

# Build extension only
npm run build:extension

# Build API only
npm run build:api

# Run all tests
npm test

# Run linting
npm run lint

# Type check
npm run typecheck

# Clean build artifacts
npm run clean

πŸ—οΈ Tech Stack

  • Frontend: React 19.2, TypeScript 5.9, Tailwind CSS 4.1
  • Build Tool: Vite 5.1
  • AI: Google Gemini API (@google/genai 1.31)
  • Charts: Recharts 3.5
  • Icons: Lucide React
  • i18n: i18next (English & Polish)
  • Testing: Jest 29, React Testing Library
  • Extension: Chrome Manifest V3
  • Backend: Node.js 20, Express, Firestore

βš™οΈ Configuration

After installing the extension:

  1. Click the MotorScope icon in Chrome toolbar
  2. Go to Settings
  3. Enter your Gemini API key
  4. Set the refresh frequency (how often to check for price updates)

πŸ“ Project Structure

motorscope/
β”œβ”€β”€ extension/               # Chrome extension source
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/              # Reusable UI primitives
β”‚   β”‚   β”‚   β”œβ”€β”€ popup/           # Extension popup components
β”‚   β”‚   β”‚   β”œβ”€β”€ CarCard.tsx      # Grid view car card
β”‚   β”‚   β”‚   β”œβ”€β”€ CarCardCompact.tsx # Compact list view card
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx    # Main dashboard view
β”‚   β”‚   β”‚   └── SettingsPage.tsx # Extension settings
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   └── marketplaces.ts  # Supported marketplace configs
β”‚   β”‚   β”œβ”€β”€ services/        # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ gemini/          # AI data extraction
β”‚   β”‚   β”‚   β”œβ”€β”€ refresh/         # Background refresh logic
β”‚   β”‚   β”‚   └── settings/        # Settings management
β”‚   β”‚   β”œβ”€β”€ hooks/           # Custom React hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ useCurrentTab.ts     # Tab information
β”‚   β”‚   β”‚   β”œβ”€β”€ usePageContent.ts    # Page scraping
β”‚   β”‚   β”‚   └── useChromeMessaging.ts # Extension messaging
β”‚   β”‚   β”œβ”€β”€ i18n/            # Internationalization (EN/PL)
β”‚   β”‚   β”‚   └── locales/         # Translation files
β”‚   β”‚   β”œβ”€β”€ context/         # React context providers
β”‚   β”‚   β”œβ”€β”€ auth/            # Authentication
β”‚   β”‚   β”œβ”€β”€ api/             # API client
β”‚   β”‚   β”œβ”€β”€ utils/           # Helper functions
β”‚   β”‚   β”œβ”€β”€ background.ts    # Service worker
β”‚   β”‚   └── App.tsx          # Main React app
β”‚   β”œβ”€β”€ manifest.json        # Chrome extension manifest
β”‚   └── docs/                # Extension documentation
β”œβ”€β”€ api/                     # Backend API server
β”‚   └── src/
β”‚       β”œβ”€β”€ index.ts         # Express server entry
β”‚       β”œβ”€β”€ routes.ts        # API routes
β”‚       β”œβ”€β”€ auth.ts          # Authentication handlers
β”‚       β”œβ”€β”€ db.ts            # Firestore database layer
β”‚       └── migrations/      # Database migrations
β”œβ”€β”€ docs/                    # Project documentation
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml           # CI/CD pipeline
└── scripts/                 # Utility scripts

πŸ”’ Privacy & Security

  • βœ… API calls to Gemini are made directly from your browser
  • βœ… No third-party tracking or analytics
  • βœ… Google Sign-in uses secure OAuth 2.0 flow
  • βœ… Backend only stores listing data you choose to track
  • βœ… All communication with backend is over HTTPS
  • βœ… Listing images are stored in Google Cloud Storage with automatic expiration

☁️ Infrastructure & Deployment

The MotorScope backend runs on Google Cloud Platform (GCP). Infrastructure is managed using Terraform.

Project Configuration

Environment Project ID Region
Development motorscope-dev europe-west1
Production TBD europe-west1

Resources

Service Description
Firestore NoSQL database (users, listings, settings)
Cloud Storage Listing image storage with lifecycle management
Cloud Run Containerized API service
Artifact Registry Docker image repository
Secret Manager Secure credential storage

Deploy Infrastructure

πŸ“– Complete deployment guide: terraform/DEPLOYMENT.md

Quick start:

cd terraform/environments/dev
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with motorscope-dev project details
terraform init
terraform apply

After deployment, configure secrets and deploy the API container. See full instructions in terraform/DEPLOYMENT.md.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“š Documentation Structure

Document Purpose
This README Complete project overview (functional + technical)
terraform/DEPLOYMENT.md Infrastructure deployment guide (single source of truth)
extension/docs/architecture.md Extension architecture details
docs/auth-flow.md Backend authentication flow

Note: Documentation is intentionally minimal. Each document has a single purpose. Do not duplicate content across documents β€” reference other files instead.


Made with ❀️ for car enthusiasts

About

Chrome extension and the backend API that helps you collect and track data from car listing platforms.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors