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 (not required for Docker Installation method)
- Git
- Docker Compose (for development only)
- Docker Compose (for production) (coming soon!)
- Traditional Venv
See the official Docker documentation for more information on Compose, including installation.
$ git clone https://github.com/frzn23/zeenchat.git
$ cd zeenchat$ cp docker/env.example .env
$ nano docker/.envUpdate applicable ENV file entries.
- At a minimum, update the REDIS_PASSWORD entry.
- For production deployment, additional entries must be updated. See Environment Variables for more information.
$ docker compose -f docker/compose.dev.yaml up --build -dThe application will be available at http://localhost:8000.
$ git clone https://github.com/frzn23/zeenchat.git
$ cd zeenchatpython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activate$ pip install -r requirements.txt- Download Redis for Windows from Redis Downloads
- Install and start the Redis service
$ sudo apt update
$ sudo apt install redis-server
$ sudo systemctl start redis-server% brew install redis
% brew services start redis$ python manage.py makemigrations
$ python manage.py migrate$ python 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
│ ├── middleware.py # App Middleware
│ ├── models.py # Database models
│ └── views.py # View controllers
├── zeenchat/ # Project settings
├── manage.py # Django management script
├── docker/ # Docker configuration file(s)
└── redis/
└── conf/ # Redis configuration file(s)
Default: ' ' (Empty string) (REQUIRED for production deployment)
A secret key for a particular Django installation. This is used to provide cryptographic signing, and should be set to a unique, unpredictable value. See Django documentation for more information.
Default: False (optional)
A boolean that turns on/off debug mode. See Django documentation for more information.
SECURITY NOTE: Never deploy a site into production with DEBUG turned on.
Default: [] (Empty list) (REQUIRED for production deployment)
A comma-seperated list of strings representing the host/domain names that this Django site can serve. This is a security measure to prevent HTTP Host header attacks, which are possible even under many seemingly-safe web server configurations. See Django documentation for more information.
Example ENV file entry: DJANGO_ALLOWED_HOSTS=localhost, 127.0.0.1, yourdomain.com
Default: [] (Empty list) (REQUIRED for production deployment)
A comma-seperated list of trusted origins for unsafe requests (e.g. POST). See Django documentation for more information.
Example ENV file entry: CSRF_TRUSTED_ORIGINS=http://localhost, http://127.0.0.1, http://yourdomain.com, https://yourdomain.com
Default: False (REQUIRED for production deployment)*
Whether to use a secure cookie for the CSRF cookie. See Django documentation for more information.
SECURITY NOTE: Warning: Must be True for production deployment.
Default: Postgres (optional)
Specify database engine to use. Use mapping below:
- 'sqlite3': SQLite3
- 'pg': Postgres
- ' ' (null entry): Postgres
Example ENV file entry: DATABASE=sqlite3
Default: AppDatabase (optional)
To set custom database name (ignored when using SQLite3).
Default: appuser (optional)
To set custom database user (ignored when using SQLite3).
Default: appuser (REQUIRED) unless using SQLite3)
To set custom database password (ignored when using SQLite3).
Default: db (optional)
To set custom database hostname (ignored when using SQLite3).
Default: 5432 (optional)
To set custom database port number (ignored when using SQLite3).
Default: none (REQUIRED)
To set password for Redis. See Redis documentation for more information.
SECURITY NOTE: Warning: since Redis is pretty fast, an outside user can try up to 1 million passwords per second against a modern box. This means that you should use very strong passwords, otherwise they will be very easy to break.
Default: redis (optional)
To set custom Redis hostname.
Default: 6379 (optional)
To set custom Redis port number.
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
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