How salf423/expresat works
1. Overall shape
- ExpresaT is split into a browser client, a Python inference backend, and a model artifact/training layer.
- The main runtime path is optimized for real-time sign-language translation on CPU, with the browser handling capture/UI and the backend handling model inference.
2. Modern frontend (expresat/frontend)
- This is the active client app, built with Vite + React.
- It is organized into:
- pages/ for route-level screens such as Home, Translator, Learn, Auth, and About
- components/ for shared UI like Navbar, Footer, ThemeToggle, and EnvironmentSelector
- services/ for API/auth/media-pipeline integration
- context/ for cross-app state such as theme
- Architecturally, this is the user-facing shell that drives camera capture, auth flows, and translation interaction.
3. Real-time capture and preprocessing boundary
- The frontend contains a mediapipeEngine service, which indicates client-side pose/hand landmark extraction using MediaPipe.
- That means the browser is not just rendering UI; it also performs the first stage of signal processing before data is sent onward.
- This keeps the system edge-friendly by offloading vision preprocessing to the client instead of requiring a GPU server.
4. Backend (expresat/backend)
- The backend is a FastAPI service launched with uvicorn.
- Its key role is to manage API endpoints and WebSocket connections for low-latency, bidirectional communication.
- websockets_handler.py suggests a dedicated real-time channel, likely used for streaming landmarks/features and returning translated text.
5. Inference layer (expresat/models)
- The ML subsystem is separated from the web app and contains:
- train_and_export.py for training and exporting
- inference.py and inference_engine.py for production inference logic
- exported model artifacts under exported_model/
- The architecture clearly distinguishes training-time PyTorch code from production inference code.
6. Model artifacts and deployment format
- The checked-in artifacts include:
- a PyTorch model (.pt)
- an ONNX model (.onnx + .onnx.data)
- model_metadata.json
- This indicates the production path uses ONNX Runtime for fast CPU inference, while PyTorch is retained for training/export workflows.
- The metadata file likely stores label mappings, preprocessing parameters, or model configuration needed at runtime.
7. End-to-end data flow
- The expected pipeline is:
- user opens the React frontend
- browser captures camera input
- MediaPipe extracts hand/pose signals
- features are sent over API/WebSocket to the backend
- backend runs ONNX-based inference
- translated text is streamed back to the UI
- This is a classic streaming, low-latency inference loop, not a batch or request/response-only architecture.
8. Legacy frontend (expresat/frontend-legacy)
- There is also a complete older static frontend built with HTML/CSS/vanilla JS.
- It contains its own api_service.js, auth_service.js, mediapipe_engine.js, and UI logic, which suggests it once served the same product goals before the React rewrite.
- For architecture diagrams, treat this as a legacy presentation layer rather than the current primary client.
9. Authentication and persistence boundary
- The presence of supabase/schema.sql indicates a backend data layer designed around Supabase-managed database/auth.
- The frontend’s authService modules in both generations suggest user/session handling is part of the product, even if the primary value is real-time translation.
- This is the main persistence boundary in an otherwise mostly stateless streaming system.
10. Deployment and hosting
- netlify.toml and the static frontend structure point to the frontend being deployable as a static site.
- The backend is separately deployable as a Python service.
- This implies a split deployment model: static frontend hosting plus an API/WebSocket backend.
11. Documentation and operational guidance
- docs/BACKEND_TECHNICAL_SPEC.md and docs/deploy.md indicate the repository is intended to be understood and deployed as a system, not just a codebase.
- The docs likely describe the inference contract, websocket protocol, and deployment assumptions that are central to the architecture diagram.
12. Recommended diagram boundaries
- A good architecture diagram should show four boxes:
- Browser client: React/Vite frontend + MediaPipe + UI
- Realtime backend: FastAPI + WebSockets
- ML inference: ONNX Runtime model assets and inference engine
- Data/auth layer: Supabase schema/auth, if used in the current flow
- Add a separate side box for legacy static frontend if you want to reflect repository history, but keep it visually distinct from the active path.
Main entry points: services Client services · App.jsx Frontend app · main.py Backend app · inference_engine.py Inference engine
Components 17
Browser client
Active React/Vite UI and client-side capture pipeline
- Frontend app · Active browser application entry and route composition
expresat/frontend/src/App.jsx - Pages · Home, Translator, Learn, Auth, and About screens
expresat/frontend/src/pages - UI components · Navbar, footer, theme toggle, and environment selector
expresat/frontend/src/components - Client services · API, auth, and MediaPipe integration services
expresat/frontend/src/services - Theme state · Cross-app UI state such as theme
expresat/frontend/src/context/ThemeContext.jsx - MediaPipe · Browser-side landmark extraction before network transfer
expresat/frontend/src/services/mediapipeEngine.js
Realtime backend
FastAPI service and WebSocket transport
- Backend app · Python API service launched with uvicorn
expresat/backend/main.py - WebSocket handler · Low-latency bidirectional streaming interface
expresat/backend/websockets_handler.py
ML inference
Training, export, and production inference assets
- Inference engine · Production inference orchestration and model loading
expresat/models/inference_engine.py - Inference · Core prediction logic for translated output
expresat/models/inference.py - Train/export · Training and export workflow for model artifacts
expresat/models/train_and_export.py - Model artifacts · Checked-in exported model files and metadata
expresat/models/exported_model
Legacy client
Older static frontend kept for reference
- Legacy app · Older HTML/CSS/JS presentation layer
expresat/frontend-legacy/index.html - Legacy MediaPipe · Older browser-side MediaPipe integration
expresat/frontend-legacy/js/mediapipe_engine.js - Legacy services · Older client API and auth modules
expresat/frontend-legacy/js/api_service.js
Data/auth
Supabase-backed persistence and identity boundary
- Supabase schema · Database and auth boundary managed through Supabase
expresat/supabase/schema.sql
Other components
- Docs · Technical spec and deployment guidance
expresat/docs
Connections 19
- Frontend app → Pages: renders · Route-level screens compose the active UI
- Frontend app → UI components: uses · Shared shell elements used across pages
- Frontend app → Theme state: reads state · Theme and cross-app UI state
- Pages → Client services: calls · Screens invoke client services for API and auth
- Client services → MediaPipe: preprocesses · Client-side landmark extraction before upload
- Client services → Backend app: api calls · HTTP requests to backend endpoints
- Client services → WebSocket handler: streams · Bidirectional realtime translation channel
- Backend app → WebSocket handler: mounts · Backend app exposes the realtime handler
- Backend app → Inference engine: loads · Backend delegates prediction to model runtime
- WebSocket handler → Inference engine: invokes · Streaming requests trigger inference
- Inference engine → Inference: executes · Wrapper calls core inference logic
- Inference engine → Model artifacts: reads · Runtime loads exported ONNX/PyTorch assets
- Train/export → Model artifacts: produces · Training/export workflow writes checked-in artifacts
- Client services → Supabase schema: auth/persist · Client authentication and persistence boundary
- Legacy app → Legacy services: uses · Legacy UI depends on local services
- Legacy app → Legacy MediaPipe: uses · Legacy client-side preprocessing
- Legacy services → Supabase schema: auth/persist · Older auth and storage boundary
- Docs → Backend app: documents · Operational and backend technical guidance
- Docs → Frontend app: documents · Deployment and system usage guidance