How azizmessaoud/alia works
1. Top-level shape
- This is a Remix + TypeScript full-stack app with a clear split between:
- UI/routes under app/routes
- server-only domain logic under app/lib/*.server.*
- browser-only interaction logic under app/lib/*.client.*
- persistent state in Supabase/Postgres migrations under supabase/migrations
2. Primary user-facing flows
- The main experience is the training session route at app/routes/training/session.$id.tsx, which appears to host the live training session.
- Supporting routes include:
- app/routes/_index.tsx for landing/home
- app/routes/status.tsx and app/routes/api.health.ts for status/health visibility
- app/routes/test.audio2face.tsx and app/routes/api.test.audio2face.ts for avatar/audio integration testing
3. Live interaction layer
- The browser-side session experience is built from React components in app/components, especially:
- Avatar.tsx and AvatarWithLipSync.tsx for the 3D avatar
- ChatInput.tsx for user prompts
- MultimodalHUD.tsx and SessionHUD.tsx for real-time telemetry and session feedback
- CompetencyLevelDisplay.tsx for progress/scoring feedback
- public/avatar.glb, public/avatars/*.glb, and public/glm5.js are static assets used by the avatar/rendering layer.
4. Real-time client processing
- app/lib/multimodal-processor.client.ts and app/lib/lip-sync-animator.client.ts indicate that some sensing and animation work happens in the browser.
- app/hooks/useALIAWebSocket.ts suggests a persistent WebSocket connection that streams live session events/telemetry between browser and server.
5. Avatar and speech pipeline
- The avatar pipeline is split across server and client:
- app/lib/tts-nvidia.server.ts and app/lib/tts.server.js handle text-to-speech generation
- app/lib/lipsync.server.js and app/lib/lip-sync-animator.client.ts handle synchronization between generated speech and avatar motion
- app/lib/nvidia-nim.server.ts suggests a server-side integration with NVIDIA NIM for inference, likely used for speech or multimodal generation
- The existence of server-nvidia-nim.js and server-websocket.js shows there are also standalone Node server entry points for some real-time services.
6. Memory subsystem
- app/lib/memory-os.server.ts is the core of the repo’s memory system.
- The API surface around it is in:
- app/routes/api.memory.store-episode.ts
- app/routes/api.memory.retrieve.ts
- app/routes/api.memory.profile.$rep_id.ts
- The database schema in supabase/migrations/001_memory_os.sql and combined.sql supports episodic storage, retrieval, and rep profile persistence.
- This memory layer feeds personalization back into the training session and likely into orchestration/prompt context.
7. Retrieval and reasoning layer
- app/lib/rag-pipeline.server.ts is the repository’s retrieval-augmented generation path, likely combining memory retrieval with LLM prompts.
- app/lib/providers.ts centralizes model/provider selection.
- app/lib/orchestration.server.ts is the main server-side control plane that likely coordinates memory, scenario generation, scoring, and feedback.
8. Competency and evaluation
- app/lib/competency-level.server.ts plus app/routes/api/competency-level.ts indicate a scoring/evaluation subsystem separate from chat generation.
- The UI component CompetencyLevelDisplay.tsx exposes those scores back to the user.
- This is the repo’s main “performance feedback” loop: session data in, competency assessment out.
9. API boundary
- The repo exposes a small set of focused API endpoints rather than a broad CRUD surface:
- api.chat.ts for conversational/session turns
- api.health.ts for system health
- memory endpoints for episode/profile retrieval/storage
- competency-level and audio2face test endpoints
- This suggests the browser mostly talks to the server through Remix route actions/loaders plus these API routes, not via a separate backend service.
10. Data and persistence
- Supabase is the persistent backend, and the migrations show two major data domains:
- Memory OS
- Competency levels
- The README mentions pgvector, which implies vector-based semantic retrieval is part of the architecture even though the vector search implementation is hidden behind the server library layer.
11. External/auxiliary runtime components
- The repository includes multiple standalone server scripts:
- server-ollama.js
- server-nvidia-nim.js
- server-websocket.js
- These suggest the app can run with different model backends or local inference stacks, and that real-time transport can be decoupled from the Remix app process.
12. Operational and deployment support
- scripts/ contains migration and test helpers, which indicates the system is designed to be deployed with database initialization and service validation steps.
- The docs/ and top-level markdown files heavily document audio/lip-sync, NVIDIA NIM migration, Supabase deployment, and security/performance, so the repo has significant emphasis on operational readiness and integration tuning, not just UI code.
13. Important architectural boundary
- The most important boundary for a diagram is the split between:
- interactive browser session (avatar, HUD, chat, WebSocket, client ML/animation)
- server orchestration (memory, RAG, scoring, model/provider integration, speech generation)
- persistent storage (Supabase/Postgres/pgvector)
- That separation is central to how ALIA maintains low-latency real-time training while preserving cross-session memory and evaluation history.
14. Repository-specific takeaway
- In architecture terms, this is not a generic chat app: it is a real-time training system where the live session UI is tightly coupled to a server-side intelligence layer, and that intelligence layer is backed by a memory store and competency scoring database.
Main entry points: session.$id.tsx Training session · orchestration.server.ts Orchestration · memory-os.server.ts Memory OS · root.tsx Remix app
Components 34
Browser session
Remix routes and React components that drive the live training experience.
- Remix app · Top-level Remix + TypeScript application shell.
app/root.tsx - Landing · Home route for the app.
app/routes/_index.tsx - Training session · Main live training experience for a single session.
app/routes/training/session.$id.tsx - Status page · Human-visible status and health view.
app/routes/status.tsx - Avatar UI · 3D avatar rendering and lip-synced presentation.
app/components/AvatarWithLipSync.tsx - Session HUD · Live telemetry and session feedback surfaces.
app/components/SessionHUD.tsx - Chat input · User prompt entry for the live session.
app/components/ChatInput.tsx - WebSocket hook · Persistent browser connection for live events and telemetry.
app/hooks/useALIAWebSocket.ts - Multimodal processor · Browser-side sensing and real-time processing logic.
app/lib/multimodal-processor.client.ts - Lip animator · Client-side avatar motion and animation timing.
app/lib/lip-sync-animator.client.ts - Audio2Face test · UI for testing avatar and audio integration.
app/routes/test.audio2face.tsx
Server intelligence
Domain logic, orchestration, retrieval, scoring, speech, and model integration.
- Chat API · Session turn handling and conversational backend boundary.
app/routes/api.chat.ts - Health API · Simple system health endpoint.
app/routes/api.health.ts - Memory API · Stores, retrieves, and serves rep profile memory.
app/routes/api.memory.store-episode.ts - Retrieve memory · Memory retrieval endpoint.
app/routes/api.memory.retrieve.ts - Rep profile · Profile lookup endpoint keyed by rep id.
app/routes/api.memory.profile.$rep_id.ts - Competency API · Server endpoint for scoring and evaluation state.
app/routes/api/competency-level.ts - Orchestration · Main control plane coordinating session flow, memory, scoring, and feedback.
app/lib/orchestration.server.ts - RAG pipeline · Retrieval-augmented generation path for prompts and context.
app/lib/rag-pipeline.server.ts - Memory OS · Core episodic memory and profile logic.
app/lib/memory-os.server.ts - Competency logic · Server-side scoring and evaluation subsystem.
app/lib/competency-level.server.ts - Model providers · Central model/provider selection and configuration.
app/lib/providers.ts - NVIDIA NIM · Server-side integration for hosted inference and generation.
app/lib/nvidia-nim.server.ts - Speech pipeline · Text-to-speech generation and speech preparation.
app/lib/tts-nvidia.server.ts - Lip sync · Speech-to-avatar synchronization across server and client.
app/lib/lipsync.server.js - Audio2Face API · Backend test endpoint for audio-to-avatar integration.
app/routes/api.test.audio2face.ts
Persistence
Supabase/Postgres schema for memory and competency history.
- Supabase DB · Persistent Postgres backend for memory and competency state.
supabase/migrations/combined.sql - Memory schema · Episodic storage and retrieval tables/indexes.
supabase/migrations/001_memory_os.sql - Competency schema · Persistence for competency history and scores.
supabase/migrations/002_competency_levels.sql
Aux runtimes
Standalone Node services and static assets that support real-time interaction.
- Avatar asset · Primary avatar model and supporting static assets.
public/avatar.glb - GLM runtime · Client-side asset used by the avatar/rendering layer.
public/glm5.js - WebSocket server · Standalone real-time transport service.
server-websocket.js - NIM server · Standalone NVIDIA NIM-backed service entry point.
server-nvidia-nim.js - Ollama server · Standalone local model backend entry point.
server-ollama.js
Connections 37
- Remix app → Landing: routes · Remix app exposes landing page.
- Remix app → Training session: routes · Main interactive session route lives in Remix.
- Remix app → Status page: routes · Status view is part of the browser app.
- Remix app → Audio2Face test: routes · Testing route for avatar/audio integration.
- Training session → Avatar UI: renders · Session UI mounts the avatar presentation.
- Training session → Session HUD: renders · Session UI shows live telemetry and feedback.
- Training session → Chat input: captures · User input enters the live session through chat.
- Training session → WebSocket hook: streams · Session subscribes to live events over WebSocket.
- Training session → Multimodal processor: processes · Browser-side multimodal processing supports live interaction.
- Training session → Lip animator: animates · Client animation logic updates avatar motion.
- Chat input → Chat API: sends · Prompt submissions are handled by the chat API.
- WebSocket hook → WebSocket server: connects · Browser connects to standalone realtime service.
- Chat API → Orchestration: delegates · Conversation turns are coordinated by orchestration.
- Orchestration → Memory OS: uses · Orchestration consults episodic and profile memory.
- Orchestration → RAG pipeline: uses · Retrieval-augmented prompts feed generation.
- Orchestration → Competency logic: uses · Session flow includes scoring and evaluation.
- Orchestration → Model providers: selects · Model/provider choice is centralized.
- Model providers → NVIDIA NIM: routes to · Provider layer can target NVIDIA NIM.
- Orchestration → Speech pipeline: generates · Speech output is produced server-side.
- Speech pipeline → Lip sync: feeds · Generated speech drives lip-sync timing.
- Lip sync → Lip animator: updates · Client animation consumes lip-sync signals.
- Memory API → Memory OS: writes · Store-episode endpoint persists memory.
- Retrieve memory → Memory OS: reads · Retrieve endpoint queries memory state.
- Rep profile → Memory OS: reads · Profile endpoint serves rep-specific memory.
- Competency API → Competency logic: reads/writes · Competency endpoint exposes scoring state.
- Memory OS → Supabase DB: persists · Memory OS stores episodic and profile data.
- Competency logic → Supabase DB: persists · Competency history is stored in Postgres.
- Supabase DB → Memory schema: defined by · Memory persistence is backed by migrations.
- Supabase DB → Competency schema: defined by · Competency persistence is backed by migrations.
- Audio2Face test → Audio2Face API: tests · Test UI exercises the integration endpoint.
- Audio2Face test → Avatar asset: uses · Avatar test UI depends on 3D assets.
- Avatar UI → Avatar asset: loads · Avatar component renders GLB assets.
- Avatar UI → GLM runtime: uses · Avatar rendering uses supporting browser asset.
- Status page → Health API: checks · Status page can surface health information.
- Health API → WebSocket server: observes · Health checks may reflect realtime service state.
- NIM server → NVIDIA NIM: hosts · Standalone service can serve NVIDIA-backed inference.
- Ollama server → Model providers: backs · Local model service can back provider selection.