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

https://github.com/orgball2608/nestchatapp

Realtime Chat App (Nestjs, TypeOrm, MySQL,WebSocket, Docker)
https://github.com/orgball2608/nestchatapp

amazon-s3 ci docker docker-compose emit-events multer mysql-database nestjs nodejs renovate typeorm typescript websocket

Last synced: 3 months ago
JSON representation

Realtime Chat App (Nestjs, TypeOrm, MySQL,WebSocket, Docker)

Awesome Lists containing this project

README

          

# NestChatApp

## Overview
NestChatApp is a real-time chat application built using NestJS, TypeORM, MySQL, WebSocket, and Docker. This project aims to provide a scalable and efficient server-side application for real-time communication.

## Features
- **Real-time communication** using WebSocket (Socket.io) and Event emitters.
- **REST API** for handling various endpoints.
- **MySQL** as the main database.
- **TypeORM** for object-relational mapping.
- **AWS S3** for image uploads.
- **Docker** for containerization and easy deployment.
- **Session-based authentication** for secure user management.

## Table of Contents
1. [Installation & Setup](#installation-setup)
2. [Running the Application](#running-the-application)
3. [Implementation Details](#implementation-details)
4. [Contributing](#contributing)
5. [Troubleshooting](#troubleshooting)
6. [License](#license)

## Installation & Setup

### Pre-requisites
- Node.js v16
- TypeORM (version 0.2.37 is used in this project)
- MySQL Server (or any SQL database supported by TypeORM)

### Setting up the Backend
1. **Clone the repository**:
```bash
git clone https://github.com/orgball2608/NestChatApp.git
cd NestChatApp
```

2. **Install the dependencies**:
- Then, install all the other dependencies:
```bash
npm install
```

3. **Create a `.env.development` file** in the root directory and paste the following:
```plaintext
PORT=
MYSQL_DB_HOST=
MYSQL_DB_USERNAME=
MYSQL_DB_PASSWORD=
MYSQL_DB_PORT=
MYSQL_DB_DATABASE=
SESSION_SECRET=
COOKIE_SECRET=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_PUBLIC_BUCKET_KEY=
AWS_REGION=
```

4. **Start the application in development mode**:
```bash
npm run start:dev
```

## Running the Application

### Local Run
To run the application locally, you will need Docker and docker-compose.

1. **Run using npm**:
```bash
npm run start:dev
```

2. **Run using Docker**:
```bash
docker-compose up
```

## Implementation Details

### Project Structure
```plaintext
.
├── src
│ ├── attachments
│ ├── auth
│ ├── conversations
│ ├── friend-requests
│ ├── friends
│ ├── gateway
│ ├── groups
│ ├── messages
│ ├── reacts
│ ├── storage
│ ├── users
│ ├── utils
│ ├── app.module.ts
│ └── main.ts
└── test
```

### Key Components
- **REST API**: Handles API requests and responses.
- **WebSocket**: Manages real-time communication.
- **MySQL**: Database for storing application data.
- **TypeORM**: Maps TypeScript objects to database tables.
- **AWS S3**: Manages image uploads and storage.
- **Docker**: Containerizes the application for easy deployment.

## Contributing
Contributions are welcome! Please follow these steps to contribute:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit your changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Open a pull request.

## Troubleshooting
- Ensure all environment variables are correctly set.
- Verify the MySQL server is running and accessible.
- Check Docker and docker-compose installations.
- For any issues, please open a GitHub issue.

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