This is a real-time chat application built using FastAPI for the backend and React for the frontend. It allows users to join a chat room with a username, send and receive messages in real-time, and see notifications when users join or leave the chat.
- Real-time messaging using WebSocket
- User joins with a username and receives a unique ID
- Notifications when users join or leave the chat
- Simple and responsive UI built with React
- Persistent chat messages and username using localStorage (Note: This feature is not implemented yet)
- Button to disconnect from the chat
- Python 3.7+
- Node.js 12+
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install requirements.txt
-
Install necessary packages:
npm install
-
Start the FastAPI backend server:
uvicorn main:app --reload
-
Start the React frontend server:
npm start
-
Open your browser and navigate to
http://localhost:3000
. -
Enter your username and join the chat.
-
Send and receive messages in real-time.
- Implement feature to persist chat messages and username using localStorage.
- Add notifications when a user joins or leaves the chat.
- Improve UI design to be more colorful and use the full window size.
- Display additional information like the number of members in the chat room.
- Implement a feature to disconnect from the chat when the window is closed or refreshed.