A modern, secure, and intuitive real-time chat application built with React, TypeScript, Socket.io, Express, and MongoDB.
- Project Overview
- Features
- Project Structure
- Technologies Used
- Getting Started
- Environment Variables
- API Documentation
- Contributing
- License
Connectt is a feature-rich chat application that enables real-time communication between users. It provides a smooth user experience with message delivery notifications, online status indicators, and secure end-to-end message delivery.
- Real-time messaging using Socket.io
- User authentication and authorization
- Online/offline status indicators
- Message read receipts
- Responsive design for mobile and desktop
- Secure password storage with bcrypt
- JWT-based authentication
- Message history management
backend/
├── src/
│ ├── config/ # Configuration files
│ ├── controllers/ # Request handlers
│ ├── middleware/ # Express middleware
│ ├── models/ # Mongoose models
│ ├── routes/ # API routes
│ ├── services/ # Business logic
│ ├── socket/ # Socket.io implementation
│ ├── types/ # TypeScript type definitions
│ ├── utils/ # Utility functions
│ └── app.ts # Express app setup
├── .env # Environment variables
├── package.json # Project dependencies
└── tsconfig.json # TypeScript configuration
realtime-chat-frontend/
├── public/ # Static files
├── src/
│ ├── assets/ # Images, fonts, etc.
│ ├── components/ # Reusable UI components
│ ├── contexts/ # React contexts
│ ├── hooks/ # Custom React hooks
│ ├── pages/ # Page components
│ ├── services/ # API service functions
│ ├── store/ # Zustand state management
│ ├── types/ # TypeScript type definitions
│ ├── utils/ # Utility functions
│ ├── App.tsx # Main application component
│ └── index.tsx # Application entry point
├── .env # Environment variables
├── package.json # Project dependencies
└── tsconfig.json # TypeScript configuration
- Node.js
- Express.js
- TypeScript
- Socket.io
- MongoDB (Mongoose)
- JWT authentication
- bcrypt
- React
- TypeScript
- Material UI
- Socket.io-client
- Axios
- Zustand (State management)
- React Router
- Node.js (v16 or higher)
- npm or yarn
- MongoDB (local instance or MongoDB Atlas account)
- Clone the repository
git clone https://github.com/yourusername/realtime-chat.git
cd realtime-chat- Install backend dependencies
cd backend
npm install- Install frontend dependencies
cd ../realtime-chat-frontend
npm install- Start the backend server by opening 2 terminals
npx tsc -wcd backend
npm run dev- Start the frontend development server
cd ../realtime-chat-frontend
npm run dev- Access the application in your browser at
http://localhost:3000
PORT=5000
MONGODB_URI=mongodb://localhost:27017/connectt
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRY=24h
NODE_ENV=development
CORS_ORIGIN=http://localhost:3000
REACT_APP_API_URL=http://localhost:5000
REACT_APP_SOCKET_URL=http://localhost:5000
POST /api/v1/auth/register- Register a new userPOST /api/v1/auth/login- Login a userGET /api/v1/auth/profile- Get current user profileGET /api/v1/auth/logout- Logout the user
POST /api/v1/chat/load-users- Get messages for a chatPOST /api/v1/chat/get-messages- Send a new messagePOST /api/v1/chat/get-current-message- Mark message as read
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
