DeskcommCRM: How to Deploy an Open-Source CRM with AI Agents for WhatsApp on Your Own Server
WhatsApp sales require constant manager involvement or connecting third-party services like Kommo or Intercom. As the client database grows, subscription fees and per-seat charges become a significant expense. Developer Rafael Melgara from Brazil released DeskcommCRM on GitHub. It's a self-hosted sales management system designed for AI agents and messenger integration.
The project is positioned as a sales management system for small and medium businesses. Initially, it was built for an online store with Nuvemshop integration, but later the architecture was reworked. The result is a flexible solution for clinics, real estate agencies, info businesses, and any services that receive requests from chats.
Technology Stack and Architecture
Architecturally, DeskcommCRM is built on a familiar stack for modern web applications:
- Frontend and backend: Next.js 16 (App Router) with React 19 and TypeScript in strict mode.
- Database and authentication: Supabase (PostgreSQL), actively using Row Level Security (RLS) mechanism and pgvector extension for vector search.
- WhatsApp integration: WAHA (WhatsApp HTTP API) on the NOWEB engine, running in a Docker container.
- AI layer: Vercel AI SDK v7 with integration of Anthropic Claude, OpenAI, and Google Gemini models.
The system contains a built-in MCP (Model Context Protocol) server. This means external AI agents can connect to the CRM via a common protocol and perform operations with the sales funnel.
Smart Agents Instead of Regular Autoresponders
In DeskcommCRM, AI agents work differently from traditional chatbots with rigid scenario trees. The bot takes on the role of a responsible manager: conducts dialogue, qualifies leads, moves them through funnel cards, and transfers the conversation to a human when it cannot answer independently.
For each client, an isolated knowledge base is created. Successfully completed dialogues are fed back into the vector storage. This way, the agent gradually accumulates context and becomes more accurate when answering typical questions. At the same time, the transfer of control to humans is controlled by rules to prevent the bot from sending unnecessary messages.
Webhooks and Processing Queues
For receiving requests from external landing pages and forms, the system provides webhook entry points. Any POST request with parameters in JSON or urlencoded format immediately creates a lead at the required stage in the funnel.
The internal event processing is set up interestingly. To avoid overloading PostgreSQL triggers with HTTP requests, the developer applied an event table pattern. All actions (lead status change, tag appearance, incoming message) are recorded in the table. A background process retrieves events from the queue once per minute and executes automations of the "when/if/then" type.
In practice, the scheme looks like this:
In the Vercel cloud, this route triggers a regular Cron Job, and when deploying on your own server, startup is picked up by the system .
Security and Data Isolation Verification
Since the CRM supports multi-tenancy, it's critical to ensure that one company doesn't see other companies' contacts or conversations. In DeskcommCRM, isolation is built on RLS policies in PostgreSQL.
The repository has a CI pipeline configured that runs 364 invariant tests on a clean database instance with every pull. One of the key tests generates two different organizations, simulates user JWT tokens, and checks whether the database returns at least one row from another company. If the security policy leaks foreign data, the build fails.
Quick Start in Local Environment
To explore the code, the project can be spun up locally in a couple of minutes. You'll need Node.js version 22, pnpm, and Docker running.
For a full deployment on a VPS, the author prepared a set of scripts . The script itself requests the domain, Supabase keys, neural network API keys, generates tokens, and brings up a ready-made stack with HTTPS certificates.
Limitations and Project Specifics
When exploring the repository, keep in mind several nuances:
- Part of the code comments and documentation is written in Portuguese, since the project was initially created for the Brazilian market.
- The repository is still relatively young, with just over 300 stars on GitHub.
- WhatsApp integration relies on WAHA, so with high message activity, it's important to configure delays and sending intervals to protect against number blocking.
Who Will Find DeskcommCRM Useful
The project will be useful for web studios and freelancers who build turnkey CRM systems for small businesses and don't want to pay for monthly subscriptions to third-party services. The code will also be valuable for developers as a quality reference: you can find examples of clean Next.js 16 usage, RAG setup with pgvector, MCP server implementation, and RLS policy testing in PostgreSQL.
Related projects