Telehealth App Development with Real-Time Video, AI Booking, & Chat

Posted By : Mudit Singh | 30-Mar-2026

Traditional telehealth systems often fail under scale ? video drops under load, booking conflicts arise, and chat systems lag or crash. A tightly coupled architecture makes things worse: one failure cascades across the entire system.

To solve this, we design a microservices-based telehealth platform, where video, booking, chat, and AI services operate independently, communicate via events, and scale independently.

This guide walks through:

  • System architecture (microservices + real-time layer)
  • End-to-end user journeys
  • Code-level implementation snippets

System Architecture Overview

The system is split into six core services, each owning its own responsibility and database:

  • Auth Service ? Handles JWT-based authentication and manages active user sessions using Redis for fast access.
  • Booking Service ? Manages appointment creation, scheduling logic, and integrates AI to automate booking flows.
  • Video Service ? Coordinates WebRTC signaling and manages video session lifecycle between participants.
  • Chat Service ? Enables real-time messaging between users using persistent WebSocket connections.
  • AI Service ? Processes voice input and natural language to assist users in booking appointments intelligently.
  • Notification Service ? Consumes system events and sends notifications via email, SMS, or push channels.

Communication Pattern

  • REST APIs ? Used for synchronous, request-response interactions between services and clients.
  • RabbitMQ / Kafka ? Handles asynchronous, event-driven communication for decoupled service interaction.
  • WebSockets ? Maintains real-time, bidirectional communication for chat and signaling.
  • WebRTC ? Enables direct peer-to-peer video/audio streaming between users.

 

Also, Read | Telehealth App Development with Real-Time Video, AI Booking, & Chat

 

Gateway Layer

  • API Gateway (NGINX / Gateway Service) ? Acts as a single entry point, routing requests, handling authentication, and managing load balancing across services.

1: Patient Books Appointment via AI Voice

This demonstrates how a patient can book an appointment using natural voice input, making the system more accessible?especially for elderly users or those unfamiliar with complex interfaces.

[Patient Speaks]
       ?
       ?
[AI Service] ???? Speech ? Text ? NLP Intent Extraction
       ?
       ?
[Booking Service] ???? GET /slots
       ?
       ?
[Patient Confirms] ???? POST /appointments
       ?
       ???? [Notification Service] ? Confirmation sent
       ???? [Video Service] ? Session created

 

Step 1 ? Convert Voice ? Intent (AI Service)

The AI service processes raw voice input and converts it into structured booking intent using speech recognition and NLP.

const text = await speechToText(audioInput);

const intent = await nlpModel.parse(text);
// Example output:
{
 action: "book",
 doctorType: "dermatologist",
 date: "tomorrow",
 time: "morning"
}
 

Step 2 ? Check Availability + Book Slot

The booking service validates available slots based on extracted parameters and ensures no conflicts before confirming the appointment.

const slots = await db.query(
 `SELECT * FROM slots
  WHERE doctor_type = $1
  AND date = $2
  AND is_available = true`,
 [intent.doctorType, intent.date]
);

const booking = await db.query(
 `INSERT INTO appointments (patient_id, doctor_id, slot)
  VALUES ($1, $2, $3) RETURNING *`,
 [patientId, selectedDoctor, selectedSlot]
);
 

Step 3 ? Emit Event (Triggers Video + Notification)

Once the appointment is confirmed, an event is emitted to trigger downstream healthcare workflows.

channel.sendToQueue(
 'appointment.booked',
 Buffer.from(JSON.stringify({
   appointmentId: booking.rows[0].id,
   patientId
 })),
 { persistent: true }
);

 

You may also like | Healthcare Payments : The Role of Blockchain Technology

 

2: Patient Joins Video Consultation

This represents the core telehealth interaction, where a patient connects with a doctor in real time. The system must ensure low latency, secure communication, and reliable connection handling across varying network conditions.

[Patient Clicks Join]
       ?
       ?
[Video Service] ???? Create WebRTC Session
       ?
       ?
[Signaling Server] ???? Exchange SDP + ICE
       ?
       ?
[Doctor + Patient Connected]
 

Step 4 ? Create WebRTC Offer

The video session begins with the creation of a WebRTC peer connection. The client generates an SDP offer and sends it via the signaling server.

const peerConnection = new RTCPeerConnection(config);

const offer = await peerConnection.createOffer();
await peerConnection.setLocalDescription(offer);

