https://github.com/localhost-four/anon
https://github.com/localhost-four/anon
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/localhost-four/anon
- Owner: localhost-four
- Created: 2025-06-22T14:34:57.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-20T21:15:32.000Z (11 months ago)
- Last Synced: 2025-07-20T22:11:53.757Z (11 months ago)
- Language: JavaScript
- Homepage: https://localhost-four.github.io/anon/
- Size: 229 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Security: SECURITY.md
Awesome Lists containing this project
README

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:
```json
{
"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.