Skip to content

BraaMohammed/bricks

Repository files navigation

Bricks

A lightweight, powerful alternative to Clay.com for data enrichment and automation workflows

React TypeScript Next.js Puppeteer Open Source Local Processing License

🎯 Overview

Bricks Sheet is a sophisticated data enrichment platform built as a fully local, open-source alternative to Clay.com. It combines the power of AI, web scraping, and browser automation to transform raw CSV data into actionable business intelligence.

Why Bricks Sheet? Clay.com's pricing can be prohibitive for many users. This project delivers enterprise-grade data enrichment capabilities at zero recurring cost, with support for both cloud and local AI models. Everything runs on your machine - your data never leaves your control.

✨ 100% Open Source β€’ 🏠 Fully Local Processing β€’ πŸ”’ Complete Privacy β€’ πŸ’° Zero Recurring Costs

also a brick is stronger than clay

✨ Core Features

🧠 Built-In AI Integration

  • OpenAI Integration: Full support for GPT models configurable parameters
  • Local Ollama Support: Run models like Llama2, Mistral, CodeLlama locally without API costs
  • Reasoning Models: Support for DeepSeek R1, o1-preview with thinking mode capabilities
  • Smart Provider Switching: Seamlessly switch between cloud and local AI providers

πŸ€– AI Copy Agents System

A revolutionary dual-agent system for automated personalized outreach:

  • Message Creator Agent: Generates personalized DM messages using lead data and offer details
  • Lead Roleplay Agent: Acts as the prospect, provides structured feedback and approval decisions
  • Iterative Refinement: Agents collaborate through multiple iterations until approval
  • Custom Instructions: Fine-tune both agents with specific business requirements
  • Multi-Model Support: Mix and match OpenAI and Ollama models for optimal cost/performance

🌐 Advanced Web Scraping

  • Firecrawl Integration: Professional-grade web scraping with LLM-ready markdown output
  • Dynamic URL Templates: Use CSV column data to build dynamic URLs for batch scraping
  • Rate Limiting: Built-in respectful scraping with configurable delays
  • Error Handling: Robust error handling for failed requests and malformed data

🎭 Puppeteer Automation Engine

Full browser automation with enterprise-grade features:

  • Queue-Based Processing: Handle thousands of automation tasks with intelligent queueing
  • Browser Pool Management: Efficient browser reuse with memory management
  • Anti-Ban Technology:
    • User agent rotation
    • Request timing randomization
    • Session management
    • Stealth plugin integration
  • Real-time Logging: Live execution logs with detailed debugging information
  • Concurrent Processing: Multiple browser instances with configurable concurrency limits

πŸ“Š Smart Data Processing

  • CSV Import/Export: Drag-and-drop CSV handling with validation
  • Formula Engine: JavaScript-based formula system for data transformation
  • Column-Based Operations: Apply different enrichment strategies per column
  • Real-time Validation: Live formula validation with syntax highlighting
  • Data Preview: Real-time preview with actual data before execution

🎨 Modern User Experience

  • Responsive Design: Built with Tailwind CSS and shadcn/ui components
  • Dark/Light Mode: Automatic theme switching with system preference detection
  • Intuitive Interface: Clean, professional interface inspired by modern SaaS tools
  • Real-time Feedback: Toast notifications and progress indicators
  • Keyboard Shortcuts: Power-user features with keyboard navigation

🏠 Fully Local & Open Source

  • Complete Privacy: All data processing happens on your machine
  • No Vendor Lock-in: Open source MIT license - modify as needed
  • Offline Capable: Works without internet (with local AI models)
  • Self-Hosted: Run on your own infrastructure
  • Transparent: Full source code available for audit and customization
  • Community Driven: Contribute features and improvements

πŸ—οΈ Technical Architecture

Frontend Stack

  • React 18.3.1 with TypeScript for type-safe development
  • Vite for lightning-fast development and optimized builds
  • Zustand for lightweight, efficient state management
  • Tailwind CSS + shadcn/ui for consistent, accessible design system
  • React Query for intelligent API state management

Backend Stack

  • Next.js 15.5.4 API routes for serverless scalability
  • Puppeteer 22.0.0 with stealth plugins for undetectable automation
  • Queue System with intelligent job scheduling and concurrency control
  • Browser Pool Manager for resource optimization and memory management

AI & ML Integration

  • OpenAI API integration with support for latest models including GPT-4o
  • Ollama local model support for cost-effective AI operations
  • Structured Output parsing with JSON mode for reliable agent communication
  • Thinking Mode support for reasoning models like DeepSeek R1

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm/yarn
  • For Ollama support: Ollama installed locally
  • For Puppeteer: Chrome/Chromium browser

