Multi-tenant SaaS platform with WhatsApp AI assistant for barber shops. Customers book online or via WhatsApp natural language — AI handles the conversation.
┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ Next.js 16 │────▶│ PostgreSQL │ │ Redis 7 │
│ (App Router)│ │ (Prisma) │ │ (ioredis) │
└──────┬───────┘ └─────────────┘ └──────┬───────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────────────────┐
│ Super Admin │ │ Evolution API v2 │
│ Panel │ │ (WhatsApp Baileys Bridge) │
│ Barber Panel│ └──────────────────────────────┘
│ Customer │
│ Booking │
│ AI Webhook │
└──────────────┘
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack) |
| Language | TypeScript |
| Database | PostgreSQL 16 + Prisma 6 ORM |
| Cache | Redis 7 (ioredis) |
| Auth | NextAuth v5 (Credentials + JWT) |
| UI | Tailwind CSS + Shadcn UI |
| LLM | OpenAI / Google Gemini / OpenRouter / Groq |
| Evolution API v2.2.1 (Baileys) | |
| Deployment | Docker Compose |
- Dashboard with barber stats
- Barber CRUD (create/edit/delete)
- LLM provider settings (OpenAI, Gemini, OpenRouter, Groq)
- API key management (AES-256-CBC encrypted storage)
- Dashboard with appointment overview
- Service management (name, duration, price)
- Working hours editor (7-day, minute-precision)
- WhatsApp QR code connection
- Appointment list with status management (confirm/complete/cancel)
- Public booking widget by barber slug
- Service selection with prices
- Date picker with real-time slot availability
- WhatsApp OTP verification (optional)
- Confirmation with appointment details
- Natural language booking via WhatsApp
- LLM function calling (5 tools: services, slots, book, query, cancel)
- Turkish language system prompt
- Multi-round conversation with tool execution
/yardimcommand for help
- JWT-based authentication (super admin + barber separation)
- API keys encrypted at rest (AES-256-CBC)
- OTP phone verification via WhatsApp
- Route-level middleware protection
- Node.js 20+
- Docker & Docker Compose
- npm
git clone <repo-url> wapoint
cd wapoint
npm installcp .env.example .envEdit .env with your values:
| Variable | Description |
|---|---|
DATABASE_URL |
PostgreSQL connection string |
REDIS_URL |
Redis connection string |
EVOLUTION_API_URL |
Evolution API base URL |
EVOLUTION_API_KEY |
Evolution API master key |
NEXTAUTH_SECRET |
JWT signing secret |
NEXTAUTH_URL |
App base URL |
SUPER_ADMIN_EMAIL |
Super admin login email |
SUPER_ADMIN_PASSWORD |
Super admin login password |
ENCRYPTION_KEY |
32-char hex key for API key encryption |
docker compose up -dThis starts:
- PostgreSQL 16 on port 5432
- Redis 7 on port 6379
- Evolution API v2.2.1 on port 8080
npx prisma migrate dev --name initnpx prisma db seedOr run via API after starting the app.
npm run devsrc/
├── app/
│ ├── [slug]/ # Customer booking page
│ ├── api/
│ │ ├── appointments/ # Create appointment
│ │ ├── auth/ # NextAuth routes
│ │ ├── barber/ # Barber's appointments API
│ │ ├── otp/ # OTP send/verify
│ │ ├── public/[slug]/ # Public services & slots API
│ │ └── whatsapp/ # Instance, QR, webhook, disconnect
│ ├── barber/ # Barber panel (5 pages)
│ └── super-admin/ # Super admin panel (5 pages)
├── components/
│ └── ui/ # Shadcn components
│ └── shared/ # WhatsApp connect client component
└── lib/
├── llm/ # LLM factory, providers, booking agent
├── whatsapp/ # Evolution API client, OTP
├── auth.ts # NextAuth config
├── crypto.ts # AES-256-CBC encryption
├── prisma.ts # Prisma singleton
├── redis.ts # ioredis singleton
└── slots.ts # Slot availability algorithm
| Method | Path | Description |
|---|---|---|
| GET | /api/public/[slug]/services |
List barber services |
| GET | /api/public/[slug]/slots?date=&serviceId= |
Get available slots |
| POST | /api/appointments |
Create appointment |
| POST | /api/otp/send |
Send OTP via WhatsApp |
| POST | /api/otp/verify |
Verify OTP code |
| GET/POST | /api/whatsapp/instance |
Create/check instance |
| GET | /api/whatsapp/qrcode |
Get QR code |
| POST | /api/whatsapp/disconnect |
Disconnect instance |
| POST | /api/whatsapp/webhook |
WhatsApp webhook (LLM AI) |
| GET/PATCH | /api/barber/appointments |
Barber's appointment management |
npm run build
npm startdocker compose -f docker-compose.yml up -dAll required variables are documented in .env.example. Never commit .env to version control.
MIT