Lǐli is a React + TypeScript app for HSK 1 Mandarin practice. It provides structured mini-lessons with:
- English teaching text
- Mandarin phrases with Chinese, pinyin, and translation
- One-click pronunciation playback
- Gemini calls now run through a local server (
/api/chat,/api/speech) so API keys stay server-side. - Client adds request-ordering safeguards and abort control to avoid stale or out-of-order responses.
- UI refreshed with a calmer studio look, stronger hierarchy, and improved accessibility.
- React 19 + TypeScript
- Vite 6 + Tailwind CSS 4
- Motion
- Express API server
- Google GenAI SDK (
@google/genai)
src/App.tsx: chat orchestration, request lifecycle, global messagingsrc/lib/gemini.ts: typed client helpers for/apiendpointssrc/components/ChatMessage.tsx: lesson/phrase rendering and playback controlssrc/components/ChatInput.tsx: message input behaviorserver/index.ts: Gemini text + TTS API routes
- Install dependencies:
pnpm install - Create a local env file:
cp .env.example .env.local - Set your key in
.env.local:GEMINI_API_KEY=your_key_here - Start app + API server:
pnpm dev - Open http://localhost:3000
pnpm dev: run API server and Vite dev serverpnpm build: build client bundlepnpm start: run production API server (servesdist/when built)pnpm preview: preview client bundle onlypnpm lint: TypeScript type-check