Build a Real-Time Chat Application with Node.js
Welcome! In this course you will build a real-time chat application from absolute scratch — the same kind of technology that powers WhatsApp Web, Slack, and Discord. By the end, messages you type in one browser tab will appear instantly in another tab. No page refresh. Magic? No — WebSockets and Socket.IO.
What we are building
You will create a chat app where users can:
- Enter a username and join a named room (like
#generalor#nodejs-help) - Send and receive messages instantly with other people in the same room
- See who joined or left the room (system messages)
- See a typing indicator and online users list (bonus features in later lessons)
What the finished UI looks like
Imagine two screens:
- Login screen — centered card on a dark background. Two text boxes (name + room) and a blue “Join Chat” button.
- Chat screen — header showing the room name and online users on the right; scrollable message area in the middle; your messages appear as blue bubbles on the right, others appear as gray bubbles on the left; a sticky input bar at the bottom with Send button.
It feels similar to Telegram or WhatsApp — clean, modern, and mobile-friendly.
Tech stack (everything is free and beginner-friendly)
| Technology | Role |
|---|---|
| Node.js | Runs JavaScript on the server — handles connections from many users at once |
| Express | Simple web framework — serves your HTML, CSS, and JS files |
| Socket.IO | Real-time library — pushes messages to browsers instantly |
| HTML / CSS / JS | The chat user interface in the browser |
Prerequisites — what you need before starting
- Node.js installed — download from nodejs.org (LTS version). Verify: open terminal and run
node -vandnpm -v. - Basic JavaScript — variables, functions, arrays, objects,
ifstatements. You do not need React, TypeScript, or databases. - A code editor — VS Code is recommended (free).
- A modern browser — Chrome, Edge, or Firefox.
Course roadmap — 10 lessons
- Introduction (this lesson) — overview and goals
- Project setup — folder, npm, dependencies
- Server — Express + Socket.IO backend
- HTML — login screen and chat layout
- CSS — modern chat UI styling
- JavaScript — connect client to server
- Running & testing — two browser tabs demo
- Socket.IO deep dive — how real-time works
- Bonus features — typing, online users, timestamps
- Deploy & troubleshoot — Railway hosting + summary
GitHub repository
When you finish the project, push your code to GitHub. Use this placeholder until you create your repo:
[REPO_LINK] — replace with your GitHub URL after Lesson 10
What you will learn (big picture)
- How a Node.js server accepts many browser connections
- What “real-time” means vs normal HTTP request/response
- How Socket.IO rooms and events work
- How to connect frontend JavaScript to a backend server
- How to deploy a live chat app to the internet for free
node -v fails in terminal, nothing else in this course will work until Node.js is installed and your terminal is restarted.