A complete chatbot application built with Flutter frontend and Python FastAPI backend, powered by Ollama for AI conversations.
ollama-chatbot-fullstack/
├── README.md # This file
├── .gitignore # Git ignore rules
├── frontend/ # Flutter mobile/web app
│ ├── lib/
│ ├── pubspec.yaml
│ └── ...
└── backend/ # Python FastAPI server
├── api_server.py
├── requirements.txt
└── ...
- Flutter SDK (latest stable)
- Python 3.8+
- Ollama installed and running
- Git
git clone <your-repo-url>
cd ollama-chatbot-fullstackcd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Start the server
python api_server.pyThe backend will be available at http://localhost:8000
cd frontend
# Install Flutter dependencies
flutter pub get
# Update API URL in lib/services/api_service.dart
# Change 'YOUR_BACKEND_URL_HERE' to 'http://localhost:8000'
# Run the app
flutter run -d chrome # For web
# or
flutter run # For mobile (with emulator/device connected)-
Ollama Model: Update the model in
backend/api_server.py:runnable = build_chain(os.getenv("OLLAMA_MODEL", "llama3.1:8b"))
-
Environment Variables: Create
.envfile in backend/ if needed:OLLAMA_MODEL=llama3.1:8b
-
API URL: Update
lib/services/api_service.dart:static const String baseUrl = 'http://localhost:8000';
-
Build for different platforms:
flutter build web # Web flutter build apk # Android flutter build ios # iOS
- User Authentication (registration/login)
- Real-time Chat with Ollama AI models
- Cross-platform (Web, iOS, Android)
- Clean Architecture with proper separation of concerns
- Error Handling and connection status indicators
- Modern UI with Material Design
- FastAPI with automatic docs at
http://localhost:8000/docs - LangChain integration for AI pipeline
- Simple in-memory authentication (replace with database in production)
- CORS enabled for frontend development
- Flutter with Material Design 3
- Service-based architecture
- HTTP client for API communication
- Responsive design for multiple screen sizes
POST /auth/register- User registrationPOST /auth/login- User loginPOST /chat- Send message to AIGET /docs- API documentation
- Replace in-memory user storage with proper database
- Implement proper JWT token validation
- Use HTTPS in production
- Validate and sanitize all inputs
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
[Add your license here]
- Ollama for local AI model hosting
- LangChain for AI pipeline framework
- Flutter for cross-platform UI
- FastAPI for backend framework