A full-stack AI-powered web application featuring a FastAPI backend and a Next.js frontend. This project supports AI chat, voice chat, and user usage tracking.
- Frontend: Next.js 16, React 19, Tailwind CSS 4, Axios.
- Backend: FastAPI, Motor (MongoDB Async Driver), Pydantic, Jose (JWT).
- Database: MongoDB.
- AI Engine: Ollama (local) or OpenAI API.
Before setting up the project, ensure you have the following installed:
- Node.js (v18 or later)
- Python (v3.9 or later)
- MongoDB (Running locally or a cloud URI)
- Ollama (Optional, for local AI models)
git clone <repository-url>
cd ai-agent-webcd backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txtcd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a .env file in the backend/ directory:
MONGO_URL=mongodb://localhost:27017
SECRET_KEY=your-secret-key-change-me
OLLAMA_URL=http://localhost:11434/api/generate
MODEL=qwen2.5-coder:1.5b-basecd frontend
npm installCreate a .env.local file in the frontend/ directory (if needed for API URLs).
From the backend/ directory (with virtual environment active):
uvicorn main:app --reloadThe backend will be available at http://localhost:8000.
From the frontend/ directory:
npm run devThe frontend will be available at http://localhost:3000.
- AI Chat: Interact with AI models via a clean web interface.
- Voice Chat: Simulated voice interaction (requires login).
- Authentication: JWT-based user registration and login.
- Usage Limits: Daily chat and voice limits for guests and registered users.
- Chat History: Persists chat sessions in MongoDB for authenticated users.
- MongoDB Connection: Ensure MongoDB is running and the
MONGO_URLinbackend/.envis correct. - AI Connection: If using Ollama, ensure it is running and the model specified in
MODELis pulled (ollama pull qwen2.5-coder:1.5b-base). - Python Path: On Windows, if
pythondoesn't work, trypy. On macOS/Linux, usepython3.