A secure AI-powered chatbot built using Django and OpenAIβs GPT API, designed to demonstrate AI integration, frontend-backend communication, and secure data handling within a modern web environment. π¬π
This project is not connected to any live OpenAI API at the moment. It is intended for educational and portfolio purposes π§ β demonstrating how to integrate a chatbot frontend with a Django backend securely.
π οΈ You can:
- Clone and explore the structure
- Connect your own OpenAI API key later
- Modify and deploy for testing or learning
β Perfect for students, junior developers, and cybersecurity learners exploring AI & Django integration!
- Frontend Chat Interface: Clean, animated chat UI with a starry background β¨
- Django Backend: Handles user messages and communicates with the AI endpoint.
- Secure Design: Uses environment variables (
.env) for keys and sensitive data π - Static Files Setup: Includes CSS, JS, and media integration for easy customization.
- Modular App Structure: Clearly separated
chatbotapp for better scalability.
git clone [https://github.com/muhammadazmeerahmad/SecureGPTChatbot](https://github.com/muhammadazmeerahmad/SecureGPTChatbot)
cd SecureGPTChatbotpython -m venv venvWindows:
venv\Scripts\activateLinux:
source venv/bin/activatepip install -r requirements.txtInside the root folder (next to manage.py), create a file named .env:
DJANGO_SECRET_KEY=your-secret-django-key
DEBUG=True
OPENAI_API_KEY=sk-xxxxxxx # optional if availablepython manage.py runserverSecureGPTChatbot/
β
βββ manage.py
βββ requirements.txt
βββ .env # Environment variables file
β
βββ secure_gpt_chatbot/ # Main Django project
β βββ __init__.py
β βββ settings.py
β βββ urls.py
β βββ wsgi.py
β
βββ chatbot/ # Chatbot Django app
β βββ __init__.py
β βββ admin.py
β βββ apps.py
β βββ migrations/
β βββ models.py
β βββ tests.py
β βββ urls.py
β βββ views.py
β βββ templates/
β β βββ base.html
β β βββ index.html
β βββ static/
β βββ script.js
β βββ styles.css
β βββ starry-background.css
β βββ astro.jpeg
β
βββ static/ # Global static assets
β βββ script.js
β βββ styles.css
β βββ starry-background.css
β βββ astro.jpeg
β
βββ templates/ # HTML templates (global)
β βββ base.html
β βββ index.html
β
βββ utils/ # Helper utilities
β βββ __init__.py
β βββ utils.py
β
βββ db.sqlite3
βββ venv/ # Virtual environment (auto-generated)
βββ bin/
βββ lib/
βββ include/
βββ pyvenv.cfg- π Python 3.13
- π Django
- π¬ OpenAI GPT API (optional)
- π¨ HTML, CSS, JavaScript
By exploring this project, youβll learn:
- Django app structure and static management
- API endpoint creation and routing
- Secure environment variable handling
- Frontend-to-backend chat data flow
- Integrate real GPT responses using OpenAI API
- Add encrypted chat history storage (Fernet AES)
- Deploy publicly on Render / Vercel / Railway