Installation

# Clone the repository
git clone https://github.com/yourusername/bricks.git
cd bricks

# Install dependencies
npm install

# Install backend dependencies
cd api/bricks-api
npm install
cd ../..

# Start development servers
npm run dev              # Frontend (port 5173)
npm run dev:api          # Backend API (port 3000)

Configuration

  1. Set up AI providers:

    • Click "API Keys" button in the interface
    • Add your OpenAI API key for cloud models
    • Or install Ollama locally: ollama pull llama2
  2. Configure Firecrawl (optional):

  3. Start enriching data:

    • Upload a CSV file
    • Choose your enrichment mode (AI, Scraping, or Automation)
    • Configure and execute!

πŸ“– Feature Deep Dive

AI Copy Agents Workflow

graph TD
    A[Upload Lead Data] --> B[Configure Offer Details]
    B --> C[Message Creator Agent]
    C --> D[Generate Personalized Message]
    D --> E[Lead Roleplay Agent]
    E --> F{Message Approved?}
    F -->|No| G[Provide Feedback]
    G --> C
    F -->|Yes| H[Final Message]
    H --> I[Export Results]
Loading

Example Configuration:

  • Your Offer: "AI-powered lead generation tool that increases conversion rates by 40%"
  • Message Creator: GPT-4o with custom instructions for your industry
  • Lead Roleplay: Local Llama2 model acting as prospects in your target market
  • Result: Personalized, pre-approved messages ready for outreach

Puppeteer Automation Examples

// Example 1: Extract LinkedIn profile data
await page.goto(`https://linkedin.com/in/{Username}`);
await page.waitForSelector('h1');
const name = await page.$eval('h1', el => el.textContent);
const headline = await page.$eval('.text-body-medium', el => el.textContent);
return `${name} - ${headline}`;

// Example 2: Company information lookup
await page.goto(`https://example.com/search?q={Company}`);
const results = await page.$$eval('.result', els => 
  els.map(el => el.textContent).join(', ')
);
return results;

// Example 3: Screenshot capture
await page.goto('{Website}');
await page.setViewport({ width: 1200, height: 800 });
const screenshot = await page.screenshot({ encoding: 'base64' });
return `data:image/png;base64,${screenshot}`;

Formula Engine Examples

// Example 1: Email validation and categorization
const email = row['Email'];
if (!email) return 'No email';
if (email.includes('@gmail.com')) return 'Gmail User';
if (email.includes('@company.com')) return 'Corporate Email';
return 'Other Provider';

// Example 2: Lead scoring algorithm
const company = row['Company'] || '';
const title = row['Title'] || '';
let score = 0;
if (title.toLowerCase().includes('ceo')) score += 10;
if (title.toLowerCase().includes('director')) score += 7;
if (company.length > 10) score += 5;
return `Score: ${score}/20`;

// Example 3: Data cleaning and standardization
const phone = row['Phone'] || '';
const cleaned = phone.replace(/[^0-9]/g, '');
if (cleaned.length === 10) {
  return `(${cleaned.slice(0,3)}) ${cleaned.slice(3,6)}-${cleaned.slice(6)}`;
}
return 'Invalid phone';

🎯 Business Use Cases

1. Lead Enrichment Pipeline

  • Upload list of company names
  • Use Firecrawl to scrape company websites
  • Apply AI to extract key information (industry, size, tech stack)
  • Generate personalized outreach messages
  • Export enriched data with contact strategies

2. Social Media Research

  • Input list of LinkedIn profiles
  • Use Puppeteer to extract profile data
  • Apply AI to analyze and categorize prospects
  • Generate personalized connection messages
  • Track and optimize outreach performance

3. Market Research Automation

  • Upload competitor URLs
  • Scrape pricing, features, and positioning
  • Use AI to analyze competitive landscape
  • Generate strategic insights and recommendations
  • Create comprehensive market analysis reports

4. Content Personalization

  • Upload customer data (industry, role, company size)
  • Use AI agents to generate personalized email campaigns
  • A/B test different message variants
  • Optimize messaging based on response rates
  • Scale personalized outreach across thousands of prospects

πŸ”§ Advanced Configuration

Environment Variables

# API Configuration
OPENAI_API_KEY=your_openai_key_here
FIRECRAWL_API_KEY=your_firecrawl_key_here

# Puppeteer Settings
PUPPETEER_MAX_CONCURRENT=3
PUPPETEER_DEFAULT_TIMEOUT=30000
PUPPETEER_RATE_LIMIT_DELAY=2000

