A modern, secure chat application powered by Ollama for local AI model inference. Built with React, TypeScript, and Supabase.
- 🔒 Secure authentication with email/password
- 🤖 Local AI model integration via Ollama
- 💬 Real-time chat interface with markdown support
- 🔄 Automatic health monitoring of Ollama instances
- 🚀 Docker and Lilypad deployment options
- 🎨 Beautiful, responsive UI with Tailwind CSS
- ⚡ Vite-powered development experience
- Frontend: React, TypeScript, Tailwind CSS
- Backend: Express.js proxy server
- Database: Supabase (PostgreSQL)
- Authentication: Supabase Auth
- AI Integration: Ollama API
- Icons: Lucide React
- Development: Vite, ESLint
- Node.js 18+
- Supabase account
- Ollama instance (local or remote)
Create a .env
file in the root directory:
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
# Install dependencies
npm install
# Start the development server
npm run dev
-
Authentication (
Auth.tsx
)- Handles user signup/signin
- Manages authentication state
-
Chat Interface (
Chat/
)ChatHeader
: Navigation and model selectionChatInput
: Message input with connection statusChatMessages
: Message display with markdown supportSettingsModal
: Model and endpoint configuration
-
Ollama Integration
- Instance management
- Health monitoring
- Model selection
- Message generation
- Uses Zustand for global state management
- Manages chat messages, Ollama endpoint, and selected model
- Handles error logging and instance status
-
Messages
- Stores chat history
- Links messages to users
- Supports conversation threading
-
Error Logs
- Tracks system errors
- Helps with debugging and monitoring
-
Ollama Instances
- Manages Ollama instance lifecycle
- Tracks instance status and endpoints
- Row Level Security (RLS) on all tables
- Authenticated API endpoints
- Secure proxy for Ollama API
- Error handling and sanitization
src/
├── components/ # React components
├── lib/ # Utilities and store
├── types/ # TypeScript definitions
└── main.tsx # Application entry
server.js
: Express proxy serverendpoint.ts
: Ollama instance managementstore.ts
: Global state managementtypes.ts
: TypeScript interfaces
npm run test
npm run build
docker run -d --gpus=all \
-e SUPABASE_INSTANCE_ID="your_instance_id" \
-e SUPABASE_URL="your_supabase_url" \
-e SUPABASE_ANON_KEY="your_anon_key" \
ghcr.io/rhochmayr/ollama-cloudflared:latest
lilypad run --target your_target \
github.com/rhochmayr/ollama-cloudflared:0.1.0 \
-i SUPABASE_INSTANCE_ID="your_instance_id" \
-i SUPABASE_URL="your_supabase_url" \
-i SUPABASE_ANON_KEY="your_anon_key"
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License - feel free to use this project for your own purposes.
- Built with Vite
- UI components powered by Tailwind CSS
- Icons from Lucide
- Database and auth by Supabase
- AI capabilities by Ollama
sequenceDiagram
participant User
participant WebUI
participant Supabase
participant Runner as Docker/Lilypad
participant Ollama
%% Authentication Flow
User->>WebUI: Sign in/Sign up
WebUI->>Supabase: Authenticate user
Supabase-->>WebUI: Return auth token
%% Instance Request Flow
User->>WebUI: Request Ollama instance
WebUI->>Supabase: Create instance request
Supabase->>Runner: Trigger instance creation
Runner->>Ollama: Start Ollama server
Runner->>Supabase: Update instance status
Supabase-->>WebUI: Return instance endpoint
%% Chat Flow
User->>WebUI: Send message
WebUI->>Supabase: Store user message
WebUI->>Ollama: Generate response
Ollama-->>WebUI: Return AI response
WebUI->>Supabase: Store AI response
WebUI-->>User: Display response
%% Health Monitoring
loop Every 3 seconds
WebUI->>Ollama: Health check
Ollama-->>WebUI: Status update
WebUI->>Supabase: Update instance health
end
The diagram above shows the main interaction flows in the system:
- Authentication: User authentication through Supabase
- Instance Creation: Ollama instance deployment via Docker or Lilypad
- Chat Flow: Message handling and AI response generation
- Health Monitoring: Continuous instance health checking