Skip to main content

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)
Design references

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:

DomainResponsibility
accountsAuth, users, roles, permissions
learningLearners, teachers, classrooms, courses β€” including chat sessions (tags, sharing, search) and personalized tutoring supports
aiLLM (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)
contentfiles (user-owned files and extracted content) and resources (learning resources not tied to RAG)
governanceHITL governance and LLM response evaluation, including the self_regulation feedback domain
systemApp-level configs (runtime configuration store) and app info/bootstrap services

Full structure with annotations is maintained in MIGRATION.md in the application repository.


πŸ”Œ Gateway & Infrastructure​

LayerResponsibility
gatewayTransport layer β€” http/ (FastAPI app, dependencies, routers) and realtime/ (Socket.IO ASGI at /realtime/socket.io)
dataORM models, DB engine, base repository
configApp settings & constants
commonShared utilities (exceptions, logging)
testsPytest suite

The Python entry point is main.py (run via uvicorn).


🎨 Frontend​

The frontend is a SvelteKit application in ui/:

PathPurpose
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).

VariableDefaultDescription
DEBUGtrueSet to false in production. Enables SECRET_KEY strength check.
SECRET_KEY(dev placeholder)JWT signing key. Required in production (openssl rand -hex 32).
DATABASE_URLsqlite:///./var/tutorai.dbSQLAlchemy URL. SQLite for dev, PostgreSQL for production.
OLLAMA_BASE_URLhttp://localhost:11434Ollama 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_ORIGINhttp://localhost:3000,http://localhost:5173Comma-separated allowed CORS origins.
UPLOAD_DIR./var/uploadsDirectory for uploaded files.
MAX_UPLOAD_SIZE_MB100Maximum upload size in MB.
VECTOR_DB_PATH./var/vector_dbChromaDB storage path for RAG.
EMBEDDING_MODELsentence-transformers/all-MiniLM-L6-v2Default 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_LEVELINFOLog level: DEBUG, INFO, WARNING, ERROR.

Next steps

Ready to run it? Head to Getting Started for local and Docker setup instructions.