socket.emit('offer', offer);

This step initializes:

  • Media negotiation (audio/video codecs)
  • Connection parameters between peers

Step 5 ? Handle ICE Candidates

To establish a reliable connection across different networks (NATs/firewalls), ICE candidates are exchanged between peers.

peerConnection.onicecandidate = (event) => {
 if (event.candidate) {
   socket.emit('ice-candidate', event.candidate);
 }
};
 

Step 6 ? Session Creation (Backend)

Once the session is initiated, the backend persists the video session for tracking and coordination.

await db.query(
 `INSERT INTO video_sessions (appointment_id, room_id)
  VALUES ($1, $2)`,
 [appointmentId, uuid()]
);

This allows:

  • Session tracking and analytics
  • Linking video calls to appointments
  • Future features like recording or audit logs

 3: Real-Time Chat and Consultation Completion

This combined journey represents the active consultation phase, where patient and doctor communicate in real time, followed by a structured completion of the visit. It ensures  continuous interaction during the session 

[Patient Sends Message]
      ?
      ?
[WebSocket Server]
      ?
      ?
[Chat Service] ???? Store Message
      ?
      ?
[Doctor Receives Instantly]
      ?
      ?
[Doctor Ends Call]
      ?
      ?
[Booking Service] ???? Update status = completed
      ?
      ???? [Notification Service] ? Summary sent
      ???? [AI Service] ? Generate consultation notes (optional)
 
Step 7 ? WebSocket Message Handling

During the consultation, real-time messaging is handled via WebSockets to ensure low-latency communication between patient and doctor.

io.on('connection', (socket) => {
 socket.on('send_message', async (data) => {
   await db.query(
     `INSERT INTO messages (sender_id, receiver_id, message)
      VALUES ($1, $2, $3)`,
     [data.sender, data.receiver, data.message]
   );

   socket.to(data.receiver).emit('receive_message', data);
 });
});

This enables:

  • Instant message delivery
  • Persistent chat history
  • Seamless communication alongside video

Step 8 ? Mark Appointment Completed

Once the consultation ends, the system updates the appointment status and triggers downstream workflows.

 

await db.query(
 `UPDATE appointments SET status = 'completed'
  WHERE id = $1`,
 [appointmentId]
);

channel.sendToQueue(
 'appointment.completed',
 Buffer.from(JSON.stringify({ appointmentId })),
 { persistent: true }
);

This ensures:

  • Consultation is formally closed
  • Patient receives visit summary
  • Additional processes like AI-generated notes can be triggered

Also, Discover | Making Wellness Accessible With Mobile Healthcare Apps

Notification Service (Event Consumer)

The notification service acts as a central event listener, ensuring that patients and doctors are kept informed at every critical step of the healthcare journey. It consumes events emitted by other services and triggers appropriate notifications.

const queues = [
 'appointment.booked',
 'appointment.completed'
];

queues.forEach(queue => {
 channel.consume(queue, async (msg) => {
   const data = JSON.parse(msg.content.toString());

   await sendNotification(queue, data);

   channel.ack(msg);
 });
});

This enables:

  • Real-time appointment confirmations
  • Post-consultation summaries
  • Decoupled communication between services

 Conclusion

Building a telehealth platform requires more than just enabling video calls or chat?it demands a system that can handle real-time interactions, intelligent workflows, and reliability at scale.By structuring the platform around independent services and event-driven communication, each part of the system?from booking to consultation completion?remains scalable, resilient, and easy to evolve. This approach ensures smooth patient-doctor interactions, consistent system behavior, and the flexibility to introduce future enhancements like AI-driven insights and advanced analytics. Ultimately, it results in a robust, production-ready telehealth platform capable of delivering high-quality healthcare experiences in a scalable and efficient manner. Connect with our skilled healthcare app developers for more info. 

 

About Author

Author Image
Mudit Singh

Mudit is a seasoned back-end developer with a strong specialization in Node.js, boasting a profound comprehension of this technology. His practical experience spans a wide range of tools and frameworks, including React.js, Node.js, Express.js, along with expertise in languages like Data Structures and Algorithms, HTML, CSS, JavaScript, and various databases such as MongoDB. Additionally, he is well-versed in version control systems like Git and Github, as well as SQL. With his extensive knowledge and expertise in development, Mudit consistently produces outstanding results in any project related to his field.

Request for Proposal

Name is required

Comment is required

Sending message..