Skip to content

AI-powered B2B lead generation & Google Maps scraper built with Next.js to find local businesses, detect companies without websites, and export leads to Google Sheets.

Notifications You must be signed in to change notification settings

prantikmedhi/b2b-leads-ai

Repository files navigation

LeadFinder AI - B2B Lead Generation & Web Scraper Tool

LeadFinder AI is a powerful, AI-driven B2B lead generation tool designed to help agencies, freelancers, and marketers find high-quality local business leads. Whether you need leads for website development, digital marketing, SEO, or general business outreach, LeadFinder AI automates the process of finding, filtering, and organizing potential clients.

Built with Next.js 14, Tailwind CSS, and OpenAI/Llama, this application intelligently parses your natural language prompts to search Google Maps and export actionable data directly to Google Sheets.

LeadFinder AI Screenshot

🌟 Key Features

  • 🤖 AI-Powered Search: Uses advanced LLMs (via OpenRouter) to understand natural language prompts like "Find cafes in NYC that need a website" or "Digital marketing agencies in London".
  • 🎯 Smart Filtering:
    • Website Development Mode: Automatically filters out businesses that already have a website, giving you a list of high-potential prospects.
    • Broad Mode: Finds all businesses in a category for digital marketing or general outreach, regardless of their website status.
  • 📍 Local Business Data: Leverages Serper.dev (Google Maps API) to fetch accurate business names, addresses, phone numbers, ratings, and website links.
  • 📊 One-Click Export: Manually review your search results and push them to Google Sheets with a single click.
  • 📱 Responsive UI: A modern, mobile-friendly interface built with Tailwind CSS.

🛠️ Tech Stack

  • Frontend: Next.js 14 (App Router), Tailwind CSS, React Icons
  • Backend: Next.js API Routes (Serverless)
  • AI Logic: OpenRouter API (using Meta Llama 3 models)
  • Data Source: Serper.dev (Google Maps Search API)
  • Database/Export: Google Sheets API
  • Deployment: Vercel / Netlify

📋 Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v18 or higher)
  • Git
  • A Google Cloud Account
  • Accounts for Serper.dev and OpenRouter

🔑 API Keys & Setup Guide

To run this project, you need to obtain API keys from three services. Follow this step-by-step guide:

1. Serper.dev (Google Maps Search)

  1. Go to Serper.dev.
  2. Sign up for a free account.
  3. On the dashboard, locate your API Key.
  4. Save this key; you will need it for SERPER_API_KEY.

2. OpenRouter (AI Processing)

  1. Go to OpenRouter.ai.
  2. Sign up or log in.
  3. Navigate to Keys and create a new API Key.
  4. Save this key; you will need it for OPENROUTER_API_KEY.
    • Note: This project uses free models like Llama 3 by default, but you can configure it for others.

3. Google Sheets API (Data Export)

This is the most critical step. You need a Service Account to write data to your sheet.

  1. Create a Project: Go to the Google Cloud Console and create a new project.
  2. Enable APIs:
    • Search for "Google Sheets API" and click Enable.
  3. Create Credentials:
    • Go to APIs & Services > Credentials.
    • Click + CREATE CREDENTIALS and select Service account.
    • Give it a name (e.g., "leadfinder-bot") and click Create and Continue.
    • (Optional) Grant the role Editor to the service account for the project.
    • Click Done.
  4. Get the Private Key:
    • Click on the newly created Service Account email (e.g., leadfinder-bot@project-id.iam.gserviceaccount.com).
    • Go to the Keys tab.
    • Click Add Key > Create new key.
    • Select JSON and click Create. A file will download.
  5. Configure Environment:
    • Open the downloaded JSON file.
    • You need client_email for GOOGLE_SERVICE_ACCOUNT_EMAIL.
    • You need private_key for GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY.
  6. Share the Sheet:
    • Create a new Google Sheet (e.g., "LeadFinder Results").
    • Click the Share button in the top right.
    • Paste the client_email (from step 5) into the share dialog.
    • Give it Editor permissions.
    • Copy the Spreadsheet ID from the URL: https://docs.google.com/spreadsheets/d/COPY_THIS_ID_PART/edit
    • This is your GOOGLE_SHEET_ID.

🚀 Installation & Local Development

  1. Clone the Repository

    git clone https://github.com/prantikmedhi/leads-finder.git
    cd leads-finder
  2. Install Dependencies

    npm install
    # or
    yarn install
  3. Configure Environment Variables Create a .env file in the root directory:

    cp .env.example .env

    Open .env and fill in your keys:

    # Google Sheets Setup
    GOOGLE_SERVICE_ACCOUNT_EMAIL="your-service-account-email@project.iam.gserviceaccount.com"
    GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYour...\n-----END PRIVATE KEY-----\n"
    GOOGLE_SHEET_ID="your-google-sheet-id"
    
    # External APIs
    SERPER_API_KEY="your-serper-api-key"
    OPENROUTER_API_KEY="your-openrouter-api-key"

    Tip: If your private key contains \n, ensure they are properly formatted or pasted as a single line string depending on your OS/deployment environment.

  4. Run the Application

    npm run dev

    Open http://localhost:3000 in your browser.


📖 How to Use

1. Website Development Leads (Strict Filter)

If you want to find businesses that don't have a website, use terms like "website", "web design", or "no website" in your prompt.

  • Prompt: "Find plumbers in Austin Texas that need a website"
  • Result: The app lists plumbers without a website found on Google Maps. The "Push to Sheets" button will save them for your outreach campaign.

2. Digital Marketing / General Leads (Broad Search)

If you want to find all businesses in a category (e.g., for SEO, Ads, or B2B sales), use a standard search prompt.

  • Prompt: "Digital marketing agencies in New York" or "Gyms in Miami"
  • Result: The app lists all matching businesses. Cards will show "Visit Website" for those that have one, and "No website found" for those that don't.

3. Saving Data

  • Review the results on the dashboard.
  • Click the green "Push to Sheets" button.
  • The data (Name, Address, Phone, Rating, Website URL) will be appended to your connected Google Sheet instantly.

📈 SEO Keywords

Lead generation software, B2B lead scraper, Google Maps scraper, find businesses without websites, AI lead finder, agency tools, automated prospecting, Next.js application, React source code.


📄 License

This project is licensed under the MIT License. Feel free to use, modify, and distribute it.

About

AI-powered B2B lead generation & Google Maps scraper built with Next.js to find local businesses, detect companies without websites, and export leads to Google Sheets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published