An intelligent chatbot for Thaddeus Stevens College of Technology's Computer Software Engineering Technology (CSET) program, powered by Google Gemini AI with RAG (Retrieval Augmented Generation).
- AI-Powered Responses - Utilizes Google Gemini 2.5 Flash model
- Smart Context Retrieval - RAG with Pinecone vector database
- Modern UI - Responsive React interface with dark mode support
- Secure Backend - Express.js API with environment-based configuration
- Fast & Lightweight - Built with Vite and TypeScript
This application consists of two main parts:
-
Frontend (React + TypeScript + Vite)
- Modern, responsive UI
- Real-time chat interface
- API client for backend communication
-
Backend (Node.js + Express + TypeScript)
- RESTful API endpoints
- Google Gemini AI integration
- Pinecone vector database (with mock support)
- CORS and security middleware
- Node.js 18 or higher
- npm or yarn
- Google Gemini API key (Get one here)
For detailed setup instructions, see SETUP.md
Quick setup:
-
Backend Setup
cd backend npm install cp env.example.txt .env # Edit .env and add your GEMINI_API_KEY npm run dev
-
Frontend Setup (in a new terminal)
npm install npm run dev
-
Access the app
- Frontend: http://localhost:5173
- Backend API: http://localhost:3001/api
CSET-chatbot/
├── backend/ # Express.js backend
│ ├── src/
│ │ ├── config/ # Environment configuration
│ │ ├── constants/ # System prompts & knowledge base
│ │ ├── controllers/ # Request handlers
│ │ ├── middleware/ # Express middleware
│ │ ├── routes/ # API routes
│ │ ├── services/ # Gemini & Pinecone services
│ │ ├── types/ # TypeScript types
│ │ └── server.ts # Main server file
│ ├── package.json
│ └── README.md
├── components/ # React components
│ ├── ChatBubble.tsx
│ ├── Header.tsx
│ ├── IconComponents.tsx
│ └── MessageInput.tsx
├── services/ # Frontend services
│ ├── apiService.ts # Backend API client (current)
│ ├── geminiService.ts # Legacy direct integration
│ └── pineconeService.ts # Legacy mock service
├── App.tsx # Main React component
├── types.ts # TypeScript types
├── constants.ts # Frontend constants
├── package.json
├── SETUP.md # Detailed setup guide
└── README.md # This file
Create backend/.env:
PORT=3001
NODE_ENV=development
FRONTEND_URL=http://localhost:5173
GEMINI_API_KEY=your_gemini_api_key_here
USE_MOCK_PINECONE=trueCreate .env in root:
VITE_API_URL=http://localhost:3001/apiGET /api/health- Health checkPOST /api/chat/message- Send a message to the chatbotPOST /api/chat/reset- Reset the chat session
For detailed API documentation, see backend/README.md
Backend (with hot reload):
cd backend
npm run devFrontend (with hot reload):
npm run devBackend:
cd backend
npm run build
npm startFrontend:
npm run build
npm run previewUsing curl:
# Health check
curl http://localhost:3001/api/health
# Send a message
curl -X POST http://localhost:3001/api/chat/message \
-H "Content-Type: application/json" \
-d '{"message": "What is CSET?"}'Edit backend/src/constants/systemInstruction.ts to customize:
- System instructions
- Knowledge base content
- AI personality
Modify Tailwind classes in components to customize the look and feel.
- API keys stored securely in backend environment variables
- CORS configured to accept requests only from frontend
- Helmet.js for security headers
- Input validation on all endpoints
- React 19
- TypeScript 5.8
- Vite 6
- Tailwind CSS (via inline styles)
- Node.js
- Express.js
- TypeScript 5.8
- Google Gemini AI SDK
- Pinecone Vector Database
- Helmet, CORS, Morgan
See SETUP.md for common issues and solutions.
ISC
Contributions are welcome! Please feel free to submit a Pull Request.
For issues or questions, please create an issue in the repository.