A real-time chat application built with Django (backend) and React (frontend), featuring WebRTC peer-to-peer communication, JWT authentication, and WebSocket integration.
- User Authentication: Secure registration and login using JWT tokens stored in HttpOnly cookies.
- Room Management: Create, join, and manage chat rooms with proper access control.
- Live Updates: Real-time messaging powered by WebSocket integration.
- **Modern React-based interface with a mobile-friendly design.
- Django, Django REST Framework, Django Channels
- WebSocket support
- JWT Authentication
- APIs for room management
- React, Axios
- Registration & login forms
- Chat interface
- WebSocket client
chat-app/
├── backend/
│ ├── temp_chat/
│ ├── requirements.txt
│ ├── manage.py
│ ├── utils/
│ └── apps/
├── chat/
│ └── users/
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── services/
│ │ └── utils/
│ └── package.json
└── README.md
- Python 3.8+
- Node.js 14+
- npm or yarn
-
Clone the repository
git clone "https://github.com/Jasir-p/temp-chat/" cd chat-app/backend
-
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Setup database
python manage.py makemigrations python manage.py migrate
-
Create superuser (optional)
python manage.py createsuperuser
-
Start Django server
python manage.py runserver
-
Navigate to frontend directory
cd ../frontend -
Install dependencies
npm install
-
Start React development server
npm start
The application will be available at:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:8000
cd backend
pytest .\apps\users\test
pytest .\apps\chat\testcd frontend
npm run testCreate .env files in both backend and frontend directories:
SECRET_KEY=your-secret-key
DEBUG=True
REDIS_URL=redis://localhost:6379
ALLOWED_HOSTS="*"
CORS_ALLOWED_ORIGINS="http://localhost:8000"
DB_ENGINE="your-db-engine-postgres-recommended"
DB_NAME="your-db-name"
DB_USER="your-db-user"
DB_PASSWORD="your-db-password"
DB_HOST="your-db-host-or-default-localhost"
DB_PORT="your-db-port-or-default-5432"
VITE_API_URL=http://localhost:8000
VITE_WS_URL=ws://localhost:8000
- Set
DEBUG=Falsein Django settings - Configure PostgreSQL/MySQL database
- Set up Redis for WebSocket support
- Build React app:
npm run build - Configure web server (Nginx + Daphne)
- Register: Create a new account
- Login: Authenticate with your credentials
- Create Room: Start a new chat room
- Join Room: Enter an existing room
- Chat: Send real-time messages
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Open an issue on GitHub
- Contact:jazjasir7@gmailcom
- Django & Django Channels for backend framework
- React for frontend library
- WebSocket for real-time communication