How clouds440/mentra works
Mentra is an adaptive AI learning workspace: users authenticate, complete profile onboarding, then use chat and Library materials to get grounded learning help, with account-owned history and learner state. The React workspace calls a FastAPI backend whose domain services coordinate model workflows, retrieval, persistence, assessments, profile and memory capabilities. The README documents additional product branches such as Events, web search, speech, notifications, EduVerse provisioning and vision; they are retained at subsystem level. Some wiring is unsampled, so undocumented links are omitted.
Main entry points: routes Route modules · service.py RAG service · orchestration_service.py Chat orchestration · database.py PostgreSQL repositories
Components 25
Learning workspace
- React workspace
frontend/src/App.tsx - Auth and onboarding
frontend/src/components/auth/AuthRoutes.tsx - Chat experience
frontend/src/components/chat/ChatSession.tsx - Library workspace
frontend/src/pages/LibraryPage.tsx - API clients
frontend/src/services/api.ts
API and identity
- FastAPI application
backend/app/main.py - Route modules
backend/app/api/routes - Accounts and sessions
backend/app/auth/service.py - EduVerse integration
backend/app/integrations/eduverse.py
Learning domains
- Student profile
backend/app/student_profile/service.py - Conversation service
backend/app/chat/service.py - Memory and events
backend/app/history_management/service.py - Assessments
backend/app/assessments/service.py - Learner engine
backend/app/learner/engine.py - Notifications
backend/app/notifications/service.py
AI workflows
- Chat orchestration
backend/app/langchain/orchestration_service.py - Chat model runtime
backend/app/langchain/chat_service.py - Document extraction
backend/app/documents/service.py - Speech recognition
backend/app/speech/engine.py - Web search
backend/app/web_search/service.py
Persistence and retrieval
- RAG service
backend/app/rag/service.py - Embedding service
backend/app/rag/embeddings.py - Qdrant vectors
backend/app/rag/qdrant_store.py - PostgreSQL repositories
backend/app/db/database.py
Other components
- Learner
Connections 31
- Learner → React workspace: uses workspace
README.md - React workspace → Auth and onboarding: guards routes
frontend/src/App.tsx - React workspace → Chat experience: renders chat
frontend/src/App.tsx - Auth and onboarding → API clients: checks session
- Chat experience → API clients: calls API
- Library workspace → API clients: calls API
- API clients → FastAPI application: sends requests
README.md - FastAPI application → Route modules: includes router
backend/app/main.py - Route modules → Accounts and sessions: handles auth
- Route modules → Conversation service: handles conversations
- Route modules → RAG service: handles Library
- Route modules → Student profile: handles profile
- Route modules → Assessments: handles assessments
- Route modules → Speech recognition: handles speech
- Route modules → Web search: handles search
- Route modules → Notifications: handles notifications
- Route modules → EduVerse integration: provisions identity
- Conversation service → Chat orchestration: generates replies
backend/app/chat/service.py - Chat orchestration → Chat model runtime: requests generation
backend/app/langchain/orchestration_service.py - Chat orchestration → RAG service: retrieves sources
backend/app/langchain/orchestration_service.py - Chat orchestration → Memory and events: reads history
- Chat orchestration → Web search: searches web
- Assessments → PostgreSQL repositories: persists attempts
backend/app/assessments/service.py - Assessments → Document extraction: extracts answers
backend/app/assessments/service.py - Student profile → PostgreSQL repositories: stores profile
- Learner engine → PostgreSQL repositories: stores learner state
- RAG service → Document extraction: parses materials
- RAG service → Embedding service: creates vectors
README.md - RAG service → Qdrant vectors: retrieves vectors
README.md - RAG service → PostgreSQL repositories: stores source records
- Memory and events → PostgreSQL repositories: persists memories