A simple real-time chat application that connects to Ollama AI models for intelligent conversations. Built with React frontend and Node.js backend, featuring concurrent request processing, syntax highlighting, and a beautiful user interface.

- Real-time AI Chat: Stream responses from Ollama AI models
- Concurrent Processing: Handle multiple users simultaneously with request queuing
- Syntax Highlighting: Beautiful code rendering with support for 20+ programming languages
- Conversation Management: Save and manage multiple chat conversations
- Model Selection: Switch between different Ollama models
- Responsive Design: Modern UI that works on desktop and mobile
- Docker Support: Easy deployment with Docker and Docker Compose
- Security: Rate limiting, CORS protection, and security headers
- Health Monitoring: Built-in health checks and metrics
- Frontend: React 19 + Vite with syntax highlighting and markdown rendering
- Backend: Node.js + Express with concurrent request processing
- AI Integration: Ollama API with connection pooling and request queuing
- Deployment: Docker containers with Nginx reverse proxy
- Docker and Docker Compose
- Node.js (for local development)
- Ollama (for local AI model hosting)
-
Clone the repository
git clone https://github.com/dynstat/Ollama-AI-chat-app.git cd Ollama-AI-chat-app
-
Start the application
# Production mode docker-compose up --build # Development mode (with hot reload) ./dev-start.bat # Windows # OR docker-compose -f docker-compose.dev.yml up --build # Linux/Mac
-
Access the application
- Frontend: http://localhost:8080 (production) or http://localhost:5173 (development)
- Backend API: http://localhost:3001
-
Backend Setup
cd backend npm install npm start
-
Frontend Setup
cd frontend npm install npm run dev
Create a .env
file in the root directory or set environment variables:
# Ollama Configuration
OLLAMA_HOST=https://Your-Ollama-server-URL/ # Your Ollama server URL
OLLAMA_MODEL=qwen3:1.7b # Default model to use
# Security (Optional)
API_KEY=your-secret-api-key # API key for public exposure
ALLOWED_ORIGINS=http://localhost:3000 # CORS allowed origins
# Server Configuration
PORT=3001 # Backend server port
The application supports these Ollama models:
qwen3:1.7b
(default)qwen3:8b
qwen2:1.5b
codegemma:2b
codegemma:7b
deepseek-r1:7b
gpt-oss:20b
-
Install Ollama: Follow the official installation guide
-
Pull a model:
ollama pull qwen3:1.7b
-
Start Ollama server:
ollama serve
The application supports concurrent request processing. Configure in backend/config.js
:
// Request queue configuration
export const QUEUE_CONFIG = {
maxConcurrent: 4, // Maximum concurrent requests
timeout: 300000, // Request timeout (5 minutes)
retryAttempts: 2, // Number of retry attempts
retryDelay: 1000, // Delay between retries (ms)
};
- Start a Conversation: Click "New Chat" to begin
- Select Model: Choose from available Ollama models
- Send Messages: Type your message and press Enter
- View Responses: AI responses stream in real-time with syntax highlighting
- Manage Chats: Save, rename, or delete conversations
- Code Support: Send code snippets for analysis and explanation
GET /health
- Health checkPOST /api/chat
- Send chat messageGET /api/queue-status
- Get request queue statusGET /metrics
- Prometheus metrics (if enabled)
Ollama-AI-chat-app/
βββ backend/ # Node.js API server
β βββ server.mjs # Main server file
β βββ config.js # Configuration
β βββ package.json # Backend dependencies
βββ frontend/ # React application
β βββ src/
β β βββ App.jsx # Main application component
β β βββ components/ # React components
β βββ package.json # Frontend dependencies
βββ docker-compose.yml # Production Docker setup
βββ docker-compose.dev.yml # Development Docker setup
βββ dev-start.bat # Windows development script
# Backend development
cd backend
npm install
npm start
# Frontend development
cd frontend
npm install
npm run dev
npm run build
npm run lint
# Docker development
docker-compose -f docker-compose.dev.yml up --build
-
Ollama Connection Error
- Ensure Ollama server is running
- Check
OLLAMA_HOST
environment variable - Verify network connectivity
-
Docker Build Issues
- Clear Docker cache:
docker system prune -a
- Rebuild without cache:
docker-compose build --no-cache
- Clear Docker cache:
-
Port Conflicts
- Change ports in
docker-compose.yml
- Check if ports 3001, 5173, or 8080 are in use
- Change ports in
-
Memory Issues
- Increase Docker memory allocation
- Use smaller models for development
- Backend health:
curl http://localhost:3001/health
- Frontend: Open http://localhost:8080 in browser
- Queue status:
curl http://localhost:3001/api/queue-status
- Concurrent Requests: Up to 4 simultaneous users
- Response Time: Depends on Ollama model and server performance
- Memory Usage: ~512MB-2GB depending on model size
- Connection Pooling: Up to 50 concurrent connections
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the ISC License.
- Ollama for the AI model hosting
- React for the frontend framework
- Express for the backend framework
- Highlight.js for syntax highlighting
- Marked for markdown rendering
For issues and questions:
- Check the troubleshooting section
- Review the concurrent processing documentation
- Open an issue on GitHub