How dkruyt/webollama works
Project type and purpose
• This is a full-stack web application (“WebOllama”) built with Python Flask on the backend and Bootstrap on the frontend.
• Purpose: Provide a browser-based interface for managing local Ollama LLM models, chatting/generating text, and viewing version updates.
File structure
• Top-level files:
• app.py – single monolithic Flask application entrypoint with all HTTP routes/controllers
• Dockerfile, docker-compose.yml & docker-compose.ollama.yml – containerization and multi-service orchestration
• setup.sh, requirements.txt – bootstrap script and Python dependencies
• .github/workflows/docker-build.yml – CI pipeline for building the Docker image
• Directories:
• templates/ – HTML view templates (MVC view)
• static/css/ – CSS assets (MVC static assets)
• assets/ – project screenshots and images used in README (documentation assets)
• No database folder: state is ephemeral/in-memory or managed by external Ollama server.
README for technical stack and architecture hints
• Flask for the web server
• Bootstrap for responsive UI
• Ollama API service running locally (default on http://127.0.0.1:11434) as an external microservice
• Optional use of GitHub Releases API to fetch changelogs
• Two “deploy” modes via Docker Compose:
1. WebOllama container only (connects to host’s Ollama)
2. Both Ollama and WebOllama containers in the same network
Key components
a. Client Browser (Chrome/Firefox on desktop or mobile) – sends HTTP(S) requests
b. WebOllama Flask App
• Routes/Controllers (in app.py)
• Template Rendering (templates/)
• Static Asset Server (static/, CSS/JS)
• Session Management (Flask sessions with SECRET_KEY)
• External API adapters:
• Ollama API for model management & inference
• GitHub Releases API for version/changelog
c. Ollama API Service (local LLM server, default port 11434)
d. Docker Infrastructure (optional view)
• webollama container
• ollama container
• Docker bridge network
• GitHub Actions workflow that builds and publishes Docker images
Relationships & data flow
• Browser → (HTTP) → Flask App
• Flask App → (HTTP REST) → Ollama API Service (model pulls, inference, stats)
• Flask App → (HTTPS REST) → GitHub Releases (fetch changelog)
• Flask App → Template Engine → Served HTML/CSS/JS → Browser
• Optional: Docker Compose network connecting webollama and ollama containers
• CI pipeline pushes new Docker images to registry, which Docker Compose pulls
Architectural patterns & design principles
• MVC (Model: external Ollama, View: Jinja2 templates, Controller: Flask routes)
• Adapter pattern for abstracting the external Ollama & GitHub APIs behind Python functions
• Containerization & microservices: separate container for Ollama LLM, isolated network
• Single-page-style interactions via dynamic endpoints (chat streaming, JSON fetches)
Essential details without over-splitting
• Integration points: where data flows in/out of your app
• Optional and alternate paths: two Docker-Compose flavors, direct host-based Ollama vs. containerized Ollama