Overview
Conversa AI is a multi-tenant SaaS for conversational AI agents focused on automated support and commercial conversion. The goal was to move from Level-2 chatbots to Level-3 AI agents with tool execution—assistants that can query knowledge bases, invoke tools, and run conversations with real context.
Beyond a unified inbox, the project is a full systems engineering exercise: a message pipeline, LLM orchestration, RAG with vector embeddings, a rules engine, real-time sentiment analysis, and omnichannel routing behind one Message Gateway.
Technical architecture & ownership
- Full-stack engineering: End-to-end TypeScript with Next.js 16 (App Router + React 19 + React Compiler) on the frontend and NestJS 11 on the backend.
- Real multi-tenancy: All data scoped by
organizationId via TenantInterceptor and TenantGuard, with plan-based feature gating through @RequireFeature().
- AI & RAG: OpenAI and Anthropic SDKs, 1536-dimensional embeddings stored in PostgreSQL + pgvector, and an Agent Engine that registers tools dynamically via
OnModuleInit.
- Infra & DevOps: Docker Compose in production, CI/CD with GitHub Actions (buildx → GHCR → SSH deploy), BullMQ for async processing, and MinIO (S3-compatible) for media storage.
- Real time: Socket.IO via
@nestjs/websockets for a live inbox, typing indicators, and sentiment updates as conversations progress.
Stack
- Frontend: Next.js 16, React 19, Tailwind CSS v4, Zod v4, next-intl (PT/EN)
- Backend: NestJS 11, Prisma ORM (~60 models), PostgreSQL 17 + pgvector, Redis 7
- AI: OpenAI SDK, Anthropic SDK, RAG with vector embeddings
- Integrations: Evolution API (WhatsApp), Meta Graph API (Instagram/Messenger), SendGrid (email), n8n (external automations)
- Infra: Docker Compose, MinIO, BullMQ, Socket.IO, JWT auth
Supported channels
Five channels integrated into the same Message Gateway:
- WhatsApp via Evolution API
- Embeddable Web Chat via Socket.IO widget
- Email via SendGrid (inbound + outbound)
- Instagram DM via Meta Graph API
- Facebook Messenger via Meta Graph API
Message pipeline
Every inbound message goes through a deterministic chain:
- Identification — create or resolve contact and conversation
- Auto-assign — round-robin or least-busy across department agents
- Persistence + async analysis — sentiment and language detection in the background
- Rules engine — evaluate tenant-configured automations
- Chatbot flows — try to match a structured flow
- AI agent fallback — if nothing matches, the LLM with RAG takes the conversation
Engineering highlights
- AI Copilot suggesting three replies for the human agent—faster handling without blind automation.
- Conversation summary and sentiment analysis in real time, updating the UI as the chat evolves.
- Per-tenant rules engine (SLA, priority, tags, assignment) without redeploys.
- Per-tenant rate limiting (10 req/s, 50 req/10s, 200 req/min) via a global
TenantThrottlerGuard.
- Operations-first: health checks, soft delete, activity log, contact merge, and CSV exports.
Next steps
- Visual drag-and-drop flow builder (today: JSON editor)
- 2FA/SSO and a public API documented in Swagger
- Automated test coverage and structured logging
- Telegram Bot API channel