UChat | Real-Time Chat Platform
A multi-tenant real-time chat platform built on Django, Channels, and Tailwind CSS: every business signs up, adds agents, and talks with its customers live over WebSocket.
UChat is a multi-tenant real-time chat platform built from the ground up with Django, Django Channels, and Tailwind CSS. Any business can sign up, add support agents, and talk to its customers in real time — through a fully Persian, right-to-left interface with a dark mode and the Dana typeface that feels equally native on phones and desktops.
The architecture is multi-tenant by design: every business is an isolated tenant with its own name, logo, brand color, and contact details, and users are organized into three roles — owner, agent, and customer. The owner adds agents, and each agent can hold a separate conversation with each customer; a chat room is unique per business, customer, and agent, so histories never bleed across responders. Blocking and deleting rooms are moderation actions reserved for the business side.
The real-time core runs over WebSocket: ws/chat/<room_id>/ keeps a conversation live while ws/business/inbox/ streams inbox updates to the business. Typing indicators, activity signals such as recording a voice message or choosing a file, online/offline presence, per-room unread counts, and live inbox refresh all travel through the same channel layer backed by Redis — with presence tracked per browser tab and kept alive by TTLs and heartbeats.
Messages come in four kinds — text, image, voice, and file — each with reply (including a preview of the referenced message), editing, deletion, and copy support. Timestamps and dates render in the Jalali (Persian) calendar throughout the platform, and read state is recorded for both sides of every conversation.
Attachment rules are enforced server-side: images up to 5 MB in standard web formats, voice messages up to two minutes with real duration inspection, and general files up to 20 MB. File attachments live in a private storage whose keys are random UUIDs — never the user's filename — and downloads are only possible through a dedicated endpoint that re-checks room authorization on every request, with zip-bomb protections layered on top.
Authentication is configurable in three modes: username with a password, phone number with a one-time SMS code (OTP), and phone number with a password. Iranian mobile numbers are normalized to a standard format, the six-digit OTP carries a validity window, a resend cooldown, and an attempt cap, and separate rate limits restrain login, registration, and phone-check endpoints per IP and per account. Trusted devices, forced password changes for auto-generated accounts, and server-side profile-photo validation with cropping round out the same layer.
The commercial model rests on subscription plans: each plan defines a price in Toman, a duration, an agent cap, and a monthly message quota, and a business is activated after purchase with a single-use signup code (format UCHAT-XXXX-XXXX) that is bound to the purchaser's phone and carries an expiry. Every commercial entitlement decision — plan validity, agent caps, message quotas — is made in one centralized policy module, so the limits are enforced exactly and never bypass the technical and security controls.
Every business also receives a public token, and with it an embed URL it can place on its own website. The embed's landing page lists the business's active agents together with their live presence, and the customer can start the conversation with a chosen agent or a general room; the business's brand color is applied throughout that interface.
Privacy is designed in two layers. A visitor can start chatting without a full sign-up: on the privacy-preserving guest path, a first and last name are all it takes to start the conversation, the guest account is temporary (seven days by default) and is deleted along with its related data once the window closes, while a reminder notification invites the visitor to complete registration and keep the conversation history. On the team side, Ghost Mode hides an owner's presence from customers, and Quiet Mode plus per-room muting give precise control over notifications.
Notifications work both in-app and over the web: the notification center groups each conversation's alerts into a single card with severity levels and destination links, while browser Web Push subscriptions are managed through VAPID so alerts arrive even when the browser is closed. Notification creation is idempotent, so repeated events never produce duplicate alerts.
The runtime is production-ready: ASGI serving with Daphne, a Redis-backed channel layer and cache, PostgreSQL in production (SQLite with concurrency hardening in development), static files delivered through WhiteNoise, Origin validation on every WebSocket handshake to block cross-site WebSocket hijacking, security headers with HSTS, and isolated cookies for subpath deployments.
- Technologies
- Python Django Tailwind CSS WebSocket
Project team
Soheyl Mohammdi
Founder