Skip to content

ShJavokhir/patentswithcode

Repository files navigation

PatentsWithCode

Turn software patents into interactive demos. Enter a search term like "pull to refresh" or "pinch to zoom," and the system finds the relevant patent, extracts the core invention, generates implementation specs, writes the code, and renders it as a working component you can interact with.

How It Works

  1. Patent Search - User enters query → MCP searches Google Patents/USPTO for matching patent
  2. Spec Generation - Groq LLM reads patent PDF → generates <500 word technical specification focused on core patented interaction
  3. Code Generation - Claude Code in E2B environment converts spec → single React component (frontend-only, no APIs, <30 second demo)
  4. Sandbox Execution - E2B runs generated code in isolated environment
  5. Display - User sees interactive component demonstrating the patent

Generated specs and code are cached in Supabase to avoid regenerating popular patents.

Tech Stack

  • Frontend: Next.js (TypeScript)
  • LLM (specs): open-sourced LLM served via Groq
  • Coding Agent: Claude Code via E2B
  • Sandbox: E2B
  • Database: Supabase
  • Patent Access: Docker MCP Hub (public patent databases)

Project Structure

/app                 # Next.js app router
/components          # React components
/lib
  /mcp              # Patent search integration
  /groq             # Spec generation
  /e2b              # Sandbox + Claude Code execution
  /supabase         # Database client
/public              # Static assets

API Endpoints

The backend FastAPI server (patent-search/ps.py) provides three endpoints:

  1. POST /search - Search for patents using Exa

    • Request: {"query": "your search term"}
    • Response: Top 10 Google Patents results with title, url, snippet
    • Note: Query is automatically prefixed with "google patent"
  2. POST /search-and-scrape - Full pipeline (search + scrape)

    • Request: {"query": "your search term"}
    • Response: Full patent text extracted from found URL
  3. POST /scrape - Scrape specific patent URL

    • Request: {"url": "https://patents.google.com/patent/..."}
    • Response: Full patent text from the URL

Setup

# Install backend dependencies
uv sync

# Install frontend dependencies
cd frontend && npm install

# Environment variables (.env.local in root)
EXA_API_KEY=
FIRECRAWL_API_KEY=
OPENAI_API_KEY=

# Run backend server (port 8000)
python patent-search/ps.py

# Run frontend (port 3000)
cd frontend && npm run dev

Limitations

  • Demos are simplified - they show the core patented interaction, not full commercial implementations
  • Single React component only - no backend, external APIs, or multi-file architectures
  • Patent legalese is reduced to essential technical concepts for implementation
  • Not all patents are feasible to demo (hardware-dependent, backend-heavy systems)
  • Educational/research purposes only

Notes

All patents (expired and active) are included. The project visualizes publicly available patent documents as interactive demos to make technical innovations more accessible. Generated code is not production-ready and exists solely to illustrate patented concepts.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors