This is a simple chat application that allows users to log in using predefined credentials and chat with other contacts in the application. The application supports real-time messaging and features a contact list, chat window, and message display.
- User login using predefined credentials.
- Dynamic contact list that excludes the logged-in user.
- Real-time chat functionality.
- Persistent user session using
localStorage.
Before starting, ensure you have the following installed:
- Node.js (>= 14.x)
- npm (Node Package Manager)
-
Clone the Repository
git clone <repository-url> cd <repository-directory>
-
Install Dependencies
npm install
-
Start the Development Server
npm start
The application will be available at http://localhost:3000 by default.
-
Use one of the predefined credentials to log in.
Contact ID Name Password 9009009001 Alice 1234 9009009002 Bob 1234 9009009003 Charlie 1234 9009009004 Chris 1234 -
Enter the
Contact IDandPasswordto log in. -
Upon successful login, the contact list will exclude the logged-in user.
-
Click on any contact in the list to open the chat window.
-
The chat window will display messages exchanged with the selected contact.
-
Type your message in the input box and send it.
-
Messages will appear in the chat window.
.
├── src
│ ├── components
│ │ ├── ContactList.jsx # Contact list UI
│ │ ├── ChatWindow.jsx # Chat window UI
│ │ ├── MessageInput.jsx # Input feild UI
│ │ ├── Message.jsx # Message UI component
│ ├── context
│ │ └── AppContext.jsx # Global state management
│ ├── hooks
│ │ └── useAuth.js # Custom hooks for Authentication
│ │ └── useCheckAuth.js # Custom hooks for checking Authentication
| │ └── useInstantDB.js # Custom hooks for database interactions
│ ├── styles
│ │ ├── ContactList.css # Contact list styles
│ │ ├── ChatWindow.css # Chat window styles
│ │ ├── MessageInput.css # MessageInput styles
│ │ ├── Message.css # Message styles
│ └── App.js # Main application entry point
│ └── App.css # global styles
├── package.json # Dependency and script management
└── README.md # Project documentation
- Inhanced authentication/Authorization .
- Add Registeration page .
- Implement Create new Contacts.
- Enhance UI/UX for a modern chat experience.
- Use IndexedDB to store the data locally for offline capabilities.
-
Application Doesn't Start
- Ensure Node.js and npm are installed.
- Check for errors during
npm install.
-
Invalid Credentials
- Use one of the predefined credentials with the correct password (
1234).
- Use one of the predefined credentials with the correct password (
-
Messages Not Displaying
- Ensure the
selectedContactis set when clicking a contact. - Check the
useMessageshook for errors.
- Ensure the
This project is licensed under the MIT License.