make an environment first then go to Backend and install django , supabase python client, drf , corsheader, pyjwt etc etc then python manage.py runserver
go to Chatbot_Ui
npm rundev
An AI-powered customer support chatbot built with Django backend and React frontend, integrated with Supabase for authentication and database, and Google Gemini AI for intelligent conversation handling.
Daksha.ai is a full-stack customer support chatbot application that enables users to:
- Chat with an AI assistant powered by Google Gemini AI
- Manage their profile and account information
- View products and add items to cart
- Check orders and order history
- File complaints and track complaint status
- Schedule returns for products
- Create orders from cart items
The chatbot intelligently detects user intent, retrieves relevant context from the database, and performs actions based on natural language requests.
- Django 5.2.7 - Python web framework
- Django REST Framework - RESTful API endpoints
- Supabase - Backend-as-a-Service for authentication and database
- Google Gemini AI - AI model for chatbot responses
- SQLite - Local database (for Django models, Supabase is primary DB)
- React 19 - UI framework
- Vite - Build tool and dev server
- Tailwind CSS - Styling framework
- React Router - Client-side routing
- Supabase JS Client - Authentication and database client
- Lucide React - Icons
- Sonner - Toast notifications
Website_Support_Agent_Ai/
├── Backend/ # Django backend application
│ ├── api/ # Main API app
│ │ ├── views.py # API endpoints (chatbot, auth, profile)
│ │ ├── chatbot_logic.py # Intent detection and context retrieval
│ │ ├── urls.py # API URL routing
│ │ └── supabase_client.py # Supabase client configuration
│ ├── chatbot/ # Chatbot app (Django app)
│ ├── core/ # Django project settings
│ │ ├── settings.py # Django configuration
│ │ └── urls.py # Main URL configuration
│ ├── manage.py # Django management script
│ └── requirements.txt # Python dependencies
│
├── Chatbot_Ui/ # React frontend application
│ ├── src/
│ │ ├── components/
│ │ │ ├── auth/ # Authentication components (login, signup, etc.)
│ │ │ ├── pages/ # Main pages (Chatbot, Profile)
│ │ │ └── ui/ # Reusable UI components
│ │ ├── supabaseclient.js # Supabase client initialization
│ │ └── App.jsx # Main React app component
│ ├── package.json # Node.js dependencies
│ └── vite.config.js # Vite configuration
│
└── Resources/
└── dbms mockdata/ # CSV files with sample database schema
- Python 3.8+ (for Django backend)
- Node.js 16+ and npm (for React frontend)
- Supabase Account - Sign up at supabase.com
- Google Gemini API Key - Get from Google AI Studio
git clone <repository-url>
cd Website_Support_Agent_Aicd BackendWindows:
python -m venv venv
venv\Scripts\activatemacOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the Backend/ directory with the following variables:
# Django Settings
DJANGO_SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Supabase Configuration
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_KEY=your-service-role-key
SUPABASE_JWT_SECRET=your-jwt-secret
# Google Gemini AI
GEMINI_API_KEY=your-gemini-api-keyHow to get Supabase credentials:
- Go to your Supabase project dashboard
- Navigate to Settings → API
- Copy the Project URL (
SUPABASE_URL) - Copy the anon/public key (
SUPABASE_ANON_KEY) - Copy the service_role key (
SUPABASE_SERVICE_KEY) - Keep this secret! - Navigate to Settings → Auth → JWT Settings to get
SUPABASE_JWT_SECRET
You need to create the following tables in your Supabase database. You can use the CSV files in Resources/dbms mockdata/ as reference for the schema:
Required Tables:
users- User profiles (columns: user_id, name, email, password_hash, phone, address, city, state, pincode)products- Product catalog (columns: product_id, name, price, description, stock, image_url)orders- Order records (columns: order_id, user_id, status, total_amount, shipping_address, payment_method, order_date)order_items- Order line items (columns: order_item_id, order_id, product_id, quantity, price_at_order)cart_items- Shopping cart (columns: cart_item_id, user_id, product_id, quantity)complaints_updated- Customer complaints (columns: complaint_id, user_id, order_id, description, status, created_at)returns- Return requests (columns: return_id, user_id, order_id, product_id, reason, status, requested_date)meeting- Scheduled meetings (columns: meeting_id, user_id, support_person, scheduled_time, status)chat_logs_updated- Chat history (columns: log_id, user_id, user_message, bot_response, intent_detected, timestamp)
Quick Setup using Supabase SQL Editor:
- Go to your Supabase project → SQL Editor
- Create tables (example for
userstable):
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
name VARCHAR(255),
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255),
phone VARCHAR(20),
address TEXT,
city VARCHAR(100),
state VARCHAR(100),
pincode VARCHAR(20),
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);Repeat for all tables with appropriate columns based on your CSV files.
python manage.py migratepython manage.py runserverThe backend will be available at http://127.0.0.1:8000
Open a new terminal window and navigate to:
cd Chatbot_Uinpm installCreate a .env file in the Chatbot_Ui/ directory:
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key
VITE_API_URL=http://127.0.0.1:8000/apiNote: Use the same Supabase credentials from the backend .env file.
npm run devThe frontend will be available at http://localhost:5173 (default Vite port)
- Open your browser and navigate to
http://localhost:5173 - You'll be redirected to the login page
- Create a new account using the Signup page
- After login, you'll be redirected to the chatbot interface
- Sign Up: Create a new account via
/signup - Login: Authenticate via Supabase Auth at
/login - Chatbot: Access the main chatbot interface at
/chatbot - Profile: View/edit profile at
/profile
The chatbot supports natural language queries. Here are some example interactions:
Profile Management:
- "Show my profile"
- "Update my address to 123 Main St, New York"
- "Change my phone number to 555-1234"
Products & Cart:
- "Show me products"
- "Add product 1 to my cart"
- "What's in my cart?"
- "I want to checkout" or "Order my cart"
Orders:
- "Show my orders"
- "What's the status of order 123?"
Complaints:
- "I want to file a complaint"
- "My order 123 was damaged"
Returns:
- "I want to return order 123"
- "Schedule a return for product 5"
General:
- "What can I do?"
- "Help me"
POST /api/register/- Register a new userPOST /api/login/- Login user (returns JWT token)GET /api/profile/- Get user profile (requires authentication)
POST /api/chatbot/- Send message to chatbot (requires authentication)- Headers:
Authorization: Bearer <token> - Body:
{"message": "your message here"} - Response:
{"type": "text|profile_data|product_list|...", "payload": {...}}
- Headers:
The application uses Supabase (PostgreSQL) for data storage. Key tables include:
- users - User accounts and profiles
- products - Product catalog
- orders - Order records
- order_items - Order line items
- cart_items - Shopping cart items
- complaints_updated - Customer complaints
- returns - Return requests
- meeting - Scheduled support meetings
- chat_logs_updated - Chat conversation history
Refer to CSV files in Resources/dbms mockdata/ for sample data structure.
- Never commit
.envfiles - They contain sensitive credentials - Use environment variables for all secrets
- Supabase Service Key should only be used server-side
- JWT tokens are validated on both frontend and backend
- CORS is configured for development - restrict in production
Import Errors:
# Ensure virtual environment is activated
pip install -r requirements.txtSupabase Connection Errors:
- Verify your
.envfile has correct Supabase credentials - Check Supabase project is active and API keys are valid
Gemini API Errors:
- Verify
GEMINI_API_KEYis set correctly - Check API quota/limits in Google AI Studio
Build Errors:
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm installAPI Connection Errors:
- Verify
VITE_API_URLpoints tohttp://127.0.0.1:8000/api - Ensure Django backend is running
- Check browser console for CORS errors
Authentication Errors:
- Verify Supabase credentials in
.env - Check if user exists in Supabase Auth dashboard
- Clear browser localStorage and try again
- Set
DEBUG=Falsein production - Set proper
ALLOWED_HOSTS - Use a production WSGI server (Gunicorn)
- Configure proper database (PostgreSQL recommended)
- Set up environment variables securely
- Build the production bundle:
npm run build- Deploy the
dist/folder to a static hosting service (Vercel, Netlify, etc.) - Update
VITE_API_URLto your production backend URL
- The chatbot uses intent detection to route queries to appropriate handlers
- Google Gemini AI generates JSON responses based on user queries
- Context-aware responses pull data from Supabase based on detected intent
- Multi-turn conversations are supported via chat history tracking
- JWT tokens from Supabase Auth are used for authentication
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is for educational/demonstration purposes.
Note: This is a development project. Ensure all security best practices are followed before deploying to production.