Real-Time Chat Platform

Real-Time Chat Platform

A real-time web chat app with private messaging, group chat, and online presence using Django Channels.

Project Overview

A full-featured real-time chat platform built with Django and Django Channels. It uses WebSockets for instant messaging and HTMX for smooth, dynamic UI updates without a heavy frontend framework. The system supports one-to-one and group conversations, along with live online/offline user status for a responsive chat experience.

Engineering Architecture & Notes

Architecture
Django + DRF APIs with Django Channels (WebSockets) for real-time messaging; Postgres as source of truth.
Data Model
Conversation, Message, Membership; presence tracked via session/last_seen signal.
Performance & Reliability
Indexed message reads by (conversation_id, created_at) for fast pagination; handled ordering/duplication edge-cases by sorting on (created_at, id).
Engineering Tradeoff
Chose WebSockets over polling for presence + instant delivery; accepted extra complexity to keep UX truly real-time.

Key Features

  • Real-time messaging with WebSockets (Django Channels)
  • Private one-to-one conversations
  • Group chat rooms
  • Live online/offline presence indicators
  • Fast, dynamic UI updates using HTMX
  • Scalable backend architecture with PostgreSQL indexing