System Overview
Components
Caddy (Reverse Proxy)
Caddy handles all incoming traffic and routes requests:/api/*→ FastAPI backend (port 8000)/*→ React frontend (port 80)- Automatic HTTPS certificate provisioning in production
- SSE streaming support with
flush_interval -1
FastAPI Backend
The Python backend is the core of ondoki. It provides:| Area | Details |
|---|---|
| API | 20+ router groups under /api/v1/ |
| Auth | Session cookies, OAuth 2.0 PKCE (desktop clients), API keys (MCP) |
| AI | LLM gateway (OpenAI, Anthropic, Ollama), 16 AI tools with function calling |
| MCP | Model Context Protocol server at /mcp (FastMCP, stateless HTTP) |
| Search | Hybrid FTS + semantic via PostgreSQL tsvector and pgvector |
| Export | PDF (Gotenberg), Markdown, HTML, DOCX |
| WebSocket | Real-time notifications via Redis pub/sub (multi-server) |
| Middleware | CORS, CSRF, GZip, rate limiting, request ID logging |
React Frontend
Single-page application with 23+ pages:| Area | Technologies |
|---|---|
| Routing | React Router 7 |
| State | Zustand (global), TanStack Query (server state) |
| Editor | TipTap 3 (block-based, extensible) |
| UI | Tailwind CSS + Radix UI primitives |
| Charts | Recharts |
| HTTP | Axios |
PostgreSQL + pgvector
Primary datastore with 24 tables. Key capabilities:- Full-text search:
tsvectorcolumns on documents, workflows, and steps withplainto_tsqueryand prefix matching - Vector search: pgvector extension stores 1536-dimensional embeddings for semantic similarity
- Soft deletes: Documents and workflows use
deleted_attimestamps - Materialized paths: Folders use path-based hierarchy for efficient tree queries
Redis
Used for three purposes:- Caching — Session data and temporary state
- WebSocket pub/sub — Multi-server real-time notification delivery
- Celery broker — Task queue for async media processing jobs
Gotenberg
Headless Chrome service for converting HTML/documents to PDF. Used for workflow and document export.Celery Media Worker
Async worker process for video import pipeline:- Extract audio from video
- Transcribe audio (Whisper)
- Extract key frames
- Analyze frames with AI
- Generate step-by-step guide
SendCloak + Presidio (Optional)
Privacy layer that obfuscates PII before data reaches AI providers:- Presidio — Microsoft’s NER-based PII detection engine
- SendCloak — Proxy that intercepts AI requests, masks PII, and de-masks responses
- Supports English and European languages (en, de, fr, es, it)
Data Flow
Workflow Recording
Search Query
MCP Access
Database Schema (Key Tables)
| Table | Purpose |
|---|---|
user | User accounts with email/password auth |
project | Team projects with ownership |
project_members | M:N with roles (Viewer → Owner) |
document | Rich text documents (TipTap JSON content) |
document_version | Document version history |
folder | Hierarchical folders (materialized path) |
processrecordingsession | Workflow recordings with AI-generated metadata |
processrecordingstep | Individual steps with screenshots and annotations |
processrecordingfile | Uploaded screenshot files |
embedding | pgvector embeddings for semantic search |
knowledgesource | Uploaded knowledge files (PDF, DOCX, etc.) |
knowledgelink | Relationships between resources |
contextlink | URL/app pattern → resource mappings |
gitsyncconfig | Git export configuration per project |
auditlog | Action tracking for compliance |
llmusage | Token/cost tracking per LLM call |
mcpapikey | Project-scoped API keys for MCP |
session | Browser session tokens |
refreshtoken | OAuth refresh tokens for desktop clients |
comment | Threaded comments on resources |
resourceshare | Per-resource sharing with permissions |
appsettings | Key-value config store (LLM settings) |