Poliglota — Cross-Platform Language-Learning App
A language-learning app for iOS, Android and the web that takes English speakers from zero to CEFR B2 in German, French, Italian and Portuguese, and to JLPT N3 in Japanese. It's built as a Turborepo monorepo: an Expo / React Native client, a serverless Firebase backend (Auth, Firestore, Cloud Functions, Storage, Hosting), and a typed course-content package. That package is the single source of truth for the curriculum, and a publishing script ships it to Firestore.
What it does
- Structured curriculum — 48 levels per language, aligned to CEFR bands (A1–B2, 12 levels each) or JLPT levels (N5/N4/N3). Each level is split into up to 10 sublevels, and each sublevel is a full lesson on the level's topic with its own grammar point.
- Four-step lessons — flip cards for 10 new words, a vocabulary quiz that mixes in review words, fill-in-the-blank grammar exercises, and a listening step with a short reading. Japanese content includes romaji throughout.
- Neural text-to-speech — vocabulary and readings are read aloud by Google Cloud TTS Neural2 voices (one per language). Generated MP3s are cached in Cloud Storage by content hash, so each phrase is synthesized only once, and the app falls back to on-device speech when the service is unavailable.
- Progress that syncs across devices — the current level and sublevel, study time and lesson scores are stored per user in Firestore. Sublevels unlock in order, and finishing the last one unlocks the next level. Progress advances inside a transaction, so concurrent sessions can't skip or repeat a lesson.
- Word practice — random review rounds (flip cards plus a meaning quiz) drawn from the lessons the learner has already completed.
- Sign-in everywhere — Google (web, Android, iOS), Sign in with Apple (iOS, with a SHA-256 nonce) and passwordless email links on the web. Progress made before sign-in is migrated into the account.
Architecture
Turborepo with npm workspaces. The client never bundles course data: it uses the shared types only and reads content at runtime.
| Package | Role |
|---|---|
apps/mobile |
Expo SDK 58 / React Native 0.88 / React 19 app for iOS, Android and web. File-based routing with Expo Router, React Compiler, light/dark theming |
apps/functions |
Firebase Cloud Functions (2nd gen, Node 22, ESM), bundled with esbuild. Auth-gated callables for text-to-speech, plus the content publisher and emulator tooling |
packages/content |
Typed curriculum data (5 languages × 48 levels × sublevels), builder helpers and shared API/document types consumed by both the app and the functions |
firebase/ |
Firestore and Storage security rules, plus Hosting for Universal Links / App Links and the web sign-in flow |
Content delivery: each level, with all its sublevels, is published as one Firestore document. The app reads a level in a single document read, keeps it in memory for the session, and serves every sublevel from that copy. I compared this against per-file Cloud Storage delivery on cost and chose Firestore: per-request costs are about the same, and Firestore adds auth-gated security rules and needs no download-URL step. Removing the Cloud Function from the content path also eliminated an invocation and cold start per lesson.
Tech stack
- Monorepo — Turborepo, npm workspaces, strict env mode for build caching
- Client — Expo SDK 58, React Native 0.88, React 19 with React Compiler, Expo Router (typed routes), Reanimated, expo-audio / expo-speech, react-native-web
- Backend — Firebase Auth, Cloud Firestore, Cloud Functions 2nd gen, Cloud Storage, Firebase Hosting, Google Cloud Text-to-Speech
- Tooling — TypeScript, esbuild, Vitest, oxlint, ESLint, Firebase Emulator Suite
- Delivery — EAS Build / Submit for the App Store and Google Play (one-command local production builds), Firebase deploy for the backend
Highlights
- Data-validated curriculum — automated tests check every lesson in every language: consecutive levels and sublevels, correct CEFR/JLPT band, exactly 10 words, 5 grammar items and 1 reading per lesson, each word taught only once per course, one blank per exercise, and romaji wherever Japanese needs it.
- Cost-aware serverless design — one document read per level, in-memory caching of immutable content, TTS audio cached by content hash, and a practice mode that samples at most a few levels per round instead of downloading the full vocabulary.
- Abuse-resistant TTS — the speech function only synthesizes text that actually exists in the course, so a signed-in user can't spend the text-to-speech budget on arbitrary input.
- Locked-down data — security rules make course content read-only for signed-in users and writable only by the Admin SDK. Progress documents are owner-only and shape-validated, and older documents stay readable after schema changes.
- Offline-first development —
npm run devstarts the Expo dev server, the functions in watch mode and the full Firebase Emulator Suite, and republishes course content to the local Firestore on every edit. Physical devices on the LAN connect to the emulators automatically. - Backward-compatible releases — the API and progress-format changes keep app versions already in the stores working while the new client rolls out.