A browser-based, end-to-end encrypted, real-time chat application built with Flask and WebSockets. All communication is handled in-memory without any database, ensuring privacy and fast performance.
- β¨ Animated Landing Page - Beautiful, engaging landing page with smooth animations
- π End-to-End Encryption - Messages are encrypted using Fernet symmetric encryption
- β‘ Real-Time Messaging - Instant message delivery using WebSocket technology
- π₯ Multi-User Support - Multiple users can chat simultaneously in rooms
- π¨ Emoji Avatars - Choose from 20+ emoji avatars to personalize your profile
- π Dark Mode - Toggle between light and dark themes for better usability
- β¨οΈ Typing Indicators - See when others are typing, just like WhatsApp/Telegram
- π Live User List - Real-time display of online users with total count
- π¬ System Messages - Automatic notifications when users join or leave
- π Room ID Sharing - Easy-to-copy room IDs for inviting others
- π± Responsive Design - Works seamlessly on desktop, tablet, and mobile devices
- Backend: Flask (Python)
- Real-Time Communication: Flask-SocketIO (WebSockets)
- Encryption: Cryptography (Fernet symmetric encryption)
- Frontend: HTML5, CSS3, JavaScript
- Storage: In-memory (no database required)
-
Clone or download this repository
-
Install Python dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open your browser and navigate to:
http://localhost:5000
You can deploy this app online for free using Render
-
Ensure you have these files in the root directory:
app.pyrequirements.txtProcfile
-
Example
requirements.txt:
flask
flask-socketio
cryptography
gunicorn
eventlet
- Example
Procfile:
web: gunicorn --worker-class eventlet -w 1 app:appgit init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/yourusername/Browser-based-chat-application.git
git push -u origin main- Go to render.com
- Sign up with GitHub and authorize access to your repo
-
Click New + β Web Service
-
Select your GitHub repo
-
Configure:
-
Environment: Python 3.x
-
Build Command:
pip install -r requirements.txt
-
Start Command:
gunicorn --worker-class eventlet -w 1 app:app
-
Instance Type: Free
-
-
Click Create/Deploy Web Service
- Render will give you a public URL like:
https://your-app-name.onrender.com
- Open it in your browser and start chatting π
You can also use the application on your mobile phone without deploying it online, as long as your phone and computer are connected to the same WiβFi network.
-
Find your systemβs local IP address
- On Windows:
Open Command Prompt and run:Look for theipconfig
IPv4 Address(e.g.,192.168.1.5). - On macOS/Linux:
Open Terminal and run:Look for theifconfig
inetaddress under your active network (e.g.,192.168.1.5).
- On Windows:
-
Run the Flask app
python app.py
-
Access from your mobile browser
- On your phone, open a browser and type:
Example:
http://<your-system-ip>:5000http://192.168.1.5:5000
- On your phone, open a browser and type:
-
Start chatting
- Youβll see the same landing page on your mobile.
- Create or join rooms and chat in real time, just like on desktop.
- Both devices must be on the same WiβFi network.
- This works only while the Flask server is running on your computer.
- No internet deployment is required β everything stays local.
You can try the application directly here:
π Encrypted Chat App on Render Click Here
1. Landing Page
- Click "Create a Room" on the landing page
- Enter your username
- Select an emoji avatar
- Click "Create Room & Enter Chat"
- Share the generated Room ID with others to invite them
- Click "Join a Chat" on the landing page
- Enter the Room ID provided by the room creator
- Enter your username
- Select an emoji avatar
- Click "Join Chat Room"
- Send Messages: Type your message and press Enter or click Send
- Copy Room ID: Click the π button to copy the room ID
- Toggle Dark Mode: Click the π/βοΈ button to switch themes
- Leave Chat: Click the πͺ button to return to the landing page
- End-to-End Encryption: All messages are encrypted using Fernet encryption before storage
- In-Memory Storage: No persistent database - data exists only during active sessions
- Room-Based Encryption: Each room has its own unique encryption key
- Secure Key Sharing: Encryption keys are shared securely with room members via WebSocket
- Rooms: Dictionary storing room data, users, messages, and encryption keys
- User Sessions: Dictionary mapping WebSocket sessions to user information
- Messages: Stored encrypted in memory (last 100 messages per room)
join_chat: User joins a chat roomsend_message: User sends a messagetyping: Typing indicator eventsnew_message: Broadcast new message to all room membersuser_joined: Notify when a user joinsuser_left: Notify when a user leavesuser_list_update: Update online user listuser_typing: Show/hide typing indicator
βββ app.py # Main Flask application with WebSocket handlers
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ templates/ # HTML templates
β βββ base.html # Base template
β βββ index.html # Landing page
β βββ create_room.html # Create room page
β βββ join_room.html # Join room page
β βββ chat.html # Chat room interface
βββ static/ # Static files
βββ css/
β βββ style.css # All styles including animations
βββ js/
βββ chat.js # Client-side JavaScript for chat functionality
- Message Limit: Only last 100 messages stored per room
- Message History: Only last 50 messages sent to new users
- Efficient WebSocket: Event-driven architecture for low latency
- Client-Side Rendering: Smooth UI updates without page refreshes
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Opera (latest)
- No Persistent Storage: All data is lost when the server restarts
- No User Authentication: Users can use any username
- Single Server: Not designed for horizontal scaling
- Memory Based: Limited by available server memory
- File sharing support
- Message reactions
- User profiles
- Message search
- Persistent storage option
- Multi-server support
- Voice/video chat integration
This project is open source and available for educational and personal use.
Feel free to fork this project and submit pull requests for any improvements!
For issues or questions, please open an issue on the repository.
Note: This application is designed for demonstration and educational purposes. For production use, additional security measures, authentication, and persistence layers should be implemented.



