ZeenChat is a secure, real-time chat application built with Django and WebSockets. It features message encryption, real-time messaging capabilities, and a clean, responsive UI built with Tailwind CSS.
- π Message encryption using Fernet
- π¬ Real-time messaging using WebSockets
- π₯ User authentication and authorization
- π¨ Modern, responsive UI with Tailwind CSS
- π Easy to deploy and scale
- π± Mobile-friendly design
- β‘ Rate liGPLing and security features
- Backend: Django 5.1
- WebSockets: Django Channels
- Database: SQLite (default), compatible with PostgreSQL
- Frontend: HTML, JavaScript, Tailwind CSS
- Message Queue: Redis
- Encryption: cryptography.fernet
- Python 3.8 or higher
- Redis Server
- Git
git clone https://github.com/frzn23/zeenchat.git
cd zeenchatpython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txt- Download Redis for Windows from Redis Downloads
- Install and start the Redis service
redis-serversudo apt update
sudo apt install redis-server
sudo systemctl start redis-serverbrew install redis
brew services start redisWe will be setting up a PostgreSQL database using Docker and Docker Compose. If you already have PostgreSQL installed on your system, feel free to skip to the Manual Setup section below.
-
Install Docker Follow the official instructions to install Docker for your OS: Install Docker
-
Install Docker Compose Docker Desktop includes Docker Compose by default. If not, install it separately: Install Docker Compose
-
Start the PostgreSQL container
Run the following command from the project root:
docker-compose -f docker-compose.yml up
If you prefer not to use Docker, you can install and configure PostgreSQL directly on your system. Follow the steps based on your operating system:
Install PostgreSQL
Download and install PostgreSQL from the official site: https://www.postgresql.org/download/
Follow the platform-specific instructions for your OS.
-
Switch to the
postgresuser:sudo -u postgres -i
-
Launch the PostgreSQL shell:
psql
-
Create the database and user:
Run the following SQL commands inside the
psqlshell:CREATE DATABASE zeenchat; CREATE USER dev WITH ENCRYPTED PASSWORD 'devpass'; GRANT ALL PRIVILEGES ON DATABASE zeenchat TO dev;
-
Exit
psql:\q
-
Exit the
postgresuser shell:exit
-
Install PostgreSQL from the official installer.
- During installation, set a password for the default
postgresuser. - Install additional tools like pgAdmin and psql CLI.
- During installation, set a password for the default
-
Open
psqlShell:- From Start Menu β PostgreSQL β SQL Shell (psql) OR
- Use Command Prompt (ensure
psql.exeis in your PATH).
-
Login as the
postgresuser using the password you set during installation. -
Run the following SQL commands:
CREATE DATABASE zeenchat; CREATE USER dev WITH ENCRYPTED PASSWORD 'devpass'; GRANT ALL PRIVILEGES ON DATABASE zeenchat TO dev;
-
Exit the shell:
\q
Use the following credentials in your .env file or Django settings:
DB_NAME=zeenchat
DB_USER=dev
DB_PASSWORD=devpass
DB_HOST=localhost
DB_PORT=5432export $(cat .env | xargs)python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverThe application will be available at http://127.0.0.1:8000
- Message encryption using Fernet
- Rate liGPLing for WebSocket connections
- Secure headers and HTTPS settings
- CSRF protection
- XSS protection
- Input validation and sanitization
- Authentication required for all chat features
- Message length restrictions
- Secure session handling
zeenchat/
βββ chatapp/ # Main chat application
β βββ static/ # Static files (JS, CSS)
β βββ templates/ # HTML templates
β βββ consumers.py # WebSocket consumers
β βββ models.py # Database models
β βββ views.py # View controllers
βββ zeenchat/ # Project settings
βββ manage.py # Django management script
For production deployment, ensure you:
- Set
DEBUG=Falsein .env - Configure proper
ALLOWED_HOSTS - Set up SSL/TLS certificates
- Use a production-grade database (PostgreSQL recommended)
- Configure a production web server (Nginx recommended)
- Set up proper firewalls and security groups
- Enable all security headers
- Use strong passwords for all services
- Fork the repository
- Create a new branch (
git checkout -b feature/improvement) - Make changes and comGPL (
git comGPL -am 'Add new feature') - Push to the branch (
git push origin feature/improvement) - Create a Pull Request
A huge thanks to all the amazing contributors who are helping make ZeenChat better!
Want to contribute? Check out the Contributing Guidelines and submit a PR!
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
This project is licensed under the GPL License - see the LICENSE file for details.
For support:
- Open an issue in the GitHub repository
- Contact the maintainers at [email protected]
- Django Channels team for the WebSocket implementation
- Tailwind CSS for the UI framework
- All contributors and supporters of the project
- Farzeen Ghaus
- GitHub: @frzn23