Skip to content

Real Time Chat App Using Django, Channels, JavaScript and much more.

License

Notifications You must be signed in to change notification settings

Arvind-4/Chatapp

Repository files navigation

Chat App

pypi python versions license

Real Time Chat App Using Django, Channels, JavaScript, Docker, Tailwind CSS and much more..

🚀 Features:

  • Real-time messaging: The app allows users to send and receive messages in real-time, providing a seamless chatting experience.
  • Django and Channels: The app is built using the Django web framework and Channels, which extends Django to handle WebSockets and other asynchronous protocols.
  • JavaScript: The app uses JavaScript to provide a dynamic and interactive user interface.
  • Docker: The app can be containerised using Docker, making it easy to deploy and manage.
  • Tailwind CSS: The app uses Tailwind CSS, a utility-first CSS framework, to style the user interface.

Is there anything else you would like to know about this chat app?

📸 Screenshots:

Home Page
Chat Page

📦 Tech Stack:

  • WebSockets - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.
  • Django - Django makes it easier to build better web apps more quickly and with less code.
  • Django Channels - Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more.
  • Vite - Next Generation Frontend Tooling.
  • Tailwind 3 - Rapidly build modern websites without ever leaving your HTML.
  • Docker - Docker is a platform designed to help developers build, share, and run modern applications. We handle the tedious setup, so you can focus on the code.
  • Postgres DB - The World's Most Advanced Open Source Relational Database.

📦 Getting Started:

  1. Clone the project and make it your own.
mkdir ~/Dev
cd ~/Dev
git clone https://github.com/Arvind-4/Chatapp.git
cd Chatapp
  1. Create virtual environment and activate it.
python3.9 -m venv .
source bin/activate

Use .\venv\Scripts\activate if on Windows.

  1. Install requirements
$(Chatapp) python -m pip install pip --upgrade
$(Chatapp) python -m pip install -r requirements.txt
  1. Open VS Code
code .
  1. Create .env file:

Add Your Credentials .env from .env.sample:

PYTHON_VERSION=

DJANGO_PG_PASSWORD=iz-MAIesYif5c8d53pEnAg
DJANGO_PG_HOST=db
DJANGO_PG_USER=admin
DJANGO_PG_DATABASE=chatdb
DJANGO_PG_PORT=5432

DJANGO_REDIS_HOST=redis
DJANGO_REDIS_PORT=6379

DJANGO_SUPERUSER_EMAIL=
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_PASSWORD=-_cYnxeqvWQKhCUe_AJn8Q

DJANGO_SECRET_KEY=P_wXmuyfulz3qZTe3bAmRw5d0-9maJ5PIIVDMjMIm1gw
DJANGO_ADMIN_URL=admin/
DJANGO_DEBUG=1
DJANGO_ALLOWED_HOSTS=*
DJANGO_REDIS_AVAILABLE=0
DJANGO_HTTPS_SECURITY=0
DJANGO_LIVE=0

POSTGRES_PASSWORD=iz-MAIesYif5c8d53pEnAg
POSTGRES_USER=admin
POSTGRES_DB=chatdb

Replace your SECRET_KEY with a new one using the code Below.

python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'

Or

bash commands/secret.sh
  1. Build and Start the Docker File:

Below will start a Docker Instance on your local machine to match the .env from the previous step.

docker compose -f docker-compose.selfhost.yaml build

Start the Docker Build Image:

docker compose -f docker-compose.selfhost.yaml up
  1. Run Django Commands & Migrations and Create Superuser
cd ~/Dev/Chatapp
source bin/activate
$(Chatapp) python manage.py makemigrations
$(Chatapp) python manage.py migrate
$(Chatapp) python manage.py createsuperuser

Run the server:

$(Chatapp) python manage.py runserver
  1. Install & Build the Front end.

Install the Required Dependencies

npm run bootstrap

Build the Front end for Production

npm run production

🚀 Deploy:

Click the Button to Deploy to Render.

Deploy to Render

OR

Self Host using Docker, Docker Compose in a VM :)

🐛 Bug Reporting

Feel free to open an issue on GitHub if you find any bug.

⭐ Feature Request

  • Feel free to Open an issue on GitHub to request any additional features you might need for your use case.
  • Connect with me on LinkedIn. I'd love ❤️️ to hear from you.

📋 Change Log:

Check here for change logs.

📜 License

This software is open source, licensed under the MIT License.