Skip to content

localhost-8/anon

 
 

Repository files navigation

image
Welcome to Anon Chat!
The new place for communication is open to everyone without registration, only on our CHAT page! (Web-Demo)
While it's a demo version, you can try to chat in it.

🌐 Realtime Chat Web App

A lightweight, secure, and fully-featured real-time chat application built with Firebase Realtime Database and vanilla JavaScript. Designed for simplicity, privacy-first interaction, and cross-device synchronization.


📦 Project Overview

This is a client-side web-based chat system that allows users to:

  • Send, edit, and delete messages
  • Reply to messages
  • Pin important messages
  • React to messages with check/cross buttons
  • Search through messages
  • Change nickname, color theme, and chat title
  • View online users
  • Auto-clean old messages
  • Use dark/light themes
  • Store user identity via cookies
  • Synchronize data across devices

All interactions are handled in real-time using Firebase, with security rules and input validation included.


📁 File Structure

/anon/

├── index.html # Main HTML file containing the chat UI layout
├── style.css # CSS styles for chat interface (mobile & desktop)
├── script.js # Core JavaScript logic and Firebase integration
├── firebase-rules.json # Firebase Realtime Database security rules
└── README.md # This file — project documentation


🛠️ Technologies Used

  • Firebase Realtime Database – For real-time message and presence sync
  • Vanilla JavaScript – No frameworks, pure JS for performance and simplicity
  • HTML5 / CSS3 – Responsive UI design
  • Cookies + localStorage – User persistence without login
  • Security Filters – Input sanitization, XSS protection, and regex validation

🔒 Security Features

  • All messages are sanitized before display
  • Input validation (length, allowed characters)
  • Cookie-based user identity (agentId) with expiry
  • Firebase rules to restrict unauthorized access
  • Prevention of injection attacks (XSS)
  • Presence system with automatic timeout (60s)
  • Message editing/deletion limited to original author

Example Firebase Rule:

{
  "rules": {
    ".read": true,
    ".write": true,
    "messages": {
      "$messageId": {
        ".write": "$messageId === auth.uid || auth != null",
        ".read": true
      }
    },
    "users": {
      "$userId": {
        ".write": "$userId === auth.uid || auth != null",
        ".read": true
      }
    }
  }
}

# 1. 🚀 Deployment Instructions
git clone https://github.com/localhost-four/anon.git
# 2. Replace Firebase config in script.js with your own credentials.
# 3. Deploy to Firebase Hosting or any static hosting provider.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 72.3%
  • CSS 21.5%
  • HTML 6.2%