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.
- 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.
- Installation & Setup
- Running the Application
- Implementation Details
- Contributing
- Troubleshooting
- License
- Node.js v16
- TypeORM (version 0.2.37 is used in this project)
- MySQL Server (or any SQL database supported by TypeORM)
-
Clone the repository:
git clone https://github.com/orgball2608/NestChatApp.git cd NestChatApp
-
Install the dependencies:
- First, install TypeORM version 0.3.0 to resolve the conflict:
npm install [email protected]
- Then, install all the other dependencies:
npm install
- Finally, revert TypeORM to version 0.2.37:
npm install [email protected]
- First, install TypeORM version 0.3.0 to resolve the conflict:
-
Create a
.env.development
file in the root directory and paste the following:PORT=<your_port> MYSQL_DB_HOST=<your_mysql_host> MYSQL_DB_USERNAME=<your_mysql_username> MYSQL_DB_PASSWORD=<your_mysql_password> MYSQL_DB_PORT=<your_mysql_port> MYSQL_DB_DATABASE=<your_mysql_database> SESSION_SECRET=<your_session_secret> COOKIE_SECRET=<your_cookie_secret> AWS_ACCESS_KEY_ID=<your_aws_access_key_id> AWS_SECRET_ACCESS_KEY=<your_aws_secret_access_key> AWS_PUBLIC_BUCKET_KEY=<your_aws_public_bucket_key> AWS_REGION=<your_aws_region>
-
Start the application in development mode:
npm run start:dev
To run the application locally, you will need Docker and docker-compose.
-
Run using npm:
npm run start:dev
-
Run using Docker:
docker-compose up
.
├── src
│ ├── attachments
│ ├── auth
│ ├── conversations
│ ├── friend-requests
│ ├── friends
│ ├── gateway
│ ├── groups
│ ├── messages
│ ├── reacts
│ ├── storage
│ ├── users
│ ├── utils
│ ├── app.module.ts
│ └── main.ts
└── test
- 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.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
- 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.
This project is licensed under the UNLICENSED License. See the LICENSE file for details.