How flamilani/libras-virtual works
Project Type and Purpose
• This is a hybrid mobile/Web application built with Angular (v16) and packaged using Capacitor into an Android native wrapper.
• The “src” directory contains the Angular Single-Page Application (SPA) (UI components, pages, services, shared modules).
• The “android” directory is the Capacitor-generated native Android project (MainActivity, AndroidManifest, Gradle scripts).
• It can be deployed as a PWA (netlify.toml, service worker config) or as an Android app via Capacitor.
File Structure Analysis
• Top-level:
• src/ – Angular app
• android/ – Native Android wrapper (capacitor.config.ts config)
• package.json, angular.json – Angular CLI build & project config
• netlify.toml, ngsw-config.json – PWA/web deploy configs
• src/app
• app.component, app.route – root component, router
• pages/ – feature modules (home/, quiz/, games, etc.) following Angular Router lazy loading
• shared/ – common components, services, constants, state management (CDK dialog, bottom-sheet, speech OCR, ML-model assets in src/assets/models)
• android/app/src/main/java – MainActivity extends CapacitorActivity to host the WebView
• assets/models – TensorFlow.js face detection model shards loaded at runtime
a. Main Containers
1. Angular SPA (Web Container)
• UI Layer: pages, components, shared UI modules
• Services Layer: datas.service, quiz.service, state.service, update.service
• Constants & Helpers: static data, route helpers
2. Capacitor Bridge
• JavaScript ↔ Native plugins (using Capacitor Plugins API)
3. Native Android Layer
• Android WebView host (MainActivity)
• Native plugins (Camera, FileSystem, Device)
b. Assets & Models
• Local ML Models (face_expression_model, tiny_face_detector_model) served from assets/models
c. PWA/Web Deployment
• Service Worker (ngsw-config.json)
• Netlify hosting (netlify.toml)
Relationships and Data Flows
• User → Angular UI (components/pages) → Angular Router
• UI Components ↔ Shared Services (business logic, state)
• Services load static data (constants), assets (models), or call external APIs if any
• For native features (camera, file paths, speech recognition) → Capacitor Bridge → Native Android plugins → Device hardware
• Build pipeline: Angular CLI → dist/ (www) → Capacitor copy to android/app/src/main/assets/public → Android build
Architectural Patterns & Principles
• Modular Angular design: feature modules (home.module.ts), shared module for reusability
• Dependency Injection for services
• Lazy loading of pages via Router
• Separation of concerns: UI vs business logic vs native interaction
• PWA support: service worker with offline cache of assets & models