This repository contains the codebase for a Peer-to-Peer (P2P) TCP Chat application. It consists of a frontend built with Angular and a backend implemented using Ktor, a Kotlin-based framework. The application facilitates real-time messaging between users over a TCP connection, allowing them to chat directly with each other.
-
User Management:
- Sign up and sign in functionality.
- User authentication and authorization (Future development plan: JWT integration).
-
Real-time Messaging:
- P2P messaging via TCP connection.
- Message status tracking (not sent, sent, received, read).
-
WebSocket Integration:
- Real-time updates and notifications using WebSocket for message delivery status (Future development plan: WebSocket enhancement to handle unread messages).
-
Chat Management:
- Creation of new chats between users.
- Listing and retrieving existing chats.
-
Frontend:
- Angular
- TypeScript
- WebSocket for real-time updates
-
Backend:
- Ktor (Kotlin-based framework for building asynchronous servers)
- MongoDB (NoSQL database for storing user data and chat history)
/frontend: Contains Angular frontend code./backend: Contains Ktor backend code./dbMongoConnection: MongoDB connection handling./handling: Business logic for user handling, chat handling, and WebSocket management./models: Data models used across the application./routing: Routing definitions for API endpoints and WebSocket connections.
- JWT Authentication: Implement JSON Web Token (JWT) for secure user authentication and authorization.
- Unread Message Tracking: Enhance WebSocket functionality to handle unread message notifications.
- User Interface Improvements: Enhance frontend UI/UX for better user experience.
- Performance Optimization: Optimize database queries and WebSocket handling for improved performance.
To run the application locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your/repository.git](https://github.com/efraimG21/P2P-Tcp-chat cd P2P-Tcp-chat -
Set up MongoDB:
- Install MongoDB locally or use a cloud service.
- Update MongoDB connection details in
dbMongoConnection/MongoDBConnection.kt.
-
Run Backend (Ktor):
- Navigate to
/backenddirectory. - Build and run the backend server:
./gradlew run
- Navigate to
-
Run Frontend (Angular):
- Navigate to
/frontenddirectory. - Install dependencies and start the Angular development server:
npm install npm start
- Navigate to
-
Access the Application:
- Open your web browser and go to
http://localhost:4200to access the application frontend.
- Open your web browser and go to
Contributions to this project are welcome! Please fork the repository and create a pull request with your suggested changes. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or feedback regarding this project, please contact me.