# Ollama Configuration
OLLAMA_BASE_URL=http://localhost:11434

Performance Tuning

For Large Datasets (10,000+ rows):

  • Increase Puppeteer concurrency: PUPPETEER_MAX_CONCURRENT=5
  • Use local Ollama models to avoid API rate limits
  • Implement batch processing with queue prioritization
  • Consider running on cloud instances with more RAM

For Cost Optimization:

  • Use GPT-3.5-turbo for simple tasks, GPT-4 for complex reasoning
  • Mix OpenAI and Ollama models based on task complexity
  • Implement result caching for repeated queries
  • Use Firecrawl for structured data, Puppeteer for complex interactions

πŸ› οΈ Development

Project Structure

bricks/
β”œβ”€β”€ src/                          # Frontend React application
β”‚   β”œβ”€β”€ components/              # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ FormulaEditor.tsx   # Main formula editing interface
β”‚   β”‚   β”œβ”€β”€ AIConfiguration.tsx # AI settings and provider management
β”‚   β”‚   └── ui/                 # shadcn/ui component library
β”‚   β”œβ”€β”€ lib/                    # Utility libraries
β”‚   β”‚   β”œβ”€β”€ aiAgents.ts        # AI Copy Agents implementation
β”‚   β”‚   β”œβ”€β”€ ollama.ts          # Ollama integration utilities
β”‚   β”‚   └── utils.ts           # General utilities
β”‚   └── stores/                # Zustand state management
β”‚       └── useDataStore.ts    # Main data state management
β”œβ”€β”€ api/bricks-api/             # Next.js backend API
β”‚   β”œβ”€β”€ app/api/               # API route handlers
β”‚   β”‚   └── puppeteer/         # Puppeteer automation endpoints
β”‚   └── tests/                 # API integration tests
β”œβ”€β”€ docs/                      # Technical documentation
└── public/                    # Static assets

Testing Strategy

# Run frontend tests
npm test

# Run backend API tests
cd api/bricks-api
npm test

# Run Puppeteer integration tests
node tests/test-puppeteer.js

# Run AI agents test
node tests/test-ai-agents.js

Contributing Guidelines

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

πŸ“Š Performance Benchmarks

Operation Clay.com Bricks Sheet Savings
1000 AI enrichments $50-100 $2-10* 80-95%
Web scraping (1000 pages) $20-40 $0-5** 75-100%
Browser automation $30-60 $0*** 100%
Monthly platform fee $349+ $0 100%

*Using OpenAI API directly
**Using Firecrawl API or free scraping
***Self-hosted Puppeteer

πŸ”’ Security & Privacy

  • 100% Local Processing: All data stays on your machine - never uploaded anywhere
  • Open Source Transparency: Full source code available for security audits
  • No Telemetry: Zero data collection or tracking
  • API Key Security: Keys stored locally, never transmitted to our servers
  • Sandboxed Execution: Formula execution in controlled environments
  • Self-Hosted: Complete control over your infrastructure and data
  • GDPR Compliant: Local processing ensures automatic compliance
  • Stealth Mode: Undetectable browser automation to respect target sites

πŸš€ Deployment Options

Local Development

npm run dev

Production Build

npm run build
npm run preview

Docker Deployment

docker build -t bricks .
docker run -p 3000:3000 -p 5173:5173 bricks

Cloud Deployment

  • Vercel: One-click deployment for frontend
  • Railway: Full-stack deployment with database
  • AWS/GCP: Enterprise deployment with auto-scaling

πŸŽ“ Learning Resources

🀝 Community & Support

πŸ“ˆ Roadmap

Q1 2025

  • Advanced AI agent templates (sales, marketing, research)
  • Integration with popular CRMs (HubSpot, Salesforce)
  • Advanced data visualization and analytics
  • Team collaboration features

Q2 2025

  • API marketplace for custom integrations
  • Advanced workflow automation
  • Mobile-responsive interface
  • Enterprise SSO integration

πŸ“„ License

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

πŸ™ Acknowledgments

  • OpenAI for providing cutting-edge language models
  • Ollama for making local AI accessible
  • Puppeteer Team for robust browser automation
  • Vercel for Next.js and deployment platform
  • shadcn/ui for beautiful, accessible components

Built with ❀️ to democratize data enrichment and make powerful automation accessible to everyone.

🏠 Fully Local β€’ πŸ”“ 100% Open Source β€’ πŸ”’ Privacy First β€’ πŸ’° Forever Free

Bricks Sheet - Where your data comes alive, and stays yours πŸš€

Releases

No releases published

Packages

No packages published