A minimal full-stack chatbot using:
- Frontend: Next.js + React + TypeScript
- Backend: FastAPI (Python)
- LLM API: Groq (e.g. LLaMA 3, Mixtral — free to use)
- Clean React-based UI
- FastAPI backend with Groq API integration
- Environment-configurable API endpoint
- Runs fully on localhost for development
ai-chat-app-basic/
├── backend/
│ ├── main.py # FastAPI server
│ ├── .env # Groq API key (not committed)
│ └── requirements.txt # Python dependencies
│
├── frontend/
│ ├── pages/index.tsx # React frontend (Next.js)
│ ├── .env.local # Frontend environment variables
│ ├── package.json # npm config
│ ├── tsconfig.json # TypeScript config
│ └── next-env.d.ts # Auto-generated TS types
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Create your .env file with your Groq API key
echo "GROQ_API_KEY=sk-..." > .env
# Start the backend server
uvicorn main:app --reloadcd frontend
npm install
# Create a .env.local file for your frontend API endpoint
echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > .env.local
# Start the frontend server
npm run devThen open: http://localhost:3000
GROQ_API_KEY=your-groq-api-key-hereNEXT_PUBLIC_API_URL=http://localhost:8000These values are critical for local development. Do not commit your actual .env or .env.local files — only .env.local.example.
- Add model selector (Mixtral, Gemma, etc.)
- Deploy backend to Railway or Render
- Deploy frontend to Vercel
- Add streaming and chat history
MIT – feel free to use and modify.