Core API Overview
The rdv.ai-API repository acts as the central nervous system of the Rendez-vous.ai ecosystem. Built with Node.js, Express, and TypeScript, this service does not hold a database of its own. Instead, it is a highly scalable orchestration layer that bridges our frontend interfaces (Voice and Web) with Large Language Models (LLMs) and our central database (Payload CMS).
Role in the Ecosystem
The Core API is responsible for:
- Telephony Orchestration: Receiving HTTP webhooks from our FreeSWITCH infrastructure, managing the SIP call state, streaming real-time audio bytes, and handling voice activity detection (VAD).
- Web Chat Orchestration: Managing state and message histories for the embeddable website widgets.
- LLM Routing: Prompting and routing requests to the appropriate AI models (e.g., Google Gemini or OpenAI) based on the specific agent’s configuration.
- Tool Execution: Acting as the bridge between the LLM’s function calling capabilities and real-world external APIs (e.g., booking a calendar slot, searching a casino tournament, fetching weather data).
Project Structure
If you are exploring the rdv.ai-API codebase, here are the most critical directories inside src/:
routes/: The Express routing layer. It is divided into logical domains:telephony.ts(FreeSWITCH webhooks),webagent.ts/widget.ts(API endpoints for the chat widget).controllers/: The business logic for handling incoming requests.telephony/: Manages incoming calls, buffers audio streams, and handles recording uploads to S3.webagent/&widget/: Handles the text-based chat states and configurations.services/: Internal services used to communicate with the rest of the stack.dashboard/: Contains the logic for fetching data from the Payload CMS database.llm/: The Supervisor logic that formats prompts and communicates with Google/OpenAI.genql/: The auto-generated GraphQL client.lib/tools/: The massive library of functional tools that the AI can trigger. This includes integrations likecalendar,texapoker,weather, andhubspot.
Data Access (GenQL)
A core architectural principle of Rendez-vous.ai is that the Dashboard (rdv.ai-dashboard) holds the PostgreSQL database and exposes a GraphQL API.
To ensure type-safety and developer speed, the Core API uses GenQL to query this database. The GenQL client is located in src/services/genql/genql-client.
// Example of how the Core API fetches data from the Dashboard
import { createClient } from '../services/genql/genql-client';
const client = createClient({
url: `${process.env.PAYLOAD_URL}/api/graphql`,
headers: {
Authorization: `users API-Key ${process.env.PAYLOAD_API_KEY}`,
},
});
// Fetching an agent's configuration
export const fetchAgentConfig = async (phoneNumber: string) => {
const res = await client.query({
Accounts: {
__args: {
where: { telephony_number: { equals: phoneNumber } }
},
docs: {
id: true,
telephony: { prompt: true, tools: true }
}
}
});
return res.Accounts.docs[0];
};Whenever the database schema changes in the Dashboard repository, we regenerate the GenQL client in the API repository to guarantee our queries never silently break.