Welcome to the Chat Project! This project is a simple chat application that allows users to communicate in real-time.
- Real-time messaging
- User authentication
- Private and group chats
- Message history
- WebSocket support for live updates
- REST API for message retrieval and persistence
-
Clone the repository:
git clone https://github.com/ahmed-n-abdeltwab/chat.git
-
Navigate to the project directory:
cd chat
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Start the server:
npm start
-
Open your browser and navigate to
http://localhost:3000
.
- Enter your username in the input field.
- Type your message in the message input field.
- Click the "Send" button or press "Enter" to send the message.
- The message history is automatically loaded when you open the chat application.
- Retrieves all messages from the database.
-
Saves a new message to the database.
-
Request body should contain:
{ "username": "your_username", "text": "your_message" }
-
The application uses WebSocket for real-time messaging.
-
The WebSocket server is integrated with the HTTP server and listens on the same port.
The following scripts are available:
start
: Runs the compiled server.dev
: Starts the server with TypeScript support and restarts on changes.build
: Compiles the TypeScript code.lint
: Lints the TypeScript files.lint:fix
: Lints and fixes the TypeScript files.format
: Formats the code using Prettier.format:check
: Checks the code formatting using Prettier.test
: Runs the tests using Jest.
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.
For any inquiries, please contact Ahmed N. Abdeltwab.