Skip to content

This project demonstrates a secure AI-powered chatbot πŸ€– in a Django environment. It focuses on frontend-backend chat flow and essential security practices, specifically secure environment variable handling πŸ”‘. Structured for portfolio use 🧠 (currently offline), it offers a modular design and clean interface ✨ for learning AI integration.

License

Notifications You must be signed in to change notification settings

Muhammad-Azmeer-Ahmad/Secure-GPT-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Secure GPT Chatbot

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. πŸ’¬πŸ”

Image Alt Image Alt


⚠️ Important Note

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!


πŸš€ Features

  • 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 chatbot app for better scalability.

πŸ“¦ Clone & Run Locally

1️⃣ Clone the repository

git clone [https://github.com/muhammadazmeerahmad/SecureGPTChatbot](https://github.com/muhammadazmeerahmad/SecureGPTChatbot)
cd SecureGPTChatbot

2️⃣ Create a Virtual Environment

python -m venv venv

3️⃣ Activate it

Windows:

venv\Scripts\activate

Linux:

source venv/bin/activate

4️⃣ Install dependencies

pip install -r requirements.txt

5️⃣ Create your .env file

Inside 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 available

6️⃣ Run the Server

python manage.py runserver

Project Structure:

SecureGPTChatbot/
β”‚
β”œβ”€β”€ 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

πŸ› οΈ Technologies Used

  • 🐍 Python 3.13
  • 🌐 Django
  • πŸ’¬ OpenAI GPT API (optional)
  • 🎨 HTML, CSS, JavaScript

🧠 Learning Outcomes

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

✨ Future Improvements

  • Integrate real GPT responses using OpenAI API
  • Add encrypted chat history storage (Fernet AES)
  • Deploy publicly on Render / Vercel / Railway

About

This project demonstrates a secure AI-powered chatbot πŸ€– in a Django environment. It focuses on frontend-backend chat flow and essential security practices, specifically secure environment variable handling πŸ”‘. Structured for portfolio use 🧠 (currently offline), it offers a modular design and clean interface ✨ for learning AI integration.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published