An intelligent B2B sales platform that generates Ideal Customer Profiles (ICPs) using AI, finds prospects, and automates personalized outreach via email and AI-powered phone calls.
- AI-Powered ICP Generation: Generate comprehensive Ideal Customer Profiles based on your target market using GPT-5 and web research
- Smart Prospect Research: Automatically find and enrich prospects that match your ICPs
- Personalized Email Outreach: Generate contextual, personalized sales emails with AI
- AI Voice Calls: Initiate AI-powered sales calls using Vapi
- Real-time Collaboration: Chat with AI to refine your ICPs interactively
- Outreach History Tracking: Keep track of all interactions with prospects
- Full Telemetry: Monitor AI performance with Opik integration
- Frontend: Next.js 15 (App Router), React 19, TypeScript, Tailwind CSS
- Backend: Convex (real-time database)
- AI: OpenAI GPT-5 (via Vercel AI SDK)
- Search: Exa API
- Authentication: Auth0
- Email: Resend
- Voice AI: Vapi
- Telemetry: Opik + OpenTelemetry
- UI Components: Radix UI, Lucide Icons, Framer Motion
Before you begin, ensure you have the following installed:
- Node.js 20.x or higher
- pnpm (recommended) or npm
- Git
You'll also need accounts and API keys for:
- OpenAI - For AI-powered ICP generation and email writing
- Convex - For real-time database
- Auth0 - For user authentication
- Exa - For web search capabilities
- Resend - For email delivery
- Vapi - For AI voice calls (optional)
- Opik - For AI observability (optional)
- Clone the repository
git clone <your-repo-url>
cd ai-by-the-bay- Install dependencies
pnpm install
# or
npm install- Set up Convex
# Install Convex CLI globally
pnpm add -g convex
# Login to Convex
npx convex login
# Initialize Convex project
npx convex devThis will create a .env.local file with your Convex deployment URL.
- Configure environment variables
Copy the example environment file:
cp .env.example .env.localEdit .env.local and add your API keys:
# OpenAI API Key (Required)
OPENAI_API_KEY=sk-...
# Exa API Key (Required - for search)
EXA_API_KEY=...
# Auth0 Configuration (Required)
AUTH0_SECRET=use_openssl_rand_hex_32_to_generate_this
AUTH0_BASE_URL=http://localhost:3000
AUTH0_ISSUER_BASE_URL=https://your-tenant.auth0.com
AUTH0_CLIENT_ID=...
AUTH0_CLIENT_SECRET=...
# App Configuration
APP_BASE_URL=http://localhost:3000
# Convex (Auto-generated by `npx convex dev`)
CONVEX_DEPLOYMENT=...
NEXT_PUBLIC_CONVEX_URL=https://...
# Resend (Required for email outreach)
RESEND_API_KEY=re_...
# Vapi (Optional - for AI voice calls)
VAPI_API_KEY=...
VAPI_ASSISTANT_ID=...
# Opik Telemetry (Optional - for AI observability)
OPIK_API_KEY=...
OPIK_WORKSPACE=...
OPIK_URL_OVERRIDE=https://www.comet.com/opik/api- Generate AUTH0_SECRET
openssl rand -hex 32- Start Convex backend (in one terminal):
npx convex dev- Start Next.js development server (in another terminal):
pnpm dev
# or
npm run dev- Open your browser
Navigate to http://localhost:3000
# Build the project
pnpm build
# Start production server
pnpm startai-by-the-bay/
βββ app/ # Next.js App Router
β βββ (main)/ # Main application routes
β β βββ icps/ # ICP management pages
β β βββ me/ # User profile
β βββ api/ # API routes
β β βββ chat-icp/ # ICP refinement chat
β β βββ generate-icps/ # ICP generation
β β βββ outreach/ # Email & call APIs
β β βββ prospect/ # Prospect research
β βββ layout.tsx # Root layout with Auth0
βββ components/ # React components
β βββ ui/ # Reusable UI components
β βββ ChatPanel.tsx # ICP chat interface
β βββ EmailComposer.tsx # Email composition
β βββ CallInterface.tsx # Voice call interface
βββ convex/ # Convex backend
β βββ icps.ts # ICP database operations
β βββ prospecting.ts # Prospect research
β βββ outreach.ts # Outreach campaigns
β βββ schema.ts # Database schema
βββ lib/ # Utilities and schemas
β βββ schemas/ # Zod schemas
βββ guides/ # Documentation
β βββ llm-calls-with-telemetry.md
βββ instrumentation.ts # OpenTelemetry setup
- Navigate to the home page
- Enter your target customer description (e.g., "SaaS companies that need better analytics")
- Optionally, describe what you're building
- Click "Generate ICPs"
- The system will:
- Generate search queries
- Research the market using Exa
- Create 3 detailed ICPs using GPT-5
- Click on any ICP to view details
- Use the chat panel to refine specific sections
- AI will suggest improvements and update the ICP in real-time
- Select an ICP
- Click "Research Prospects"
- The system finds companies and decision-makers matching your ICP
- View enriched prospect data including contact information
Email Outreach:
- Select a prospect
- Click "Email"
- AI generates a personalized email based on ICP messaging
- Review, edit, and send
AI Voice Calls:
- Select a prospect
- Click "Call"
- AI initiates a call using Vapi with context about the prospect
- Track call outcomes
All AI calls are instrumented with OpenTelemetry and sent to Opik for observability:
- View token usage and costs
- Track response times
- Monitor AI quality
- Debug issues
See guides/llm-calls-with-telemetry.md for implementation details.
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
β | OpenAI API key for GPT-5 |
EXA_API_KEY |
β | Exa API key for web search |
AUTH0_SECRET |
β | Random secret for Auth0 session encryption |
AUTH0_BASE_URL |
β | Your app URL (http://localhost:3000 for dev) |
AUTH0_ISSUER_BASE_URL |
β | Your Auth0 tenant URL |
AUTH0_CLIENT_ID |
β | Auth0 application client ID |
AUTH0_CLIENT_SECRET |
β | Auth0 application client secret |
CONVEX_DEPLOYMENT |
β | Convex deployment ID (auto-generated) |
NEXT_PUBLIC_CONVEX_URL |
β | Convex API URL (auto-generated) |
RESEND_API_KEY |
β | Resend API key for email delivery |
VAPI_API_KEY |
Vapi API key (optional, for voice calls) | |
VAPI_ASSISTANT_ID |
Vapi assistant ID (optional) | |
OPIK_API_KEY |
Opik API key (optional, for telemetry) | |
OPIK_WORKSPACE |
Opik workspace name (optional) |
# Clear Convex cache and restart
rm -rf .convex
npx convex dev- Ensure
AUTH0_BASE_URLmatches your actual URL - Check that Auth0 callback URLs are configured correctly in Auth0 dashboard
- Verify
AUTH0_SECRETis set and is a valid 32-byte hex string
# Clean install dependencies
rm -rf node_modules pnpm-lock.yaml
pnpm install
# Clear Next.js cache
rm -rf .next
pnpm build- OpenAI: Monitor usage at https://platform.openai.com/usage
- Exa: Check rate limits in your Exa dashboard
- Consider adding rate limiting middleware for production
All LLM calls should:
- Be made from Next.js API routes (not Convex)
- Include
experimental_telemetry: { isEnabled: true } - Use proper error handling
See guides/llm-calls-with-telemetry.md for the complete guide.
When modifying Convex schema:
# Push schema changes
npx convex dev
# Clear data (if needed)
npx convex run clearAll- Push your code to GitHub
- Import project to Vercel
- Add all environment variables
- Deploy!
Vercel will automatically:
- Build with Turbopack
- Connect to Convex
- Set up preview deployments
Remember to update:
AUTH0_BASE_URLβ your production URLAPP_BASE_URLβ your production URL- All other API keys should use production credentials
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
pnpm build - Submit a pull request
Built with:
- OpenAI GPT-5
- Convex real-time database
- Vercel AI SDK
- And many other amazing open-source projects
Need help? Check out the guides/ directory for detailed documentation on specific features.