A full-stack chatbot application with voice capabilities, built with React frontend and Node.js backend.
- 🤖 AI-powered chatbot with LLM integration
- 🎤 Voice-to-text and text-to-speech capabilities
- 💬 Real-time chat interface
- 🎨 Modern React UI with Vite
- 🔧 Express.js backend with CORS support
Before running this project, make sure you have the following installed:
- Node.js (version 16 or higher)
- npm (comes with Node.js)
You can check your versions with:
node --version
npm --versionChatbot-assignment-5aug/
├── backend/ # Node.js Express server
│ ├── config/ # Configuration files
│ ├── routes/ # API routes
│ ├── services/ # Business logic services
│ └── responses/ # Generated audio responses
└── frontend/ # React application
├── src/ # Source code
└── public/ # Static assets
.env
git clone <repository-url>
cd Voice-Bot-LLMNavigate to the backend directory and install dependencies:
cd backend
npm installCreate a .env file in the backend directory by copying the example file:
# Navigate to backend directory
cd backend
# Copy the example environment file
cp .env.example .envFile Location: Place the .env file in the backend/ directory (same level as package.json)
Then edit the .env file and add your actual API keys and configuration values.
Important: Replace your_openrouter_api_key_here with your actual OpenRouter API key. You'll need to:
- Sign up at https://openrouter.ai
- Get your API key from https://openrouter.ai/keys
- Replace the placeholder in your
.envfile with your actual API key
Open a new terminal and navigate to the frontend directory:
cd frontend
npm installIf you need to change the API URL, create a .env file by copying the example:
# Navigate to frontend directory
cd frontend
# Copy the example environment file (optional)
cp .env.example .envFile Location: Place the .env file in the frontend/ directory (same level as package.json)
The default configuration should work for local development.
In the backend directory:
# Development mode (with auto-restart)
npm run dev
# Production mode
npm startThe backend server will start on http://localhost:3000
In the frontend directory:
npm run devThe frontend will start on http://localhost:5173
You can run both servers in separate terminal windows:
Terminal 1 (Backend):
cd backend
npm run devTerminal 2 (Frontend):
cd frontend
npm run devOnce both servers are running:
- Open your browser and navigate to
http://localhost:5173 - The chatbot interface should be available
- The backend API will be accessible at
http://localhost:3000
GET /health- Health check endpointPOST /chat- Chat endpoint for sending messagesGET /responses/:filename- Access generated audio responses
npm start- Start the production servernpm run dev- Start the development server with nodemon
npm run dev- Start the development servernpm run build- Build for productionnpm run preview- Preview the production buildnpm run lint- Run ESLint
-
Port already in use: If port 3000 or 5173 is already in use, you can change the port in the respective configuration files.
-
CORS errors: The backend is configured to allow requests from
http://localhost:5173. If you're using a different port, update the CORS configuration inbackend/index.js. -
Module not found errors: Make sure you've run
npm installin both the backend and frontend directories. -
Environment variables: Ensure your
.envfile is properly configured in the backend directory.
If you encounter any issues:
- Check that all dependencies are installed
- Verify that both servers are running
- Check the browser console and server logs for error messages
- Ensure your environment variables are properly set
- Frontend: React, Vite, CSS
- Backend: Node.js, Express.js, CORS
- AI/ML: LLM integration, Text-to-Speech (gTTS)
- Development: Nodemon, ESLint
This project is licensed under the ISC License.