A comprehensive WhatsApp marketing platform for managing contacts, campaigns, and messaging at scale.
- Contact Management: Import, organize, and segment contacts with custom tags and attributes
- Campaign Management: Create and manage broadcast campaigns with templates
- Inbox: Real-time chat interface for 1-on-1 WhatsApp conversations
- Segments: Create dynamic segments for targeted campaigns
- Analytics: Track message delivery, read rates, and campaign performance
- Multi-Organization Support: Manage multiple organizations with role-based access control
- WhatsApp Integration: Connect multiple WhatsApp Business accounts
- Billing: Usage-based pricing with multiple plan tiers
- Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS, shadcn/ui
- Backend: Next.js API Routes, Prisma ORM
- Database: MongoDB
- Authentication: NextAuth.js (Google OAuth, Credentials)
- State Management: Zustand
- Caching: Upstash Redis
- Real-time: Socket.io
- Testing: Jest
- Node.js 18+
- MongoDB instance
- Upstash Redis account (for caching)
- Meta Developer account (for WhatsApp Business API)
-
Clone the repository
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env.local
-
Configure your
.env.localwith:MONGODB_URI: MongoDB connection stringNEXTAUTH_SECRET: NextAuth secret keyNEXTAUTH_URL: Application URLUPSTASH_REDIS_REST_URL: Upstash Redis URLUPSTASH_REDIS_REST_TOKEN: Upstash Redis tokenWHATSAPP_WEBHOOK_VERIFY_TOKEN: Webhook verification token
-
Initialize the database:
npm run db:push
-
Run the development server:
npm run dev
src/
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ ├── dashboard/ # Dashboard pages
│ └── landing/ # Landing page
├── components/ # React components
├── lib/ # Utility libraries
├── services/ # Business logic layer
├── repositories/ # Data access layer
├── middleware/ # Error handling middleware
├── store/ # Zustand state management
├── types/ # TypeScript type definitions
└── __tests__/ # Test files
- Services: Business logic (
ContactService,CampaignService) - Repositories: Data access (
ContactRepository,BaseRepository) - API Routes: HTTP handlers that use services
- Tags are stored as JSON arrays
- Message content is stored as JSON objects
- Custom attributes are stored as JSON objects
- Utility functions in
src/types/common.tshandle parsing/stringifying
- Analytics data cached for 5 minutes
- Organization-specific cache keys
- Automatic cache invalidation on updates
- Socket.io for inbox message broadcasting
- WebSocket integration for live updates
GET /api/contacts- List contacts with filteringPOST /api/contacts- Create new contactPUT /api/contacts- Update contactDELETE /api/contacts- Delete contact
GET /api/campaigns- List campaignsPOST /api/campaigns- Create campaignPUT /api/campaigns/[id]- Update campaignPOST /api/campaigns/[id]/launch- Launch campaign
GET /api/inbox- Get conversations/messagesPOST /api/inbox- Send messagePATCH /api/inbox- Mark messages as read
GET /api/segments- List segmentsPOST /api/segments- Create segmentDELETE /api/segments/[id]- Delete segment
GET /api/analytics- Get analytics data (cached)
GET /api/settings/billing- Get billing info with usagePUT /api/settings/billing- Update billing plan
POST /api/webhooks/whatsapp- WhatsApp webhook handlerGET /api/webhooks/whatsapp- Webhook verification
Run tests:
npm testRun tests in watch mode:
npm run test:watch- Connect your repository to Vercel
- Configure environment variables
- Deploy
npm run build
npm start| Variable | Description | Required |
|---|---|---|
MONGODB_URI |
MongoDB connection string | Yes |
NEXTAUTH_SECRET |
NextAuth secret | Yes |
NEXTAUTH_URL |
Application URL | Yes |
UPSTASH_REDIS_REST_URL |
Redis URL | No |
UPSTASH_REDIS_REST_TOKEN |
Redis token | No |
WHATSAPP_WEBHOOK_VERIFY_TOKEN |
Webhook verification | Yes |
MIT