Back to Projects
Nov 2025
View Source CodeLocalChat Pro
Project Overview
LocalChat Pro is a fully functional, real-time communication platform. The core focus was engineering a robust Node.js/WebSocket server capable of handling high-fidelity, persistent messaging while implementing critical security controls and moderation features essential for an enterprise environment.
Protocol Architecture
Dual-Layer Protocol
Communication is split across two channels for optimal security and reliability:
- HTTP (REST API): Handles high-integrity tasks like authentication, user registration, and file uploads using validation middleware.
- WebSockets: Manages real-time events including messaging, typing indicators, and presence states, requiring an initial HTTP handshake first.
Security & Moderation
Built-in controls for platform safety:
- RBAC: Server-side privilege enforcement where high-privilege commands (/kick, /ban) are validated against user hierarchy.
- File Security: Mime-type whitelisting and randomized filenames to prevent directory traversal and overwrite attacks.
- Sanitization: DOMPurify integration protects against XSS while maintaining Markdown rendering capabilities.
Advanced Features
Threading & Logging
Data structure and forensic readiness:
- Threading: Canonical thread structure utilizing self-referencing foreign keys on the messages table.
- Audit Logs: Immutable record of critical administrative actions (bans, deletions) for forensic investigation.
- Ownership: Channel deletion restricted strictly to the creator or Admin, protected by private invite codes.