A professional lead generation and management system built with Next.js, integrating the RocketReach API for finding and enriching prospect data.
- 🔐 Secure Authentication: Google OAuth via Auth.js with MongoDB adapter
- 🔑 Admin-Controlled API Keys: RocketReach API keys managed in admin panel, encrypted at rest
- 🔍 Lead Search: Search for prospects by name, title, company, domain, and location
- 📊 Lead Management: Save leads to lists, tag, and export
- 🎯 Professional UI: Built with shadcn/ui components in neutral color scheme
- 📈 Usage Tracking: Monitor API usage and audit logs
- 🔄 Retry Logic: Automatic retry with exponential backoff for rate limits
- Frontend: Next.js 15, React 19, TypeScript
- UI: shadcn/ui, Tailwind CSS 4, Radix UI
- Backend: Next.js API Routes, Server Actions
- Database: MongoDB with Mongoose
- Auth: Auth.js (NextAuth v5) with Google Provider
- Security: AES-256-GCM encryption for API keys
cd c:\Users\akash\upwork\rockreach
npm installCopy .env.local.example to .env.local:
Copy-Item .env.local.example .env.localThen update .env.local with your credentials:
# MongoDB
MONGODB_URI=your-mongodb-connection-string
# Auth.js
AUTH_SECRET=generate-with: openssl rand -base64 32
AUTH_GOOGLE_ID=your-google-oauth-client-id
AUTH_GOOGLE_SECRET=your-google-oauth-client-secret
# Encryption key for storing RocketReach API key
APP_MASTER_KEY=generate-with: openssl rand -hex 32
# Next.js
NEXTAUTH_URL=http://localhost:3000- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Copy Client ID and Client Secret to
.env.local
npm run devVisit http://localhost:3000
├── app/
│ ├── api/
│ │ ├── admin/
│ │ │ └── rocketreach-settings/ # Admin settings API
│ │ ├── auth/ # Auth.js routes
│ │ └── leads/
│ │ ├── search/ # Lead search API
│ │ └── save/ # Save leads API
│ ├── admin/
│ │ └── settings/ # Admin settings UI
│ ├── leads/
│ │ └── search/ # Lead search UI
│ └── page.tsx # Dashboard
├── components/
│ ├── auth/ # Sign in/out components
│ └── ui/ # shadcn/ui components
├── lib/
│ ├── crypto.ts # Encryption utilities
│ ├── db.ts # MongoDB connection
│ ├── rocketreach.ts # RocketReach client
│ └── utils.ts # Helper functions
├── models/ # Mongoose models
│ ├── ApiUsage.ts
│ ├── AuditLog.ts
│ ├── Lead.ts
│ ├── LeadList.ts
│ ├── LeadSearch.ts
│ ├── Organization.ts
│ └── RocketReachSettings.ts
└── auth.ts # Auth.js configuration
- Sign in with Google
- Go to Admin > Settings
- Enter your RocketReach API key
- Configure rate limits, concurrency, and retry policy
- Save settings (API key is encrypted and stored in MongoDB)
- Go to Search Leads
- Enter search criteria:
- Name
- Job Title
- Company
- Domain
- Location
- Click Search
- Review results in table
- Select leads to save
- Add to a list or tag
- View all saved leads in Lead Lists
- Create custom lists
- Export to CSV
- View search history
- Monitor API usage
The system uses RocketReach API with the following endpoints:
POST /api/leads/search- Search for peoplePOST /api/leads/save- Save leads to databaseGET /api/admin/rocketreach-settings- Get settingsPOST /api/admin/rocketreach-settings- Update settings
Settings are managed in admin panel and cached for 60 seconds:
- Base URL: Default
https://api.rocketreach.co - Daily Limit: Default 1000 requests/day
- Concurrency: Default 2 concurrent requests
- Retry Policy: 5 retries with exponential backoff (500ms - 30s)
- ✅ API keys encrypted with AES-256-GCM
- ✅ Master encryption key stored in environment variable (never in database)
- ✅ Server-side only API calls (keys never sent to client)
- ✅ Auth.js session management
- ✅ MongoDB connection with proper error handling
- ✅ Audit logging for admin actions
- Settings cached for 60s to reduce DB reads
- Retry logic with jitter prevents thundering herd
- Rate limit handling built-in
- Add background job queue for bulk enrichment
- Implement per-organization quotas
- Add webhook support for real-time updates
- Multi-tenant org management with roles
- Redis caching layer
- Elasticsearch for lead search
- S3/storage for CSV exports
# Run dev server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Lint
npm run lintPrivate - All rights reserved