About
Projects
BlogWhere I write, think and learn.GallerySometimes I also take photos.WrappedA recap of what's been on rotation lately.
Blog
Gallery
Wrapped
© 2026 /Gilang Fatahilah

Kaiwaa: Real-Time Chat App with Socket.IO & MongoDB

Avatar
Gilang FatahilahDecember 11, 2024
Kaiwaa: Real-Time Chat App with Socket.IO & MongoDB

Introduction

This project is a real-time chat application built using Express.js, Socket.IO, and MongoDB, with secure JWT-based authentication. The main goal of this project was to deeply understand how real-time communication works in production environments, from socket connections, user presence tracking, authentication, to deployment challenges. The application supports real-time messaging, online user detection, authentication with cookies, and seamless frontend-backend interaction using modern web standards.

Key Features

  • Real-Time Messaging: Instant message delivery using WebSocket via Socket.IO.
  • Online User Detection: Display active users in real-time based on connected sockets.
  • JWT Authentication with Cookies: Secure login system with middleware-based socket authentication.
  • Private Chat System: User-to-user private messaging using mapped socket IDs.
  • Session Persistence: Automatically reconnect and restore user presence after refresh.
  • Production-Ready Deployment: Configured for cloud deployment with proper CORS and WebSocket handling.

Technologies Used

  • Vite + React: Frontend stack for fast development, instant HMR, and highly optimized production builds.
  • Tailwind CSS: Utility-first CSS framework for building modern and responsive UI.
  • DaisyUI: Component library built on top of Tailwind CSS to speed up UI development.
  • Express.js: Backend framework for handling APIs and middleware.
  • Socket.IO: Core technology for enabling real-time, bidirectional communication.
  • MongoDB: NoSQL database for storing users, messages, and chat relationships.
  • JWT (JSON Web Token): Secure authentication mechanism using HTTP-only cookies.
  • Axios: HTTP client for handling API communication from the frontend.

Challenges and Learnings

The biggest challenges in this project were related to real-time architecture and production deployment, especially:
  • Handling WebSocket authentication using cookies and JWT
  • Maintaining socket-user mapping for targeted message delivery
  • Dealing with CORS issues in production environments
  • Handling server sleep & cold starts on cloud platforms
  • Ensuring Socket.IO remains stable under reconnect conditions
Through this project, I learned how real-time systems behave differently from traditional REST APIs, especially in terms of connection lifecycle, security layers, and scalability concerns.

Outcome

This project significantly strengthened my understanding of real-time web systems, from authentication flow to production stability. It also gave me hands-on experience in solving real deployment issues such as CORS, WebSocket transport configuration, and server lifecycle management. The final result is a fully functional, production-ready real-time chat application that serves as a solid foundation for future messaging-based systems such as customer support platforms, social chat apps, and collaborative tools.
Open live site

Related projects

Orbitari: Interactive 3D Model Solar System

Orbitari: Interactive 3D Model Solar System

November 14, 2026A static 3D website for exploring the Solar System with real planet positions for any date from year 1 to 9999, built with SvelteKit, Three.js, and astronomy-engine.
Typescript
SvelteKit
Three.js
Tailwind CSS
Vite
Avatar
Read moreView project
CISST: Real-time Night Sky Dashboard

CISST: Real-time Night Sky Dashboard

April 17, 2026A location-aware astronomy dashboard that tells you what's visible in the night sky tonight, combining real-time weather data with client-side astronomical calculations.
Typescript
React js
Tailwind CSS
Vite
Avatar
Read moreView project
Nabungo: Building a Personal Finance App from Scratch

Nabungo: Building a Personal Finance App from Scratch

August 28, 2025Nabungo is a full-stack personal finance management app I built to solve my own money tracking problems, from zero idea to production using Laravel, Vue 3, and Inertia.js.
Laravel
Vue js
TypeScript
Tailwind CSS
PostgreSQL
Inertia.js
Avatar
Read moreView project