How nhockool1002/laos-self-learning works
Project type and purpose
• This is a full-stack-style, single-page application (SPA) with an optional desktop packaging layer (Electron).
• Its purpose is to teach Lao language with interactive lessons, quizzes, user authentication, progress tracking, and badges.
File structure
• Top-level:
• electron.js – entry point for Electron desktop wrapper
• webpack.config.js / tsconfig.json – build and compile configuration
• public/ – static assets (index.html, PWA manifest, badge images)
• src/ – all TypeScript/React source code
• Inside src/:
• pages/ – route-level components (Home, Lessons, Practice, Tests, WritingBoard)
• components/ – reusable UI components (FlashCard, Layout, LoginModal, etc.)
• contexts/ – React Contexts for global state (AuthContext)
• services/ – data-access/service layer (badgeService, supabase calls)
• config/ – environment and Supabase configuration
• data/ – static lesson and practice data
• i18n.ts – localization setup
• demo/ – sample scripts (createBadge)
• CI/CD: .github/workflows/ci.yml runs tests and builds.
README for additional insights
• Tech stack: React + TypeScript, Material-UI, React Router, i18next, Supabase (Auth + Storage), Electron for desktop.
• Functional modules: alphabet lessons, quizzes, scoring, badges, user auth and progress persistence.
a. Main components
• Client Application (React SPA)
• Electron Host (optional desktop container)
• Static Asset Server / CDN (serves index.html, JS bundle, images)
• Supabase Backend (Auth service, Postgres DB, Storage)
• External APIs (e.g., Google Sheets API if used, ResponsiveVoice TTS)
b. Relationships & data flows
• User ↔ React UI: user interactions trigger component logic
• React UI → Service layer: badgeService.ts, supabaseConfig.ts → Supabase SDK
• Supabase Auth ↔ React Context (AuthContext) manages login state
• React UI ↔ Supabase Database: fetch/save user progress, badges
• React UI loads static data from src/data (lessons, practice)
• Electron.js wraps the built SPA and communicates via IPC if needed
• CI Pipeline → Build → Deploy to hosting (optional)
c. Architectural patterns & design principles
• Layered Architecture: UI layer (components/pages) → Service layer → Data layer (Supabase + static JSON)
• Component-Based: reusable React components with single responsibility
• Context API for global state (authentication, theming)
• Client-side routing (React Router) for page navigation
• BaaS (Supabase) offloads backend responsibilities
d. Key technologies & libraries
• React, React Router, React Context, TypeScript
• Material-UI for styling, i18next for localization
• Supabase JS SDK for Auth & Database
• Electron for desktop packaging
• Webpack for bundling