This guide will walk you through setting up the AI Chatbot from scratch.
Before you begin, make sure you have:
- ✅ Node.js 18+ - Download here
- ✅ Python 3.10+ - Download here
- ✅ Git - Download here
- ✅ Supabase Account - Sign up here (free!)
git clone <your-repo-url>
cd ChatbotWe've created an automated setup script for Windows PowerShell:
.\setup.ps1This will:
- ✅ Check Node.js and Python installations
- ✅ Install all frontend dependencies
- ✅ Install all backend dependencies
- ✅ Create environment files from templates
Alternative (Manual Installation):
# Install frontend dependencies
npm install
# Install backend dependencies
cd backend
pip install -r requirements.txt
cd ..- Go to supabase.com
- Click "New Project"
- Fill in:
- Name: AI Chatbot (or your preferred name)
- Database Password: Choose a strong password
- Region: Select closest to you
- Click "Create new project"
- Wait 2-3 minutes for setup to complete
- In your Supabase Dashboard, go to SQL Editor (left sidebar)
- Click "New Query"
- Open
supabase/migrations/001_initial_schema.sqlin your code editor - Copy all the SQL code (Ctrl+A, Ctrl+C)
- Paste into the Supabase SQL Editor
- Click "Run" button (or press Ctrl+Enter)
- You should see "Success. No rows returned"
✅ Your database is now configured with all tables and security policies!
- In Supabase Dashboard, go to Project Settings (gear icon)
- Click API in the left menu
- You'll need two keys:
- Project URL - Copy the URL under "Project URL"
- anon/public key - Copy the key under "Project API keys" → "anon public"
- service_role key - Click "Reveal" next to service_role and copy it
Open .env.local in your code editor and update:
NEXT_PUBLIC_SUPABASE_URL=https://your-project-id.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_public_key_here
NEXT_PUBLIC_API_URL=http://localhost:8000Replace:
your-project-idwith your actual Supabase project IDyour_anon_public_key_herewith the anon key you copied
Open backend/.env in your code editor and update:
SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_SERVICE_KEY=your_service_role_key_hereReplace:
your-project-idwith your actual Supabase project IDyour_service_role_key_herewith the service_role key you copied
You need two terminal windows running simultaneously:
cd backend
python main.pyYou should see:
INFO: Uvicorn running on http://0.0.0.0:8000
INFO: Application startup complete.
npm run devYou should see:
▲ Next.js 14.2.0
- Local: http://localhost:3000
- Ready in X.Xs
- Open your browser
- Go to http://localhost:3000
- You should see the login/signup page! 🎉
To use the chatbot, you'll need API keys from at least one AI provider:
- Go to platform.openai.com
- Sign in or create an account
- Click "Create new secret key"
- Copy the key (starts with
sk-...) - Add billing information if needed
Cost: Pay-as-you-go, ~$0.002 per 1K tokens
- Go to makersuite.google.com/app/apikey
- Sign in with your Google account
- Click "Create API key"
- Copy the key (starts with
AI...)
Cost: Free tier available with generous limits!
- Go to platform.deepseek.com
- Sign up for an account
- Navigate to API Keys section
- Create a new API key
- Copy the key (starts with
sk-...)
Cost: Very affordable, ~$0.0001 per 1K tokens
- Go to x.ai
- Sign up for access
- Get your API key from the dashboard
- Copy the key (starts with
xai-...)
Cost: Pricing varies, check their website
- Log in to your account on http://localhost:3000
- Click Settings in the sidebar
- Paste your API keys in the respective fields
- Click "Save API Keys"
- Select a provider and start chatting! 💬
Make sure everything is working:
- Backend server running on http://localhost:8000
- Frontend server running on http://localhost:3000
- Can create an account and log in
- Can access Settings and save API keys
- Provider buttons show correct status (enabled/disabled)
- Can send a message and get a response
- Prompt counter updates after each message
- Conversations are saved in sidebar
Solution: Run npm install in the project root directory.
Solution: Dependencies not installed. Run:
npm installSolution: Install Python dependencies:
cd backend
pip install -r requirements.txtSolution: Check your Supabase credentials:
- Verify
.env.localhas the correct anon key - Verify
backend/.envhas the correct service_role key - Make sure URLs match your Supabase project
Solution:
- Make sure backend is running on port 8000
- Check
NEXT_PUBLIC_API_URLin.env.localishttp://localhost:8000
Solution:
- Check API keys are saved in Settings
- Verify selected provider has a valid API key
- Check backend logs for errors
Solution: Check the database:
-- In Supabase SQL Editor
SELECT * FROM user_model_limits WHERE user_id = '<your-user-id>';
-- Reset limits if needed
DELETE FROM user_model_limits WHERE user_id = '<your-user-id>';Edit app/globals.css:
/* Change gradient background */
body {
@apply bg-gradient-to-br from-your-color-900 via-your-color-800 to-your-color-900;
}Edit supabase/migrations/001_initial_schema.sql (before running migration):
limit INTEGER DEFAULT 100 -- Change to your desired limitOr update existing limits in Supabase Dashboard:
UPDATE user_model_limits SET limit = 200;Edit tailwind.config.js:
animation: {
'slide-up': 'slideUp 500ms ...', // Change duration
}- Push your code to GitHub
- Go to vercel.com
- Import your repository
- Add environment variables in Vercel dashboard
- Deploy!
- Push your code to GitHub
- Sign up on railway.app or render.com
- Create a new service from your GitHub repo
- Set build command:
pip install -r backend/requirements.txt - Set start command:
python backend/main.py - Add environment variables
- Deploy!
Don't forget to update NEXT_PUBLIC_API_URL in your frontend to your deployed backend URL!
- Next.js Documentation
- FastAPI Documentation
- Supabase Documentation
- Tailwind CSS Documentation
- Framer Motion Documentation
If you encounter any issues:
- Check the README.md for quick reference
- Review this setup guide carefully
- Check browser console and backend logs for errors
- Open an issue on GitHub with:
- Description of the problem
- Error messages
- Steps to reproduce
- Your environment (OS, Node version, Python version)
Happy chatting! 🤖✨