Backend development is actively underway.
-
Real-time Communication
- One-to-One Chat (WebSocket)
- Group Chat (WebSocket)
- Real-time Notifications (WebSocket)
-
Authentication
- Custom WebSocket Authentication Middleware
- Google OAuth Integration
- JWT Authentication
-
Services
- Email Sending Service
- Email Link Verification
- Token Creation & Verification
- User Creation & Profile Updates
-
Routing
- Centralized routing for WebSocket consumers
- Video Calling (WebRTC)
- Audio Calling
- Frontend UI Implementation
1. Clone the repository
git clone https://github.com/your-username/ChatApp-with-Video-Calling.git
cd ChatApp-with-Video-Calling2. Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows3. Install dependencies
pip install -r requirements.txt4. Create local.ini configuration
Inside the config folder, create a file named local.ini and paste the following content:
[DEFAULT]
DEBUG_VALUE=True
SECRET_KEY=
ALLOWED_HOSTS=*
[DATABASE]
ENGINE=django.db.backends.postgresql
NAME=
USER=
PASSWORD=
HOST=localhost
PORT=5432
[EMAIL]
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD=
[THROTTLE]
USER_THROTTLE_LIMIT = 80/hour
ANON_THROTTLE_LIMIT = 20/hour
[JWT_TOKEN]
JWT_TOKEN_LIFETIME=1
JWT_REFRESH_TOKEN_LIFETIME=1
ROTATE_REFRESH_TOKEN=True
BLACKLIST_AFTER_ROTATION=True
[REDIS]
REDIS_HOST=localhost
REDIS_PORT=63795. Run migrations
python manage.py migrate6. Start Redis (for WebSocket channel layer)
redis-server7. Run the server
python manage.py runserverFor testing without the full frontend, you can use the included templates/test_chat.html file.
from django.urls import re_path
from chitchat.consumers import ChatConsumer, NotificationConsumer
websocket_urlpatterns = [
# One-to-one chat: uuid1_uuid2
re_path(r"ws/chat/(?P<room_name>[0-9a-f-]+_[0-9a-f-]+)/$", ChatConsumer.as_asgi()),
# Group chat: group_uuid
re_path(r"ws/chat/group_(?P<group_id>[0-9a-f-]+)/$", ChatConsumer.as_asgi()),
# Notification: user_uuid
re_path(
r"ws/notifications/user_(?P<user_id>[0-9a-f-]+)/$",
NotificationConsumer.as_asgi(),
),
]Example usage:
-
One-to-one chat:
ws://127.0.0.1:8000/ws/chat/<uuid1>_<uuid2>/ -
Group chat:
ws://127.0.0.1:8000/ws/chat/group_<group_uuid>/ -
Notifications:
ws://127.0.0.1:8000/ws/notifications/user_<user_uuid>/
1. Create a superuser and test accounts
python manage.py createsuperuser2. Start the Django server & login via the browser
Go to http://127.0.0.1:8000/admin/ and log in. Create at least two users and one group with members.
3. Open the test template Visit:
http://127.0.0.1:8000/test-chat/?room_name=<room_or_group_id>
4. Open two browser tabs
- Tab 1: Logged in as User A
- Tab 2: Logged in as User B
Type messages and watch them appear in real-time for both one-to-one and group chat.
This project is licensed under the MIT License.