
A tour of the finished project before we build it. Doctor, nurse, patient and guardian meet in one consultation room: a status saved in PostgreSQL, a video call over WebRTC, live chat, a shared board, and a read-only record of the finished consultation.
The big picture. Three roads carry data: HTTP for lists and status changes, Socket.IO for rooms, chat and the board, and WebRTC for video and audio. See the three folders of the project, the learning order of the course, and what the course deliberately leaves out.
Create the skeleton of the project: a pnpm workspace with a web app, an API and a shared contracts package. Check the tool versions, read the workspace file and the root scripts, and see why contracts is built before the apps use it.
The web side of the skeleton. How the Next.js App Router turns folders into addresses, where server components end and client components begin, and the small shared Button, Card and Badge components used on every screen.
The server side of the skeleton. Modules, controllers and services in NestJS, environment loading, CORS and request validation. Then start the server and send the first request to the health endpoint.
Run PostgreSQL in a Docker container while NestJS and Next.js run on your own machine. Read the compose file and the environment file, create the connection pool, and check the tables that the server creates.
Design the three tables of the project: staff, patients and messages. Why a user id and a room id are different things, how the demo data is seeded safely on every start, and why no real patient data is used.
Build the patient list and status change APIs. Query by main or secondary staff, sort in-consultation patients first, validate the PATCH body with a DTO, return 400 for bad values and 404 for a missing patient, and pin the rules with tests.
Save and read chat. The socket saves each message first and HTTP reads the history, the newest 100 in time order. Try it by hand with a practice room and see why the query cuts the recent messages first and then reverses them.
Sign in with a role card. A small NestJS endpoint returns a training user, the browser keeps it per tab in sessionStorage, and React subscribes to it with useSyncExternalStore. See where real authentication would replace this.
Build the staff patient queue. One hook fetches the list, two tabs filter the same array, and each patient card shows only what helps you choose the next patient. Check the screen against the real API response.
Change the consultation status safely. Save to the server first and update the screen on success, keep exactly one patient in consultation, resume a completed patient, and see the limits of two separate requests.
Lay out the consultation room. Tailwind grid classes for different widths, why min-h-0 keeps scrolling inside the chat list, and buttons for a dark background. Measure the real widths at 1440, 1024, 700 and 390 pixels.
Connect different browsers to the same room. Create the Socket.IO connection, the join and leave events, and the participant list that the server sends to everyone. Watch the doctor screen change when a patient joins and leaves.
The most confusing part of WebRTC, step by step. Signaling goes over the socket while media goes direct. Follow offer, answer and ICE candidates, then the perfect negotiation rule that fixes two people turning on the camera at the same time.
Put the camera and the microphone on the connection. getUserMedia, adding tracks to every connection, friendly error messages, and the difference between muting a track and stopping the device and its indicator light.
Show the other person's video. Store the streams by person, attach them to video elements, and handle browsers that block playback with sound, using a button that plays inside a click. Simulate the block and watch the fix.
Invite a guardian with one link, reusing the same room and the same connection code, and share the screen by swapping the video track with replaceTrack, without renegotiating. See why the guardian role has the lowest priority.
Real-time chat with a saved history. Draw the message on the sender screen at once, save it on the server, relay it to the others, remove duplicates, and restore the history after a refresh.
A shared board that looks the same on every screen. Send ratio coordinates from 0 to 1000, draw with SVG and pointer events, validate every stroke on the server, and give latecomers the board drawn so far.
Decide who controls the board and the captions. One rule in the shared package, a role priority from doctor down to guardian, used by both the screen and the server, and handed over when the highest role leaves.
Make the board look like a blackboard and save the drawing as a PNG with modern-screenshot, without the video. Pick pen colors, clear or close the board, and check the saved file name and size.
Voice captions with the speech recognition built into the browser: only the text travels over the socket. Learn what works, how errors are handled, and the honest limits of this approach for a real medical service.
Read a finished consultation and reopen it. A read-only record that opens no socket and changes no status, next to a resume button that does change the status. Check the difference in the database.
Troubleshooting and the final checks. What to look at first for each symptom (ports, database, CORS, camera, sound, connection), then lint, tests and a production build as the standard for done.
Wrap up. A table of what a production service still needs and where in the code each task starts, five exercises to try yourself, and a look back at everything you built.
This course contains the use of artificial intelligence. The English narration was produced with a licensed text-to-speech voice from instructor-authored and instructor-reviewed course material.
Most WebRTC and SocketIO tutorials stop at a demo. This course connects everything into one real workflow: a patient status saved in PostgreSQL reaches the screen, and doctor, nurse, patient and guardian browsers meet in one consultation room with video, audio, chat and a shared board.
You build a training telemedicine service with NestJS, Nextjs, PostgreSQL, SocketIO and WebRTC. We start with a pnpm workspace and a shared contracts package, then create the tables and the REST API. On top of that we build role-based screens, a patient queue and a responsive consultation room. After that comes the real-time part: rooms and participants, WebRTC connections with a rule that survives both sides starting at once, camera, microphone and screen sharing, guardian invitations, optimistic chat with a saved history, a shared board based on 0 to 1000 coordinates, role priority for who controls the board and captions, and browser voice captions. The last section covers completed records, resuming a consultation, lint, tests and a production build.
Every lecture highlights the real source lines on screen, runs the commands in a real terminal, and shows the app in two or three browser tabs at once. When two people turn on the camera at the same moment and the connection fails, you see why and how the fix works.
The project is for training. All patients and conversations are fictional, and the course does not cover real authentication, a TURN server, encryption of personal data or deployment. Those are listed as production extension tasks, and the last lecture gives you five exercises with the file to start from.