Chat Web server is a simple Flask web application for real-time chat. It allows users to sign up, log in, and send messages in a chat room. Messages are persisted using either JSON file or MongoDB, making it easy to choose the storage method that suits your needs.
-
User Signup: New users can create an account by providing their email, username, and password.
-
User Login: Registered users can log in using their username or email along with the password.
-
Real-time Chat: Users can send and receive messages in real-time within the chat room.
-
Message Deletion: Users can delete their own messages, and the chat updates instantly for all participants.
-
XSS Protection: The application is protected against Cross-Site Scripting (XSS) attacks using custom escape functions.
- Python 3.x
- Flask
- MongoDB or JSON File
-
Clone the repository:
git clone https://github.com/ishanoshada/Chat-Web-Server.git
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up MongoDB (optional):
- If you prefer to use MongoDB as the message storage method, make sure you have MongoDB installed and running on your machine. Update the
MONGODB_URI
variable in theapp.py
file with your MongoDB connection string.
- If you prefer to use MongoDB as the message storage method, make sure you have MongoDB installed and running on your machine. Update the
-
Run the Flask app:
python app.py
-
Open your web browser and navigate to
http:https://127.0.0.1:5000/
to access the chat app. -
Sign up or log in to start using the chat room.
Chat-Web-server/
│
├── app.py
├── templates/
│ ├── index.html
│ ├── login.html
│ ├── signup.html
│ └── navbar.html
│
├── data/
│ ├── user_data.json
│ └── chats.json
│
├── requirements.txt
├── README.md
└── .gitignore
Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
- Thanks to the Flask and MongoDB communities for providing excellent resources and documentation.
- Inspiration for this project came from the need for a simple and secure real-time chat application.
This project is licensed under the MIT License - see the LICENSE file for details.
OneOne is impressive 🚀 Give it a ⭐️ if you liked it! Thanks for stopping by! For more projects, visit GitHub Profile.