A full-stack realtime messaging application built with React (Material UI) on the frontend and Flask (Socket.IO) on the backend, featuring LLM-based message encryption.
β¨ Real-time messaging with WebSocket (Socket.IO)
π₯ User presence - See who's online
β¨οΈ Typing indicators - Know when someone is typing
οΏ½ LLM Encryption - Encode messages with custom prompts and models
π Decrypt on demand - Right-click messages to decrypt with prompt/model
οΏ½π¬ Modern UI - Built with Material UI components
π¨ User avatars - Color-coded avatars with initials
π± Responsive design - Works on desktop and mobile
π System notifications - User join/leave messages
π Message history - Load recent messages on join
π Encrypted message indicators - Visual badges for LLM-encoded messages
FlaskChatWithLLMEncryption/
βββ backend/
β βββ app.py # Flask server with Socket.IO
β βββ requirements.txt # Python dependencies
βββ frontend/
β βββ public/
β β βββ index.html
β βββ src/
β β βββ components/
β β β βββ ChatContainer.js # Main chat layout
β β β βββ ConnectionStatus.js # Connection indicator
β β β βββ LoginDialog.js # User login modal
β β β βββ MessageInput.js # Message input field
β β β βββ MessageList.js # Messages display
β β β βββ UserList.js # Online users sidebar
β β βββ App.js # Main React component
β β βββ index.js # React entry point
β βββ package.json # Node dependencies
βββ README.md
cd backend
python -m venv venv
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
pip install -r requirements.txt
python app.py
The backend server will start on http://localhost:5000
cd frontend
npm install
npm start
The frontend will start on http://localhost:3000
http://localhost:3000Open multiple browser windows/tabs to test the real-time functionality.
join - User joins the chat with usernamesend_message - Send a message (with optional LLM encryption metadata)typing - User typing statusdisconnect - User leavesconnection_response - Connection confirmationload_messages - Initial message historynew_message - New message broadcast (includes LLM metadata)user_joined - User joined notificationuser_left - User left notificationuser_typing - Typing indicator update{
"id": "unique-message-id",
"user_id": "user-id",
"username": "John Doe",
"text": "Message content",
"timestamp": "2025-11-08T10:30:00",
"llmEncoded": true,
"prompt": "encryption-prompt",
"modelName": "gpt-4"
}
Messages are instantly broadcast to all connected users using Socket.IO's WebSocket connection.
The app tracks and displays all online users in the sidebar. When users join or leave, all connected clients are notified.
When a user types, other users see a "typing..." indicator that disappears after 1 second of inactivity.
Users can enable LLM Encoding mode to send encrypted messages:
Messages sent with LLM encoding are marked with a π lock icon and orange border.
To decrypt an LLM-encoded message:
Note: Currently, decryption returns the original message as-is. Full LLM integration coming soon!
New users receive the last 50 messages when they join the chat.
The UI adapts to different screen sizes using Material UI's responsive components.
To change the backend port or add authentication, modify backend/app.py.
http://localhost:5000To change the backend URL, modify the SOCKET_URL constant in frontend/src/App.js.
The Flask server runs in debug mode by default. Changes to app.py will automatically reload the server.
React's development server supports hot reloading. Changes to components will update automatically.
MIT License - feel free to use this project for learning or commercial purposes.
A full-stack realtime messaging application built with React (Material UI) on the frontend and Flask (Socket.IO) on the backend, featuring LLM-based message encryption.
β¨ Real-time messaging with WebSocket (Socket.IO)
π₯ User presence - See who's online
β¨οΈ Typing indicators - Know when someone is typing
οΏ½ LLM Encryption - Encode messages with custom prompts and models
π Decrypt on demand - Right-click messages to decrypt with prompt/model
οΏ½π¬ Modern UI - Built with Material UI components
π¨ User avatars - Color-coded avatars with initials
π± Responsive design - Works on desktop and mobile
π System notifications - User join/leave messages
π Message history - Load recent messages on join
π Encrypted message indicators - Visual badges for LLM-encoded messages
FlaskChatWithLLMEncryption/
βββ backend/
β βββ app.py # Flask server with Socket.IO
β βββ requirements.txt # Python dependencies
βββ frontend/
β βββ public/
β β βββ index.html
β βββ src/
β β βββ components/
β β β βββ ChatContainer.js # Main chat layout
β β β βββ ConnectionStatus.js # Connection indicator
β β β βββ LoginDialog.js # User login modal
β β β βββ MessageInput.js # Message input field
β β β βββ MessageList.js # Messages display
β β β βββ UserList.js # Online users sidebar
β β βββ App.js # Main React component
β β βββ index.js # React entry point
β βββ package.json # Node dependencies
βββ README.md
cd backend
python -m venv venv
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
pip install -r requirements.txt
python app.py
The backend server will start on http://localhost:5000
cd frontend
npm install
npm start
The frontend will start on http://localhost:3000
http://localhost:3000Open multiple browser windows/tabs to test the real-time functionality.
join - User joins the chat with usernamesend_message - Send a message (with optional LLM encryption metadata)typing - User typing statusdisconnect - User leavesconnection_response - Connection confirmationload_messages - Initial message historynew_message - New message broadcast (includes LLM metadata)user_joined - User joined notificationuser_left - User left notificationuser_typing - Typing indicator update{
"id": "unique-message-id",
"user_id": "user-id",
"username": "John Doe",
"text": "Message content",
"timestamp": "2025-11-08T10:30:00",
"llmEncoded": true,
"prompt": "encryption-prompt",
"modelName": "gpt-4"
}
Messages are instantly broadcast to all connected users using Socket.IO's WebSocket connection.
The app tracks and displays all online users in the sidebar. When users join or leave, all connected clients are notified.
When a user types, other users see a "typing..." indicator that disappears after 1 second of inactivity.
Users can enable LLM Encoding mode to send encrypted messages:
Messages sent with LLM encoding are marked with a π lock icon and orange border.
To decrypt an LLM-encoded message:
Note: Currently, decryption returns the original message as-is. Full LLM integration coming soon!
New users receive the last 50 messages when they join the chat.
The UI adapts to different screen sizes using Material UI's responsive components.
To change the backend port or add authentication, modify backend/app.py.
http://localhost:5000To change the backend URL, modify the SOCKET_URL constant in frontend/src/App.js.
The Flask server runs in debug mode by default. Changes to app.py will automatically reload the server.
React's development server supports hot reloading. Changes to components will update automatically.
MIT License - feel free to use this project for learning or commercial purposes.