
Lingora AI Privacy-first AI language learning with strict progression, real user data and multi-model support
Chủ kho mã trên GitHub
Kết hợp lộ trình học, luyện kỹ năng và gia sư AI trong một ứng dụng có dữ liệu riêng theo tài khoản.
English · Tiếng Việt · Quick Start · Configuration · Architecture

Lingora is an open-source AI-assisted English learning platform built with Next.js, Supabase and Stripe. It combines structured learning stages, skill-based practice, document learning, gamification and configurable AI providers in one account-isolated application.
user / admin authorization and Supabase Row Level Security.Lingora never silently trains on private conversations. Training candidates require explicit feedback, learner consent, PII filtering and administrator review before export.
Lingora là nền tảng học tiếng Anh mã nguồn mở có AI, sử dụng dữ liệu thật theo từng tài khoản và bảo vệ dữ liệu bằng Supabase RLS.
user / admin; user chỉ truy cập dữ liệu của chính mình.| Authentication | Learning roadmap |
|---|---|
![]() | ![]() |
| Adaptive practice | Administration |
|---|---|
![]() | ![]() |
The administration dashboard reads directly from Supabase and visualizes 14-day learning activity, plan distribution, skill engagement and the current content inventory.


| Module | Capabilities |
|---|---|
| AI Tutor | Multi-model chat, document context, persisted sessions, feedback |
| Roadmap | Sequential units, mastery gates, completion summaries, boss stages |
| Skill Practice | Reading, listening, speaking and writing progress |
| Documents | PDF/DOCX/TXT extraction, summaries, questions and vocabulary |
| Vocabulary | Personal word library and review scheduling |
| Flashcards | Learner-owned cards and spaced repetition |
| Speaking | Microphone permission diagnostics and Web Speech transcription |
| Quiz | Multiple choice, fill blank, dictation, matching and sentence order |
| Progress | Skill mastery, attempts, study time, streaks and levels |
| Competition | Opt-in leaderboard, weekly challenges and anti-spam scoring |
| Economy | XP, Lingora Tokens, temporary unlocks and Stripe purchases |
| Settings | Profile, avatar, locale, preferences, AI keys and diagnostics |
| Admin | Users, content studio, billing metrics, AI Lab and system status |
Requirements:
git clone https://github.com/Meranh05/LingoraAI.git
cd LingoraAI
pnpm install
Windows PowerShell:
Copy-Item .env.example .env.local
pnpm dev
macOS/Linux:
cp .env.example .env.local
pnpm dev
Open http://localhost:3000.
Protected routes redirect to /setup until Supabase is configured. Lingora
does not generate fake learner records when the backend is missing.
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
SUPABASE_SECRET_KEY=
GEMINI_API_KEY=
GROQ_API_KEY=
OPENAI_API_KEY=
OPENROUTER_API_KEY=
ANTHROPIC_API_KEY=
GOOGLE_CLOUD_TRANSLATION_API_KEY=
AZURE_TRANSLATOR_KEY=
AZURE_TRANSLATOR_REGION=
AZURE_TRANSLATOR_ENDPOINT=https://api.cognitive.microsofttranslator.com
LIBRETRANSLATE_URL=
LIBRETRANSLATE_API_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY is intended for browser use with RLS.
SUPABASE_SECRET_KEY, AI provider keys and Stripe secrets must remain
server-only.
Users can alternatively enter an AI API key in Settings. Browser-entered keys
are kept in sessionStorage, sent to a server Route Handler only when making a
request, and are not persisted to Supabase.
.env.local.supabase/migrations in filename order.http://localhost:3000/auth/callback
https://your-domain.com/auth/callback
For Google OAuth, register this callback URL in Google Cloud:
https://YOUR_PROJECT_REF.supabase.co/auth/v1/callback
The migrations create:
Promote the first administrator once in Supabase SQL Editor:
update public.profiles
set role = 'admin'
where id = (
select id from auth.users where email = 'owner@example.com'
);
Lingora can automatically detect a provider from the selected provider, API key prefix, model name or custom Base URL.
| Provider | Environment variable |
|---|---|
| Gemini | GEMINI_API_KEY |
| Groq | GROQ_API_KEY |
| OpenAI | OPENAI_API_KEY |
| OpenRouter | OPENROUTER_API_KEY |
| Anthropic | ANTHROPIC_API_KEY |
| Compatible API | Custom Base URL and model in Settings |
Retryable provider failures such as HTTP 429, 500, 502, 503 and 504
use bounded retries and return actionable messages to the interface.
The Translation workspace uses a server-side provider chain:
Azure AI Translator → Google Cloud Translation → LibreTranslate → Lingora AI fallback
The browser only calls Lingora's authenticated /api/translation route. API
keys stay on the server, and translation text is not stored in learning-event
metadata.
Recommended free/low-cost setup:
.env.local:AZURE_TRANSLATOR_KEY=your_azure_translator_key
AZURE_TRANSLATOR_REGION=your_resource_region
AZURE_TRANSLATOR_ENDPOINT=https://api.cognitive.microsofttranslator.com
Google Cloud Translation can be used as a second provider:
.env.local:GOOGLE_CLOUD_TRANSLATION_API_KEY=your_server_side_key
LibreTranslate can be self-hosted or pointed at a trusted instance:
LIBRETRANSLATE_URL=http://localhost:5000
LIBRETRANSLATE_API_KEY=
After changing translation environment variables, restart the Next.js server. The UI supports automatic source-language detection, explicit source/target selection, language swapping and copy-to-clipboard.
Speaking practice uses the browser Web Speech API.
localhost.Settings includes diagnostics for network state, secure context, microphone, speech support, cookies and server AI providers.
Lingora uses Stripe Checkout for subscriptions and token purchases, Stripe Customer Portal for account management, and signed webhooks for synchronization.
Create a webhook endpoint:
https://your-domain.com/api/billing/webhook
Subscribe it to:
checkout.session.completed
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
invoice.paid
invoice.payment_failed
Local webhook forwarding:
stripe listen --forward-to localhost:3000/api/billing/webhook
The seeded catalog includes Basic, Plus and Pro plans. Prices and limits are
stored in public.billing_plans and can be managed from the database/admin
workflow. Test-mode admin accounts can use the developer checkout flow; normal
users can use card checkout or the one-time three-day trial flow.
flowchart LR
UI["Next.js UI"] --> SSR["Supabase SSR auth"]
SSR --> Auth["Supabase Auth"]
UI --> API["Route Handlers / Server Actions"]
API --> Access["Server authorization"]
Access --> DB["PostgreSQL + RLS"]
API --> AI["AI provider gateway"]
AI --> Models["Gemini / Groq / OpenAI / OpenRouter / Anthropic"]
API --> Stripe["Stripe Checkout + Webhooks"]
DB --> Review["Consented feedback review"]
Review --> Export["Admin-approved anonymized export"]
Security is enforced through:
getClaims().See docs/ARCHITECTURE.md.
pnpm lint
pnpm typecheck
pnpm test
pnpm build
# Run the complete quality gate
pnpm check
The GitHub Actions workflow runs the same quality gate for pull requests and
pushes to main.
Bug fixes, translations, CEFR content, accessibility improvements and provider adapters are welcome. Read CONTRIBUTING.md before opening a pull request.
If Lingora is useful, star the repository, share a screenshot or open a focused issue with reproducible details.
Do not disclose authentication bypasses, RLS failures, secret exposure or cross-user access in public issues. Follow SECURITY.md.
Lingora is distributed under the GNU General Public License v3.0.