An open API service indexing awesome lists of open source software.

https://github.com/ahmadyousif89/linkup

A realtime chat application | Alx graduation project
https://github.com/ahmadyousif89/linkup

expressjs mongodb reactjs redis socket-io tailwindcss

Last synced: 8 months ago
JSON representation

A realtime chat application | Alx graduation project

Awesome Lists containing this project

README

          

# LinkUp Realtime Chat Application

![hero image](/assets/hero.png)

LinkUp is a real-time chat application that allows users to create chat rooms and communicate with others in real-time. Users can create accounts, log in, create and join chat groups, and share messages and media. The application is built using **MongoDB**, **Express**, **React**, **Node.js**, and **Socket.io**.

### Authors

**Malik Hussein**
[![LinkedIn](https://img.icons8.com/color/16/000000/linkedin-circled.png)](https://www.linkedin.com/in/malikhussein/)
[![GitHub](https://img.icons8.com/color/16/000000/github.png)](https://github.com/Medjai229)

****Mohamed Marzouk****
[![LinkedIn](https://img.icons8.com/color/16/000000/linkedin-circled.png)](https://www.linkedin.com/in/mohamed-marzouk-38aa75286/)
[![GitHub](https://img.icons8.com/color/16/000000/github.png)](https://github.com/MMarzoo)

**Mahmoud Mohey Eldin**
[![LinkedIn](https://img.icons8.com/color/16/000000/linkedin-circled.png)](https://www.linkedin.com/in/moodyeg/)
[![GitHub](https://img.icons8.com/color/16/000000/github.png)](https://github.com/MoodyEG)

**Ahmad Yousif**
[![LinkedIn](https://img.icons8.com/color/16/000000/linkedin-circled.png)](https://www.linkedin.com/in/dev-ahmadyousif/)
[![GitHub](https://img.icons8.com/color/16/000000/github.png)](https://github.com/AhmadYousif89)

## The presentation

[**LinkUp Presentation**](https://docs.google.com/presentation/d/1TitFRNG5WmF0RtF-CoTW61k3OW5bwW5Pr2SIBrvStHY/edit?usp=sharing)

## Video Demo

[**LinkUp Demo**](https://drive.google.com/file/d/1ab143Nn5-YL-07s-GyXRnoaYx0rVUnb6/view?usp=sharing)

## Features

- **User Authentication**: Create an account with email/password or social login.
- **Real-time Messaging**: Chat with friends in real-time using WebSockets.
- **Chat Groups**: Create and join chat rooms to communicate with groups.
- **Responsive Design**: Optimized for both desktop and mobile devices.

## Installation

### Prerequisites

Ensure that you have the following installed on your local machine:

- [Node.js](https://nodejs.org/) (v12.x or above)
- [MongoDB](https://www.mongodb.com/) (set up a local or cloud MongoDB instance)

### Steps to Run Locally

1. Clone the repository:

```bash
git clone https://github.com/AhmadYousif89/linkup.git
cd linkup
```

2. Install dependencies:

```bash
npm install
```

3. Set up environment variables:

Create a `.env` file in backend directory and add the following variables:

```plaintext
PORT=5000
MONGO_URI=mongodb://localhost:27017/linkup
JWT_SECRET=
```

Create a `.env` file in client directory and add the following variables:

```plaintext
VITE_CLERK_PUBLISHABLE_KEY=
VITE_SERVER_API=http://localhost:5000/api
```

4. Start the application:

Start the backend server from backend directory:

```bash
npm start
```

Start the frontend server from client directory:

```bash
npm run dev
```

5. Navigate to `http://localhost:5173` in your browser to start using the application.

## Future Features

- **Friend System**: Add friends and see their online status.
- **Multi-media Files Sharing**: Share images, videos, and other files.
- **Voice Calling**: Make voice calls with friends in real-time.
- **Video Calling**: Make video calls with friends in real-time.
- **Screen Sharing**: Share your screen with friends in real-time.
- **Push Notifications**: Get notified when friends send new messages.
- **Dark Mode**: Switch to a dark theme for better readability.

## Technologies

This project leverages modern technologies to deliver real-time communication:

- **Frontend**: [React](https://reactjs.org/) with state management and dynamic UI.
- **Styling**: [Tailwind CSS](https://tailwindcss.com/) for responsive and modern UI design.
- **Backend**: [Node.js](https://nodejs.org/) + [Express](https://expressjs.com/) for RESTful APIs and routing.
- **Database**: [MongoDB](https://www.mongodb.com/) for storing user data, chats, and rooms.
- **Real-time Communication**: [Socket.io](https://socket.io/) for WebSocket-based real-time messaging.
- **Security**: [JWT](https://jwt.io/) + [Clerk](https://clerk.dev/) for secure authentication and authorization.
- **Testing**: [Postman](https://www.postman.com/) for API testing

## Usage

1. **Sign up/Login**: Create an account or log in with existing credentials.
2. **Create/Join Chat Groups**: Create a new chat groups or join an existing one.
3. **Send Messages**: Chat in real-time with friends or group members. Share images, files, and other media.

## API Documentation

- **User Endpoints**:

1. `POST /api/user/clerk`

**Function**: Sign-up or Sign-in a user with clerk.

**Request Body**: { id, email, fullName, image }

2. `GET /api/user?search=Joe`

**Function**: Search for user using query

**Request Query**: { query.search }

- **Chat Endpoints**:

1. `POST /api/chat/`

**Function**: Views chat with a certain user, requires userId.

**Request Body**: { userId }

2. `GET /api/chat/`

**Function**: Search for private chats for the user.

3. `GET /api/chat/group`

**Function**: Search for group chats for the user.

4. `POST /api/chat/group`

**Function**: Create a new group chat, requires name of the group and user IDs (minimum 3 including the current user).

**Request Body**: { users, name }

5. `PUT /api/chat/rename`

**Function**: Rename group chat, requires chatId and chatName.

**Request Body**: { chatId, chatName }

6. `PUT /api/chat/groupadd`

**Function**: Add a user to the group, requires chatId and userId (must be in the group).

**Request Body**: { chatId, userId }

7. `PUT /api/chat/groupremove`

**Function**: Remove a user from the group, requires chatId, userId, and must be groupAdmin.

**Request Body**: { chatId, userId }

8. `DELETE /api/chat/groupdelete`

**Function**: Delete a group, requires chatId and must be groupAdmin.

**Request Body**: { chatId }

9. `PUT /api/chat/groupquit`

**Function**: Quit a group, requires chatId.

**Request Body**: { chatId }

10. `PUT /api/chat/close`

**Function**: Close a chat for a certain user, requires chatId.

**Request Body**: { chatId }

- **Message Endpoints**:

1. `POST /api/message/`

**Function**: Send a message to a user, requires content and chatId.

**Request Body**: { content, chatId }

2. `GET /api/message/:chatId`

**Function**:Get all messages in a chat, requires chatId.

**Request Param**: { chatId }

## Contributing

Contributions are welcome! Here's how you can get involved:

1. Fork the repository.
2. Create a new feature branch (`git checkout -b feature/your-feature`).
3. Commit your changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature/your-feature`).
5. Open a pull request.

Please make sure your code follows the project's [code style guidelines](#).

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.