Open TutorAI β Architecture
OpenTutorAI-CE (Community Edition) is an open-source project designed to provide an educational and collaborative AI-powered platform. This public edition is the foundation for a proprietary Enterprise Edition (EE) and is built to encourage community contributions.
This page describes how the project is organized: the application domains, the gateway and infrastructure layers, the frontend, and the configuration that ties them together.
ποΈ Project Structureβ
open-tutor-ai-CE/
βββ main.py β Python entry point (uvicorn)
β
βββ ββ Application Domains βββββββββββββββββββββββββββββββββββββββββββββββ
βββ accounts/ β Auth, users, roles, permissions
βββ learning/ β Learners, teachers, classrooms, courses
β βββ sessions/ β Chat sessions, tags, sharing, search
β βββ supports/ β Personalized tutoring supports
βββ ai/ β LLM, providers, RAG, media, memory, tools
β βββ llm/ β LLM schemas, service, transports
β βββ model_catalog/ β Model overlays/catalog
β βββ providers/ β OpenAI-compatible + Ollama providers
β βββ retrieval/ β RAG pipeline and knowledge bases
β βββ media/ β Audio (TTS/STT) + image generation
βββ content/ β Files, uploads, learning resources
β βββ files/ β User-owned files and extracted content
β βββ resources/ β Learning resources not tied to RAG
βββ governance/ β HITL governance and LLM response evaluation
β βββ self_regulation/ β Self-regulation feedback domain
βββ system/ β App-level configs and bootstrap services
β βββ configs/ β Runtime app configuration store
β βββ app/ β App info/bootstrap services
β
βββ ββ Gateway & Infrastructure ββββββββββββββββββββββββββββββββββββββββββ
βββ gateway/ β Transport layer
β βββ http/ β FastAPI app, dependencies, routers/
β βββ realtime/ β Socket.IO ASGI (/realtime/socket.io)
βββ data/ β ORM models, DB engine, base repository
βββ config/ β App settings & constants
βββ common/ β Shared utilities (exceptions, logging)
βββ tests/ β Pytest suite
β
βββ ββ Frontend ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββ ui/ β SvelteKit application
β βββ src/lib/apis/ β API clients (one folder per domain)
β βββ src/lib/components/ β Reusable Svelte components
β βββ src/lib/i18n/ β Translations (AR / FR / EN)
β βββ src/routes/ β File-based routing
β βββ static/ β Assets (avatars, images, audio)
β βββ cypress/ β E2E tests
β
βββ ββ DevOps ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββ devops/
β βββ docker/ β Dockerfiles + Docker Compose overlays
β βββ scripts/ β Dev & ops shell scripts
β
βββ ββ Project βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββ docs/ β Documentation
βββ kubernetes/ β Helm charts
βββ .github/workflows/ β CI/CD
βββ var/ β Runtime only, gitignored (DB, uploads, vector_db)
OpenWebUI and Hermes are used as design references only. OpenTutorAI keeps its own domain names and has no runtime dependency on either project.
π§± Application Domainsβ
The application is organized into domains, each owning a clear area of responsibility:
| Domain | Responsibility |
|---|---|
| accounts | Auth, users, roles, permissions |
| learning | Learners, teachers, classrooms, courses β including chat sessions (tags, sharing, search) and personalized tutoring supports |
| ai | LLM (schemas, service, transports), model_catalog (model overlays/catalog), providers (OpenAI-compatible + Ollama), retrieval (RAG pipeline and knowledge bases), and media (audio TTS/STT + image generation) |
| content | files (user-owned files and extracted content) and resources (learning resources not tied to RAG) |
| governance | HITL governance and LLM response evaluation, including the self_regulation feedback domain |
| system | App-level configs (runtime configuration store) and app info/bootstrap services |
Full structure with annotations is maintained in
MIGRATION.mdin the application repository.
π Gateway & Infrastructureβ
| Layer | Responsibility |
|---|---|
| gateway | Transport layer β http/ (FastAPI app, dependencies, routers) and realtime/ (Socket.IO ASGI at /realtime/socket.io) |
| data | ORM models, DB engine, base repository |
| config | App settings & constants |
| common | Shared utilities (exceptions, logging) |
| tests | Pytest suite |
The Python entry point is main.py (run via uvicorn).
π¨ Frontendβ
The frontend is a SvelteKit application in ui/:
| Path | Purpose |
|---|---|
src/lib/apis/ | API clients (one folder per domain) |
src/lib/components/ | Reusable Svelte components |
src/lib/i18n/ | Translations (AR / FR / EN) |
src/routes/ | File-based routing |
static/ | Assets (avatars, images, audio) |
cypress/ | E2E tests |
βοΈ Configurationβ
Open TutorAI is configured through environment variables (copy .env.example to
.env). The defaults work for local development (DEBUG=true).
| Variable | Default | Description |
|---|---|---|
DEBUG | true | Set to false in production. Enables SECRET_KEY strength check. |
SECRET_KEY | (dev placeholder) | JWT signing key. Required in production (openssl rand -hex 32). |
DATABASE_URL | sqlite:///./var/tutorai.db | SQLAlchemy URL. SQLite for dev, PostgreSQL for production. |
OLLAMA_BASE_URL | http://localhost:11434 | Ollama server. Use http://ollama:11434 inside Docker Compose. |
OPENAI_API_BASE_URL | (empty) | OpenAI-compatible API (LMStudio, GroqCloud, Mistralβ¦). |
OPENAI_API_KEY | (empty) | API key for the OpenAI-compatible provider. |
GEMINI_API_KEY | (empty) | Google Gemini API key. |
CORS_ALLOW_ORIGIN | http://localhost:3000,http://localhost:5173 | Comma-separated allowed CORS origins. |
UPLOAD_DIR | ./var/uploads | Directory for uploaded files. |
MAX_UPLOAD_SIZE_MB | 100 | Maximum upload size in MB. |
VECTOR_DB_PATH | ./var/vector_db | ChromaDB storage path for RAG. |
EMBEDDING_MODEL | sentence-transformers/all-MiniLM-L6-v2 | Default embedding model for RAG. |
AUDIO_TTS_ENGINE | (empty) | TTS engine (e.g. openai). Configure via Admin > Settings > Audio. |
AUDIO_STT_ENGINE | (empty) | STT engine. Configure via Admin > Settings > Audio. |
IMAGES_ENGINE | (empty) | Image generation engine (e.g. openai). Configure via Admin > Settings > Images. |
GLOBAL_LOG_LEVEL | INFO | Log level: DEBUG, INFO, WARNING, ERROR. |
Ready to run it? Head to Getting Started for local and Docker setup instructions.