WARNING - CRITICAL INFRASTRUCTURE
This repository is designed to facilitate communication for Iranian citizens during protests and internet shutdowns. It operates on domestic servers to maintain connectivity when external internet access is restricted or censored. Use responsibly and ensure secure deployment in sensitive environments.
A feature-rich chat application with a WhatsApp-like UI, built with Go and Server-Sent Events for real-time communication.
Modern WhatsApp-like interface with real-time messaging, groups, and media sharing
- User Registration and Login - Complete authentication system
- Password Hashing - Using SHA256
- Secure Sessions - User management with SSE
- User Blocking - Block/unblock unwanted users
- Mutual Contact System - Two-way contact addition
- Private Chat - One-on-one messaging with privacy controls
- Group Chats - Create and manage groups with members
- Leave Group - Exit from groups you no longer want to be in
- File Sharing - Send images, videos, and files
- Voice Messages - Record and send voice messages
- Media Filtering - Filter messages by type (images/files/audio)
- Typing Indicator - Shows when user is typing
- Real-time Messaging - Using Server-Sent Events
- Message Blocking - Blocked users cannot send you messages
- Username Search - Find and add users by username
- Contact Management - Add/remove contacts easily
- Block List - View and manage blocked users
- Group Member Management - Add members from your contacts
- WhatsApp-like Design - Modern and familiar UI
- Dark Mode - Eye-comfortable dark theme
- Responsive - Works on desktop and mobile
- Media Preview - Display images and videos in chat
- Audio Player - Built-in player for voice messages
- Media Filter Tabs - Quick access to specific media types
- Smooth Animations - Professional user experience
- Loading States - Clear feedback during operations
- SQLite Database - Data storage
- Server-Sent Events - Real-time communications
- RESTful API - Modern architecture
- Docker - Ready for deployment
- Offline Capability - Works on local networks without internet
chatApp/
βββ cmd/
β βββ server/
β βββ main.go # Main server with SSE and API
βββ public/
β βββ index.html # Web UI
β βββ app.js # Frontend logic
βββ uploads/ # Uploaded files
βββ chat.db # SQLite database
βββ Dockerfile # Docker image
βββ docker-compose.yml # Service configuration
βββ go.mod # Go dependencies
βββ README.md # This file
- Go 1.21 or later
- Docker and Docker Compose (optional)
- Modern web browser
go mod downloadgo run cmd/server/main.goServer runs on http://localhost:8080
Go to http://localhost:8080 and:
- Register or login
- Search for other users
- Start chatting!
docker-compose up --buildGo to http://localhost:8080
docker-compose down- Open the login page
- Click "Register"
- Enter username, full name, and password
- After registration, login
- Click the chat button
[C](New Chat) - Option A - Search by Username:
- Type a username in the search box
- Click "Search"
- Click "Add Contact" if found
- Option B - Select from List:
- Browse all users below
- Click "Add" to add as contact
- Click on contact to start chatting
- Open a private chat
- Click the block button
[X]in chat header - To unblock, click the
[β]button
In private chats:
- Use the filter tabs: All | Images | Files | Audio
- View only specific types of shared media
- Press and hold the microphone button
[π€] - Record your voice message
- Release to send automatically
- Click the group button
[G](New Group) - Enter group name
- Select members from your contacts
- Click "Create Group"
- Open a group chat
- Click the
[Leave]button in chat header - Confirm to leave the group
- Click the attachment button in the input area
- Select an image or video
- File is automatically uploaded and sent
- Search: Use the search box to find contacts
- Typing: When you type, the other party sees it
- Online Status: See online status indicator
POST /api/register- Register new userPOST /api/login- User login
GET /api/users- Get user listGET /api/contacts?userId={id}- Get user's contactsPOST /api/contacts- Add contact (mutual)DELETE /api/contacts- Remove contact
POST /api/block- Block a userPOST /api/unblock- Unblock a userGET /api/blocked?userId={id}- Get blocked users listGET /api/isblocked?blockerId={id}&blockedId={id}- Check if blocked
GET /api/groups?userId={id}- Get user's groupsPOST /api/groups- Create new groupPOST /api/groups/leave- Leave a group
GET /api/messages?userId={id}&contactId={id}- Get private messagesGET /api/messages?userId={id}&contactId={id}&mediaFilter={type}- Get filtered messagesGET /api/messages?userId={id}&groupId={id}- Get group messagesPOST /api/send- Send messagePOST /api/typing- Send typing indicatorGET /events?userId={id}- SSE connection
POST /api/upload- Upload file (images/videos/audio/voice)GET /uploads/{filename}- Get uploaded file
- id (INTEGER PRIMARY KEY)
- username (TEXT UNIQUE)
- full_name (TEXT)
- password (TEXT - SHA256 hash)
- created_at (DATETIME)- user_id (INTEGER)
- contact_id (INTEGER)
- added_at (DATETIME)
- PRIMARY KEY(user_id, contact_id)- blocker_id (INTEGER)
- blocked_id (INTEGER)
- blocked_at (DATETIME)
- PRIMARY KEY(blocker_id, blocked_id)- id (INTEGER PRIMARY KEY)
- name (TEXT)
- creator_id (INTEGER)
- created_at (DATETIME)- group_id (INTEGER)
- user_id (INTEGER)
- joined_at (DATETIME)- id (INTEGER PRIMARY KEY)
- from_user (INTEGER)
- to_user (INTEGER, nullable)
- group_id (INTEGER, nullable)
- content (TEXT, nullable)
- media_url (TEXT, nullable)
- media_type (TEXT, nullable - image/video/file/audio/voice)
- timestamp (DATETIME)PORT=8080 # Server port- Use HTTPS in production
- Enforce strong passwords
- Implement rate limiting
- Regular database backups
- Input validation and sanitization
x] Voice messages β
Completed
-
User blockingβ Completed -
Username searchβ Completed -
Media filteringβ Completed -
Leave groupβ Completed - JWT authentication
- End-to-end encryption
- Voice/video calls
- Push notifications
- Emoji reactions
- Location sharing
- Message read receipt
github.com/mattn/go-sqlite3- SQLite driver
- JWT authentication
- End-to-end encryption
- Voice/video calls
- Push notifications
- Emoji reactions
- Location sharing
- Voice messages
- Custom themes
- Mobile app (React Native)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is released under the MIT License.
This tool is designed to help free communication during critical times. Please:
- Use responsibly and legally
- Respect user privacy
- Avoid misuse
- Be aware of security requirements
For issues, questions, or feature requests:
- Create an Issue on GitHub
- Join discussions
Built for free communication

