Skip to content

Repository files navigation

 ░██████                                   ░████████
 ░██   ░██                                  ░██    ░██
░██         ░███████  ░████████  ░██    ░██ ░██    ░██  ░██░████  ░███████  ░██    ░██    ░██  ░███████  ░██░████ ░██    ░██
░██        ░██    ░██ ░██    ░██ ░██    ░██ ░████████   ░███     ░██    ░██ ░██    ░██    ░██ ░██    ░██ ░███     ░██    ░██
░██        ░██    ░██ ░██    ░██ ░██    ░██ ░██     ░██ ░██      ░█████████  ░██  ░████  ░██  ░█████████ ░██      ░██    ░██
 ░██   ░██ ░██    ░██ ░███   ░██ ░██   ░███ ░██     ░██ ░██      ░██          ░██░██ ░██░██   ░██        ░██      ░██   ░███
  ░██████   ░███████  ░██░█████   ░█████░██ ░█████████  ░██       ░███████     ░███   ░███     ░███████  ░██       ░█████░██
                      ░██               ░██                                                                              ░██
                      ░██         ░███████                                                                         ░███████

Brew fresh marketing copy from the web.

CopyBrewery is a LangGraph-powered crawling agent that scrapes website copy (headlines, taglines, descriptions) and uses AI to generate new marketing content inspired by those patterns.

Python 3.10+ License: MIT

Features

  • 🕷️ Smart Web Crawling - Playwright-based crawler handles JavaScript-rendered pages
  • 🧠 AI-Powered Extraction - GPT-4o identifies and categorizes marketing copy elements
  • Content Generation - Generate new marketing content inspired by scraped patterns
  • 💾 Persistent Storage - SQLite database stores all scraped and generated content
  • 🖥️ CLI & API - Use via command line or REST API
  • 🐳 Docker Ready - Deploy anywhere with Docker

Quick Start

Installation

# Clone the repo
git clone https://github.com/pchaganti/copybrewery.git
cd copybrewery

# Install
pip install -e .

# Install Playwright browser
playwright install chromium

# Set up environment
cp .env.example .env
# Add your OPENAI_API_KEY to .env

Basic Usage

# Crawl a website
cbrew crawl https://stripe.com --depth 1

# View scraped data
cbrew list websites
cbrew show 1

# Generate marketing copy
cbrew generate marketing --source stripe --count 3

# Generate taglines
cbrew generate taglines --source stripe --count 5

# Export data
cbrew export 1 --format json --output stripe_data.json

CLI Commands

Command Description
cbrew crawl <url> Crawl a website and extract marketing copy
cbrew list websites List all scraped websites
cbrew show <id> Show details of a scraped website
cbrew generate <type> --source <name> Generate new content
cbrew export <id> Export scraped data to JSON
cbrew version Show version

Content Types for Generation

Type Description
marketing Full marketing copy with headlines and CTAs
descriptions Product/service descriptions
taglines Short memorable phrases
headlines Attention-grabbing headers
cta Call-to-action button text

REST API

Start the API server:

# Install API dependencies
pip install -e ".[api]"

# Start server
uvicorn copybrewery.api:app --reload

Endpoints

Method Endpoint Description
GET / Health check
POST /crawl Crawl a website
POST /generate Generate content
GET /websites List all websites
GET /websites/{id} Get website details
GET /websites/{id}/elements Get copy elements

Example API Calls

# Crawl a website
curl -X POST http://localhost:8000/crawl \
  -H "Content-Type: application/json" \
  -d '{"url": "https://stripe.com", "depth": 1, "max_pages": 5}'

# Generate content
curl -X POST http://localhost:8000/generate \
  -H "Content-Type: application/json" \
  -d '{"source": "stripe", "content_type": "taglines", "count": 3}'

# List websites
curl http://localhost:8000/websites

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    CLI / REST API                           │
└─────────────────────┬───────────────────────────────────────┘
                      │
┌─────────────────────▼───────────────────────────────────────┐
│                   LangGraph Agent                           │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │  Start   │→ │  Crawl   │→ │  Extract │→ │  Store   │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
│                                                     │       │
│  ┌──────────┐  ┌──────────┐                        │       │
│  │ Generate │← │  Query   │←───────────────────────┘       │
│  └──────────┘  └──────────┘                                │
└─────────────────────────────────────────────────────────────┘
                      │
┌─────────────────────▼───────────────────────────────────────┐
│                    SQLite Database                          │
│  Tables: websites, pages, copy_elements, generated_content  │
└─────────────────────────────────────────────────────────────┘

Project Structure

copybrewery/
├── pyproject.toml          # Dependencies and project config
├── .env.example            # Environment variables template
├── Dockerfile              # CLI Docker image
├── Dockerfile.api          # API Docker image
├── docker-compose.yml      # Docker Compose config
├── src/copybrewery/
│   ├── cli.py              # Typer CLI commands
│   ├── api.py              # FastAPI REST API
│   ├── agent/              # LangGraph workflow
│   ├── scraper/            # Playwright crawler & extractor
│   ├── database/           # SQLAlchemy models & repository
│   └── generator/          # GPT-4 content generation
└── docs/
    └── DEPLOYMENT.md       # Deployment guide

Deployment

See docs/DEPLOYMENT.md for detailed deployment instructions.

Quick Docker Deployment

# Set your API key
export OPENAI_API_KEY=sk-xxx

# Start API server
docker-compose up api

# Or run CLI commands
docker-compose run --rm cli crawl https://stripe.com

Cloud Deployment

CopyBrewery can be deployed to:

  • Railway - One-click deploy
  • Fly.io - Global edge deployment
  • Render - Free tier available
  • AWS/GCP/Azure - Container services

Environment Variables

Variable Description Default
OPENAI_API_KEY OpenAI API key (required) -
DATABASE_URL SQLite database path sqlite:///data/copybrewery.db
OPENAI_MODEL Model for extraction/generation gpt-4o

Use Cases

  1. Competitor Analysis - Study how competitors position their products
  2. Landing Page Copy - Generate A/B test variations
  3. Product Descriptions - Create descriptions inspired by successful brands
  4. Marketing Research - Understand industry messaging patterns
  5. Content Ideation - Generate taglines and headlines

Requirements

  • Python 3.10+
  • OpenAI API key
  • Playwright (Chromium)

License

MIT License - see LICENSE for details.

Contributing

Contributions welcome! Please read the contributing guidelines first.


Built with ❤️ using LangGraph, Playwright, and GPT-4

About

CopyBrewery is a LangGraph-powered AI agent that crawls websites to extract marketing copy (headlines, taglines, CTAs, descriptions) and uses GPT-4 to generate fresh marketing content inspired by those patterns

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages